for i in df_1.columns[11:]:
new_file = df_water[i]
c_file = pd.concat([date_file, new_file], axis=1)
for file in name_file:
file_path = os.path.join(save_directory, file)
c_file.to_csv(file_path)
The first for statement is a syntax that extracts data in a specific column order and merges it with date data
The second for statement was created for the purpose of generating (writing) the data frames generated by the first with a different name to the csv file.
If you do this, the csv file will be created as many files as you specified, but the contents of the file will be the same.
Is there any way to create a data frame that is combined with concat using a repetition statement and create (write) a csv file in the order of names in the pre-specified list?
python csv
for i, file in zip(df_1.columns[11:], name_file):
new_file = df_water[i]
c_file = pd.concat([date_file, new_file], axis=1)
file_path = os.path.join(save_directory, file)
c_file.to_csv(file_path)
I think this is what they want.
Ward..2
© 2024 OneMinuteCode. All rights reserved.