标签: python pandas string dataframe types
我正在尝试进行文本预处理,但我发现 text 列中的一个数据包含 float。
text
float
i=0 while True: for each in list_df['text']: print(type(list_df['text'][i])) i+=1
如何将其更改为 str?
答案 0 :(得分:1)
假设 col_x 是您的列名,请尝试:
col_x
df['col_x'] = df['col_x'].astype(str)