楼主: shengao
5089 3

pandas DatetimeIndex 问题 [推广有奖]

  • 0关注
  • 1粉丝

博士生

17%

还不是VIP/贵宾

-

威望
0
论坛币
8 个
通用积分
5.3501
学术水平
0 点
热心指数
0 点
信用等级
0 点
经验
2746 点
帖子
89
精华
0
在线时间
319 小时
注册时间
2009-5-4
最后登录
2025-3-18

楼主
shengao 在职认证  发表于 2016-7-29 09:33:51 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
我在用pandas的between_time方法时,总是报错误TypeError: Index must be DatetimeIndex,
代码如下:
  1. path = "C:\\Users\\dell\\Desktop\\Quant Trading\\sh10000460.csv"
  2. data = pd.read_csv(path, index_col= 'time')
  3. resampled = data[['buyPrice1', 'buyVolume1', 'sellPrice1', 'sellVolume1', 'volume']]
  4. resampled = resampled.between_time('9:30','14:58')#TODO 连续交易
复制代码
最后一行报错。列time 的数据是 9:30:02 这种格式的。

求达人,帮帮忙 谢谢
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

关键词:datetime pandas Index panda date Desktop Users dell

沙发
xebydjy 学生认证  发表于 2016-7-29 10:29:13
resampled.index = resampled.index.to_datetime()

藤椅
shengao 在职认证  发表于 2016-7-29 12:47:03
xebydjy 发表于 2016-7-29 10:29
resampled.index = resampled.index.to_datetime()
谢谢哈

板凳
lxy444 学生认证  发表于 2016-8-7 21:29:28
来学习一下

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2026-2-13 21:06