【问题标题】:How to do Data profile to a table using pandas_profiling如何使用 pandas_profiling 对表进行数据分析
【发布时间】:2019-04-04 17:27:26
【问题描述】:

当我尝试使用 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

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

【问题讨论】:

    标签: python pandas-profiling


    【解决方案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()
    

    【讨论】:

      猜你喜欢
      • 2018-12-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-09-25
      • 1970-01-01
      • 2014-04-09
      相关资源
      最近更新 更多