Data Visualization (2): Data Visualization
Source: https://www.dataquest.io/mission/132/data-visualization-and-exploration
Data Source https://github.com/fivethirtyeight/data/blob/master/college-majors/recent-grads.csv
This article describes how to easily explore the relationship between data.
Raw data presentation (this is a salary survey report for college graduates. The important fields include Major-Major name, Major_category-Major category, Sample_size-sample size, and ShareWomen-female proportion, total-Total number of professionals)
import pandas as pdrecent_grads = pd.read_csv('recent-grads.csv')
# Create a histogram recent_grads.hist ('mediance') for the Median of wage income ')
# The hist () function is automatically divided into 10 equal points by default, and the generated graph has gridlines. Now it is divided into 20 equal points, and the grid lines recent_grads.hist ('media ', bins = 20, grid = False)
# In fact, multiple histograms can be created at a time. The layout parameter means to divide two graphs into two rows and one column. If this parameter is not specified, by default, all graphs are placed in the same row columns = ['mediance', 'sample _ size'] recent_grads.hist (column = columns, layout = (), grid = False)
Import matplotlib. pyplot as plt # select two columns of Data sample_size = recent_grads [['sample _ size ', 'Major _ category '] # Calculate sample_size.boxplot (by = 'major _ category') by category of each Major type # rotate the coordinate text on the X axis 90 degrees and vertically display the plt. xticks (rotation = 90)
# Put the two scatter plots together (by color) and check whether there is any association with import matplotlib. pyplot as pltplt. scatter (recent_grads ['mpmployment _ rate'], recent_grads ['media'], color = 'red') plt. scatter (recent_grads ['mongowomen'], recent_grads ['media'], color = 'blue') plt. show ()