I have a large excel data with one sheet (.xlsx) such as the following:
Time | Flow |
---|---|
1 | 10 |
2 | 20 |
... | ... |
I need to extract every column as a variable to python and I need to use the corresponding heading of the column in excel as the variable name in python (e.g. in Time = [1,2,...]).
So far I get the values as following:
import numpy as np
import pandas as pd
from pandas import Series, DataFrame
directory = os.getcwd()
path = os.path.realpath("Data.xlsx")
data = pd.read_excel(path)
It automatically excludes the headings from the numbers. I can get the headings as objects as follows:
datanames = Series (data.columns,dtype='object')
which gives:
In [42]:datanames
Out[42]:
0 Time
1 Flow
.
.
.
but I'm not able to allocate the headings to each column.
I appreciate your support. Regards EMO