I have tried to use the mines and rocks data ( http://archive.ics.uci.edu/ml/datasets/connectionist+bench+(sonar,+mines+vs.+rocks) ) to do EDA. I have put the following code that can plot the density plot for each numeric column.
Is there a way to plot the same chart for each numeric variable in the data set but with two lines in each density plot based on if it is M or R (the last column). Therefore we can see which variable shows different distribution for the label M vs R.
import pandas as pd
# import file
file = 'https://archive.ics.uci.edu/ml/machine-learning-
databases/undocumented/connectionist-bench/sonar/sonar.all-data'
mr_df = pd.read_table(file, sep=',', header=None)
mr_df.plot(kind='density', subplots=True, layout=(8,8), sharex=False, legend=False, fontsize=1, figsize=(12,12))
plt.savefig('density plot.png')
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.