How to do Data profile to a table using pandas_profiling

自古美人都是妖i 提交于 2019-12-13 08:44:10

问题


When I'm trying to do data profiling one sql server table by using pandas_profiling throwing an error like

An attempt has been made to start a new process before the current process has finished its bootstrapping phase.

    This probably means that you are not using fork to start your
    child processes and you have forgotten to use the proper idiom
    in the main module:

        if __name__ == '__main__':
            freeze_support()
            ...

    The "freeze_support()" line can be omitted if the program
    is not going to be frozen to produce an executable.

This is the code which I'm using to run,I couldn't figure out how to resolve this issue.

import pandas as pd
import pandas_profiling


df=pd.DataFrame(read)
profile=pandas_profiling.ProfileReport(df)

enter code here

I expect to see a profiling result of a given table:


回答1:


try using multiprocessing.freeze_support() as below:

import multiprocessing
import numpy as np
import pandas as pd
import pandas_profiling


def test_profile():
    df = pd.DataFrame(
        np.random.rand(100, 5),
        columns=['a', 'b', 'c', 'd', 'e']
    )

    profile = pandas_profiling.ProfileReport(df)
    profile.to_file(outputfile="output.html")


if __name__ == '__main__':
    multiprocessing.freeze_support()
    test_profile()


来源:https://stackoverflow.com/questions/55521803/how-to-do-data-profile-to-a-table-using-pandas-profiling

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!