-1

当我尝试使用 pandas_profiling 对一个 sql server 表进行数据分析时,会抛出类似的错误

在当前进程完成其引导阶段之前,已尝试启动一个新进程。

    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

我希望看到给定表的分析结果:

在此处输入图像描述

4

1 回答 1

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()
于 2019-06-23T18:35:08.043 回答