Python 当数组作为新的数据帧行添加时,奇怪的强制转换为浮动

Python 当数组作为新的数据帧行添加时,奇怪的强制转换为浮动,python,pandas,dataframe,Python,Pandas,Dataframe,我在初始化数据帧时观察到奇怪的类型转换: df = pd.DataFrame(columns = ['day', 'switch_ip', 'mac', 'type']) df.mac = test_data.mac.astype('uint64') df.info() for mac in range(5): df.loc[len(df)] = ['file_name', 'switch_ip', mac, 0] df.info() 我的mac列将自己的类型更改为浮动。为什么?这

我在初始化数据帧时观察到奇怪的类型转换:

df = pd.DataFrame(columns = ['day', 'switch_ip', 'mac', 'type'])
df.mac = test_data.mac.astype('uint64')
df.info()

for mac in range(5):
    df.loc[len(df)] = ['file_name', 'switch_ip', mac, 0]

df.info()

我的mac列将自己的类型更改为浮动。为什么?这对我来说很关键,我无法理解哪里错了…

如果该列中有
NA
值,则不能将其保存为
int
并转换为
float
,但我这里没有任何NA…?如果该列中有
NA
值,它不能保存为
int
并转换为
float
,但我这里没有任何NA。。。?