This is my TestWorkbook.xlsx in same location as my python script:
Data Time Variable Value
08/01/17 06:00:30 Occupancy.1m.15s.mean 497.714
08/01/17 06:00:30 QueueTime.1m.15s.mean 698.999
08/01/17 06:00:30 QueueStatus.1m.15s.mean 42.8639
08/01/17 06:00:30 QueueTime.1m.15s.mean 113.139
import pandas as pd
import numpy as np
import glob
all_data = pd.DataFrame()
res = glob.glob("*.xlsx")
for f in glob.glob("TestWorkbook.xlsx"):
df = pd.read_excel(f, sheetname='Sheet1')
all_data = all_data.append(df, ignore_index=True)
all_data.describe()
Not sure why it is returning error
raise ValueError("Cannot describe a DataFrame without columns")
ValueError: Cannot describe a DataFrame without columns
Comment From: jreback
pls show a reproducible example.
and this is completely non-performant, instead append the frames to a list then use pd.concat
.
you are merely seeing this (IOW, there is no data).
In [2]: pd.DataFrame().describe()
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-2-e81e6dc1b4a2> in <module>()
----> 1 pd.DataFrame().describe()
/Users/jreback/pandas/pandas/core/generic.py in describe(self, percentiles, include, exclude)
5496 raise NotImplementedError(msg)
5497 elif self.ndim == 2 and self.columns.size == 0:
-> 5498 raise ValueError("Cannot describe a DataFrame without columns")
5499
5500 if percentiles is not None:
ValueError: Cannot describe a DataFrame without columns
Comment From: scheung38
Hi @jreback I am just following the exact example from http://pbpython.com/excel-file-combine.html
Comment From: jreback
@scheung38 and? just because its on the web doesn't meet its a good example!
I would guess that you are simply not reading in any data (e.g. the glob doesn't return any files)