How to do Data profile to a table using pandas_profiling

2024/10/7 0:19:12

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 thecurrent process has finished its bootstrapping phase.

    This probably means that you are not using fork to start yourchild processes and you have forgotten to use the proper idiomin the main module:if __name__ == '__main__':freeze_support()...The "freeze_support()" line can be omitted if the programis 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_profilingdf=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

Answer

try using multiprocessing.freeze_support() as below:

import multiprocessing
import numpy as np
import pandas as pd
import pandas_profilingdef 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()
https://en.xdnf.cn/q/118884.html

Related Q&A

Python replace line by index number

Is it possible in Python to replace the content of a line in a file by its index number?Would something like a line.replace to do this procedure?

print/list only 5 entries from OS.Walk in python

My Goal - To list only 5 entries when using OS walk. So far I have only been able to get a list of everything that I find using OS.Walk or only list one entry. (By using the return function) My code: i…

Numpy vectorisation of python object array

Just a short question that I cant find the answer to before i head off for the day,When i do something like this:v1 = float_list_python = ... # <some list of floats> v2 = float_array_NumPy = ... …

Python user must only enter float numbers

I am trying to find out how to make it so the user [only enters numbers <0] and [no letters] allowed. Can someone show me how I would set this up. I have tried to set up try/catch blocks but I keep …

Django 1.7: some_name() takes exactly 2 arguments (1 given)

this is my view.pyfrom django.http import HttpResponse import datetime def current_datetime(request):now = datetime.datetime.now()html = "<html><body>It is now %s.</body></htm…

Solving Linear equations with constraint in Python

I have a system of linear equations with some constraints. I would appreciate it if someone could help me solving this system of equations in Python.

systemd service keep giving me error when start or get status

I have a python application and I need it to be run as a service, I tried many methods and I was advised to make it as systemd service I searched and tried some code here is my unit code [Unit] Descrip…

Python 3.5: Print Canvas Text

Could anyone share with me how to print the text of the text widget added to a Canvas object? In the code below, I want the system return the value of "hello" when mouse on the text, however…

What is the most efficient way to match keys from a dictionary to data in text file

Say I have the following dictionary:data=[a 1 : A, b 2 : B, c 3 : C, d 4 : D]and a .txt file which reads:Key a 1 b 2 c 3 d 4 Word as box cow dig(note values are seperated by \t TAB char…

Converting an excel file to a specific Json in python using openpyxl library

I have the Excel data with the format shown in the image preview. How can I convert it into a JSON using Python? Expected Output: file_name = [ { A: Measurement( time=10, X1=1, X2=4 ), B: Measurement(…