首页 > 代码库 > Data Visualizations 2

Data Visualizations 2

1.Histogram :

A histogram is a graph that enables you to visualize the distribution of values of a column.

Example: 

  import matplotlib.pyplot as plt

  columns = [‘Median‘,‘Sample_size‘]
  recent_grads.hist(column=columns)# to visulize the column "Median" and "Sample_size" and present them into two different charts.

2. The box plot: another way to represent a set of data. 

  sample_size = recent_grads[[‘Sample_size‘, ‘Major_category‘]] #sample_size is a filtered DataFrame which only contain two columns "Sample_size" and "Major_category"

  sample_size.boxplot(by=‘Major_category‘)# In the filtered DataFrame. We are going to categorize the data by using column "Major_category"

  plt.xticks(rotation=90)

SeaBorn:

1. Compare to Matplotlib, SeaBorn can create more compelling chart which is in a better style.

 

Data Visualizations 2