我想用超过8万行替换csv列但是我不能用以下代码来替换它:
import pandas as pd
import numpy as np
df = pd.read_csv('nameofdf.csv')
df
nameofdf.csv有: enter image description here
我想用字符串替换数字,所以:
new_df = df.replace([0, 1, 2, 3, 4, up to 8 hundred thousand], ['string1', 'string2', 'string3', 'string4', 'string5', up to string8hundred thousand])
new_df
之后,jupyter显示出了syntaxis错误,我认为这是因为大型列表......
对此有何看法或如何正确更换csv?
谢谢!