python - 熊猫日期未显示在情节上
问题描述
我的数据框来自 cvs,如下所示:
Date Open High Low Close Adj Close Volume
0 1996-01-01 4.06250 4.12500 3.8750 3.90625 3.093209 7048800
1 1996-02-01 3.84375 3.96875 3.5000 3.62500 2.870497 12864000
2 1996-03-01 3.50000 4.25000 3.5000 4.12500 3.266428 9526400
3 1996-04-01 4.06250 4.68750 4.0625 4.50000 3.563378 5693600
4 1996-05-01 4.40625 4.65625 4.1250 4.21875 3.340666 30480000
当我尝试绘制它时,图表底部没有日期。这是我正在使用的代码:
df = pd.read_csv('ABC.csv') #read cvs
df2 = df.loc[0:12] #select rows
df2.set_index('Date', inplace=True) #set Date as index
df2['Close'].plot() #plot
解决方案
推荐阅读
- ios - iOS 开发 - 包括 iPhone 4s 是强制性的吗?
- java - 微服务 - 将每个子服务保存在单独的 git 存储库中还是使用单个 git 存储库?
- python - 用户与 django 的交互
- python - 基于另一个数据帧配对更新一个值
- java - 如何使用 Java 11 HttpClient 发布字符串数组?
- rxjs - 在 ConcatMap 中使用延迟,Observable 只发出一次
- java - MongoDB 默认过滤器
- asp.net - Automapper 缺少类型映射配置或不支持的映射错误
- asp.net - 跨分区查询是必需的,但已禁用
- django - 对象在 Django Rest Framework 中没有属性