如何使用pandas_profiling对表进行数据配置文件

时间:2019-04-04 17:27:27

标签: python

当我尝试通过使用pandas_profiling抛出

之类的错误来分析一个sql服务器表的数据时

尝试了在         当前进程已完成其引导阶段。

    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.

这是我用来运行的代码,我不知道如何解决此问题。

import pandas as pd
import pandas_profiling


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

enter code here

我希望看到给定表的分析结果enter image description here

1 个答案:

答案 0 :(得分:1)

尝试使用multiprocessing.freeze_support()如下:

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()