查看DA的源代码
←
DA
跳转到:
导航
,
搜索
因为以下原因,你没有权限编辑本页:
您刚才请求的操作只有这个用户组中的用户才能使用:
用户
您可以查看并复制此页面的源代码:
=== 柱状图 (bar) === 每天统计事件 A 发生的次数,其实已经做了单个窗口是 24 小时、bins 持续自然增长的频数运算。这类数据直接用柱状图 (bar) 显示一下即可: <source lang=python> 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() </source> 同时显示湖北和非湖北柱状图: <source lang=python> plt.bar(xhb.index, xhb_cf, align='edge', width=0.3, label='Outside Hubei') plt.bar(hb.index, hb['Confirmed'].values, align='edge', width=-0.4, label='Hubei') plt.legend() plt.gcf().autofmt_xdate() plt.show() </source> * [https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.plot.kde.html Pandas KDE] * [https://matplotlib.org/tutorials/introductory/lifecycle.html#sphx-glr-tutorials-introductory-lifecycle-py X 轴 label 格式] * [https://matplotlib.org/gallery/statistics/histogram_cumulative.html?highlight=cdf Using histograms to plot a cumulative distribution] <br>
返回到
DA
。
个人工具
登录
名字空间
页面
讨论
变换
查看
阅读
查看源代码
查看历史
操作
搜索
导航
首页
社区专页
新闻动态
最近更改
随机页面
帮助
工具箱
链入页面
相关更改
特殊页面