I have an excel spreadsheet with raw data in: demo-data:
1 | 2 | 3 |
4 | 5 | 6 |
7 | 8 | 9 |
How do I combine all the numbers to one series, so I can start doing math on it. They are all just numbers of the same "kind"
Given your dataframe as df
, this function may help df.values.flatten()
.
You can convert your dataframe to a list and iterate through it to extract and put values into a 1D list:
df = pd.read_excel("data.xls")
lst = df.to_numpy().tolist()
result = []
for row in lst:
for item in row:
result.append(item)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.