数组python split str(太多值无法解包)
df.timestamp[1]
Out[191]:
'2016-01-01 00:02:16'
#i need to slept these into to feature
split1,split2=df.timestamp.str.split(' ')
Out[192]:
ValueErrorTraceback (most recent call last)
<ipython-input-216-bbe8e968766f> in <module>()
----> 1 split1,split2=df.timestamp.str.split(' ')
ValueError: too many values to unpack
使用
str[index]
因为您要拆分序列,输出也将是一个序列,而不是pandas中的两个不同列表。在例如,
^{pr2}$str.split
将返回一个序列您错误地使用了
split()
方法。在鉴于此:
像这样使用
^{pr2}$split()
方法:相关问题 更多 >
编程相关推荐