使用Python对Excel表格的变量名进行更换
Excel表格原始变量名
varlist = ['x', 'y', 'Speed','Temp']
更换为
varnames = ['V1', 'V2', 'V3', 'V4']
程序为:
## Load training data
df = pd.read_csv('test.csv')
## Variable substitution
df_train = df_train[varlist]
df_train.columns = varnames
共有 0 条评论