chris1610 / pbpython

Code, Notebooks and Examples from Practical Business Python
https://pbpython.com
BSD 3-Clause "New" or "Revised" License
1.99k stars 987 forks source link

ValueError: Cannot describe a DataFrame without columns #2

Closed scheung38 closed 7 years ago

scheung38 commented 7 years ago

Code is located in code/script.py

and

data in directory as per your example But upon running I get


from flask import Flask
import pandas as pd
import numpy as np
import glob

all_data = pd.DataFrame()

for f in glob.glob("../data/sales*.xlsx"):
    df = pd.read_excel(f)
    all_data = all_data.append(df, ignore_index=True)

all_data.describe()
raise ValueError("Cannot describe a DataFrame without columns")
ValueError: Cannot describe a DataFrame without columns
chris1610 commented 7 years ago

If you try read just one file and looking at the data, does it work correctly? I suspect the process is not finding your files and you have an empty dataframe.

ahlusar1989 commented 7 years ago

@chris1610 @scheung38 I tried to replicate this with one file and with more than one. I am not running into the error. @scheung38 Are you initializing a new dataframe object?