How to split an excel file that contains 5000 columns into 5000 single files?
Question:
I have a database in form of .xlsx, which contains 5000 columns. My goal is to separate it into 5000 single files in order to train them for a neural network.
How I can do it in Python??
Answers:
There you go:
import pandas as pd
df = pd.read_excel('data.xlsx')
cols = df.columns
for col in cols:
df1 = df[col]
df1.to_excel(str(col) + '.xlsx', index = False)
I have a database in form of .xlsx, which contains 5000 columns. My goal is to separate it into 5000 single files in order to train them for a neural network.
How I can do it in Python??
There you go:
import pandas as pd
df = pd.read_excel('data.xlsx')
cols = df.columns
for col in cols:
df1 = df[col]
df1.to_excel(str(col) + '.xlsx', index = False)