0

Showing this error while executing Pandas Profiling on pycharm or windows terminal

Pycharm latest
Python version 3.6 Windows 7 Pandas profiling 1.4

pandas_profiling.ProfileReport(df) :

RuntimeError: 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.
4

1 回答 1

0

所以这个问题的解决方案很简单,如下所示:

在我的代码中添加了一个 main,然后最后调用 if name 语句来运行。这通过快速简单的步骤解决了我的问题。

import pandas as pd
import pandas_profiling
def main():
# my code for profiling
    df = pd.read_csv('csvfile')
    profile = pandas_profiling.ProfileReport(df)
    profile.to_file("profile.html")

if __name__ == "__main__": main()
于 2018-07-18T08:48:24.993 回答