在对csv文件中的某些内容进行替换的时候,可以使用replace()
例如:
import os
import pandas as pd
csv_file = pd.read_csv('xxx.csv')
csv_file.replace('old_data','new_data',inplace=True)
csv_file.to_csv('xxx.csv')
在对csv文件中的某些内容进行替换的时候,可以使用replace()
例如:
import os
import pandas as pd
csv_file = pd.read_csv('xxx.csv')
csv_file.replace('old_data','new_data',inplace=True)
csv_file.to_csv('xxx.csv')