Python重新索引不适用于我的代码

时间:2019-06-17 21:08:11

标签: python reindex

我正在尝试在数据帧Current_tape中使用重新索引功能为变量'New Account'重新索引。但是,在使用重新索引功能后,我看到naan(无值)

Current_tape2 = Current_tape.reindex(columns=['New Account'])
Current_tape2['New Account'] = Current_tape2['New Account'].astype(str)

输出

    New Account 
0   NaN nan
1   NaN nan
2   NaN nan
3   NaN nan
4   NaN nan
Current_tape2 = Current_tape.reindex(columns=['New Account'])
Current_tape2['New Account2'] = Current_tape2['New Account'].astype(str)
expected result          
New Account             
0   r1                  
1   r2                      
2   r3  
3   r4  
4   r5

0 个答案:

没有答案