About using pandas to modify CSV data and save the modified data

I found that the pandas module of python has a function inplace=False to save the modified csv data
import pandas as pd
import numpy as np
data1 = pd.read_csv('data.csv', encoding='utf-8')
data1
data1.drop (["Radius_mean","texture_mean"],axis=1,inplace=True)#Delete the entire column named handsome and smart
#Note that this place inplace=False means that the original data has been deleted and modified, and the original data has been overwritten Data, the current data data1 is the data after deleting two columns
data1.to_csv('data11.csv', encoding='utf-8_sig')# Then save the data to the current folder

Guess you like

Origin blog.csdn.net/ChangHongYin/article/details/109142514