ydata-profiling icon indicating copy to clipboard operation
ydata-profiling copied to clipboard

Is there are chance to export the figures as `csv`?

Open sbrugman opened this issue 2 years ago • 1 comments

Discussed in https://github.com/ydataai/pandas-profiling/discussions/984

Originally posted by Anselmoo May 18, 2022 Dear community,

thx for help?

I am wondering if there is a chance to export figure-reports like a variable, correlation, or missing_variables as csv for rendering in other packages like seaborn or plotly?

Thx

sbrugman avatar May 18 '22 14:05 sbrugman

@sbrugman concerning the issue, the self.summarizer contains the values for the plots.

https://github.com/ydataai/pandas-profiling/blob/188e02b2db156cd1cec3555ae33a983035f43b67/src/pandas_profiling/profile_report.py#L158-L168

I am wondering if it makes sense also to export figures as a dictionary, too? This will allow usingpandas-profiling fully internally like:

import numpy as np
import pandas as pd
from pandas_profiling import ProfileReport

df = pd.DataFrame(np.random.rand(100, 5), columns=["a", "b", "c", "d", "e"])
profile = ProfileReport(df, title="Pandas Profiling Report")
dict_plot = profile.to_dict_plot()

# Here dict_plot via key for direct plotting
import plotly.express as px
fig = px.bar(dict_plot["missing_rows"], x="a", y="b", color="smoker", barmode="group")
fig.show()

Consequently, avoid unnecessary tmp-data.

Anselmoo avatar May 19 '22 10:05 Anselmoo