DA

来自Jack's Lab
(版本间的差异)
跳转到: 导航, 搜索
(探索数据分布)
(bar)
第37行: 第37行:
 
cn = pd.read_csv("../DA/data/ncp-cn-new.csv", index_col='Date', parse_dates=True, skipinitialspace=True)
 
cn = pd.read_csv("../DA/data/ncp-cn-new.csv", index_col='Date', parse_dates=True, skipinitialspace=True)
 
xhb = cn-hb
 
xhb = cn-hb
 
 
plt.gca().xaxis.set_major_formatter(mdate.DateFormatter('%m-%d'))
 
plt.gca().xaxis.set_major_formatter(mdate.DateFormatter('%m-%d'))
 +
#plt.bar(hb.index, hb['Confirmed'].values)
 +
plt.bar(xhb.index, xhb['Confirmed'].values)
 +
plt.show()
 +
</source>
  
plt.bar(hb.index, hb['Confirmed'].values)
+
同时显示湖北和非湖北柱状图:
plt.bar(xhb.index, xhb['Confirmed'].values)
+
  
 +
<source lang=python>
 +
plt.bar(hb.index, hb['Confirmed'].values, align='edge', width=-0.4)
 +
plt.bar(xhb.index, xhb_cf, align='edge', width=0.4)
 
plt.show()
 
plt.show()
 
</source>
 
</source>

2020年2月16日 (日) 20:07的版本

目录

1 Overview


2 描述性统计


3 探索数据分布

3.1 bar

import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.dates as mdate

hb = pd.read_csv("../DA/data/ncp-hb-new.csv", index_col='Date', parse_dates=True, skipinitialspace=True)
cn = pd.read_csv("../DA/data/ncp-cn-new.csv", index_col='Date', parse_dates=True, skipinitialspace=True)
xhb = cn-hb
plt.gca().xaxis.set_major_formatter(mdate.DateFormatter('%m-%d'))
#plt.bar(hb.index, hb['Confirmed'].values)
plt.bar(xhb.index, xhb['Confirmed'].values)
plt.show()

同时显示湖北和非湖北柱状图:

plt.bar(hb.index, hb['Confirmed'].values, align='edge', width=-0.4)
plt.bar(xhb.index, xhb_cf, align='edge', width=0.4)
plt.show()


4 时序数据分析


5 Reference





个人工具
名字空间

变换
操作
导航
工具箱