这是我的代码:
import pandas as pd
import numpy as np
data = {'ID': [1,2,3,4,5,6,7,8,9],
'Doc':['Order','Order','Inv','Order','Order','Shp','Order', 'Order','Inv'],
'Rep':[101,101,101,102,102,102,103,103,103]}
df = pd.DataFrame(data)
#df['concat']= (df['ID'].convert_dtypes(convert_string = True) + "1").convert_dtypes(convert_integer = True)
df['concat']= (df['ID'].astype(str) + "1").convert_dtypes(convert_integer = True)
print(df['concat'].dtype)
输出:
string
为什么不是以及如何获得它?df['concat']Int64
翻翻过去那场雪
相关分类