# -*- coding: utf-8 -*-
"""
Created on Sun Jun 9 16:48:04 2019
@author: User
"""
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
salary=pd.read_csv(u'data\\ch5\salary.csv',encoding = "gbk")
plt.hist(salary['salary'],10,density=True,histtype='step',cumulative=True)
plt.xlabel('current salary')
plt.ylabel('frequency')
plt.title('salary of US enterpriceses')
plt.show()
运行:
salary['salary'].plot.hist(bins=10,density=True,histtype='step',cumulative=True)
plt.xlabel('current salary')
plt.ylabel('frequency')
plt.title('salary of U.S. enterpriceses By pandas')
运行: