2024-05-16 00:21:47 发布
网友
我有一个包含85列和大约10000行的数据帧。 第一列是Shrt_Desc,最后一列是Refuse_Pct 我想要的新数据帧必须有Shrt_Desc,然后去掉一些列,然后在序列Fiber_TD_(g)到Refuse_Pct 我使用:
Shrt_Desc
Refuse_Pct
Fiber_TD_(g)
dfi_3 = food_info.loc[:, ['Shrt_Desc', 'Fiber_TD_(g)':'Refuse_Pct']]
但是它给出了一个语法错误。 有什么想法我该怎么做? 谢谢您。在
借用this answer的主要思想:
pd.concat([food_info['Shrt_Desc'], food_info.ix[:, 'Fiber_TD_(g)':]], axis=1)
借用this answer的主要思想:
相关问题 更多 >
编程相关推荐