import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns from pandas_profiling import ProfileReport from sklearn import datasets from mpl_toolkits.mplot3d import Axes3D from sklearn.decomposition import PCA from sklearn.preprocessing import StandardScaler data=pd.read_csv('H:/analysis_results/mean_HN.csv') columns=['folder', 'volume', 'convex_volume', 'surface_area','length','max_width', 'max_depth'] data.head() values=data.iloc[:,1:7] correlation=values.corr() fig,ax=plt.subplots(figsize=(12,10)) sns.heatmap(correlation,annot=True,annot_kws={'size':16},cmap='Reds',square=True,ax=ax) sns.pairplot(data,hue='folder') plt.show()出现报错`import pandas_profiling` is going to be deprecated by April 1st. Please use `import ydata_profiling` instead. from pandas_profiling import ProfileReport,如何修改
时间: 2023-12-31 11:04:17 浏览: 134
你可以修改为以下代码来使用ydata_profiling:
```python
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from ydata_profiling import ProfileReport
from sklearn import datasets
from mpl_toolkits.mplot3d import Axes3D
from sklearn.decomposition import PCA
from sklearn.preprocessing import StandardScaler
data=pd.read_csv('H:/analysis_results/mean_HN.csv')
columns=['folder', 'volume', 'convex_volume', 'surface_area','length','max_width', 'max_depth']
data.head()
values=data.iloc[:,1:7]
correlation=values.corr()
fig,ax=plt.subplots(figsize=(12,10))
sns.heatmap(correlation,annot=True,annot_kws={'size':16},cmap='Reds',square=True,ax=ax)
sns.pairplot(data,hue='folder')
profile = ProfileReport(data, title='Pandas Profiling Report', html={'style':{'full_width':True}})
profile.to_notebook_iframe()
plt.show()
```
这里使用 `ydata_profiling` 替代 `pandas_profiling`,并且在最后添加了Pandas Profiling报告的代码。
阅读全文