Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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:

enter image description here

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
169 views
Welcome To Ask or Share your Answers For Others

1 Answer

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...