Python 数据框中的某些行不工作

Python 数据框中的某些行不工作,python,pandas,Python,Pandas,使用熊猫组合两列。在我的86869行数据中,以下代码适用于每一行,但不适用于5425行 import pandas as pd person_file = "person.csv" input_folder = '~/Input/' df =pd.read_csv(input_folder + person_file) df['uniqueid1']=df['geo'].astype(str) +""+ df['unique_id_in_geo'].astype(str) df.to_

使用熊猫组合两列。在我的86869行数据中,以下代码适用于每一行,但不适用于5425行

import pandas as pd
person_file = "person.csv"  
input_folder = '~/Input/' 
df =pd.read_csv(input_folder + person_file) 
df['uniqueid1']=df['geo'].astype(str) +""+ df['unique_id_in_geo'].astype(str) 
df.to_csv('~/combine.csv', index=False)
对于非工作行,我得到如下输出:

geo,unique_id_in_geo,uniqueid1
120530401011,1000,1205304010111000
120530401011,1001,1205304010111000
120530401011,1002,1205304010111000
120530401011,1003,1205304010111000
120530401011,1004,1205304010111000
geo,unique_id_in_geo,uniqueid_expected
120530401011,1000,1205304010111000
120530401011,1001,1205304010111001
120530401011,1002,1205304010111002
120530401011,1003,1205304010111003
120530401011,1004,1205304010111004
我预期的输出如下所示:

geo,unique_id_in_geo,uniqueid1
120530401011,1000,1205304010111000
120530401011,1001,1205304010111000
120530401011,1002,1205304010111000
120530401011,1003,1205304010111000
120530401011,1004,1205304010111000
geo,unique_id_in_geo,uniqueid_expected
120530401011,1000,1205304010111000
120530401011,1001,1205304010111001
120530401011,1002,1205304010111002
120530401011,1003,1205304010111003
120530401011,1004,1205304010111004

我做错什么了吗?(我目前正在添加一个最小的可复制示例)

删除引号:
df['uniqueid1']=df['geo'].astype(str)+df['unique_id_in_geo'].astype(str)
仍然得到相同的结果。使用:df['uniqueid1']=df['geo'].astype(str)+df['uniqueid\u in_geo'].astype(str)df['uniqueid]=df.apply(lambda row:row['geo'].astype(str)+row['unique id\u in_geo'].astype(str,axis=1)请发布
df.info()
的输出,我想我已经解决了。我在excel中看到了输出。excel中的长数字显示不正确。当我使用记事本查看CSV文件时,输出结果显示正确。删除引号:
df['uniqueid1']=df['geo'].astype(str)+df['unique_id_in_geo'].astype(str)
仍然得到相同的结果。使用:df['uniqueid1']=df['geo'].astype(str)+df['uniqueid\u in_geo'].astype(str)df['uniqueid]=df.apply(lambda row:row['geo'].astype(str)+row['unique id\u in_geo'].astype(str,axis=1)请发布
df.info()
的输出,我想我已经解决了。我在excel中看到了输出。excel中的长数字显示不正确。当我使用记事本查看CSV文件时,输出结果显示正确。