作者yshihyu (yshihyu)
看板Python
标题[问题] pandas 栏位拷贝跟删除问题
时间Sun Jan 22 22:44:40 2017
我主要遇到问题是 pandas 表格 columns 栏位拷贝後会连同index数值也拷贝到columns
还有用类似字串切片方式 table index会变得不正确,
https://gist.github.com/anonymous/655f0a449970f5f01829d8fd79309a46
上面是我pandas 操作的问题描述, 因为在板上排版格式会跑掉也很乱所以放上面网址
https://gist.github.com/anonymous/581b16a5d07746cc39cd4e46ad0a950f
上面是我的程式码
谢谢
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 112.105.250.241
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/Python/M.1485096286.A.97F.html
1F:→ yjc1: 1. df2.columns.name = '' 01/23 01:19
2F:→ yjc1: 2. df2.drop(df2.index[0]); df2.index = range(len(df2)) 01/23 01:23
3F:→ yjc1: 不过总觉得你的要求有点怪… 01/23 01:24
4F:推 exthrash: reset_index? 01/23 06:40
5F:推 aweimeow: 我刚开始碰 pandas 也和你有相同的疑问 01/23 22:43
6F:→ aweimeow: 不过後来都是用 item iter 的方式就无关 index 的事情了 01/23 22:43
7F:→ yshihyu: item iter 的方式是指像下面网址用法嘛? 01/24 23:16