Closed ghost closed 2 years ago
sums = [] counts = [] for fn in filenames: #filenames variable does not exist df = pd.read_csv(fn) by_origin = df.groupby('Origin') total = by_origin.DepDelay.sum() count = by_origin.DepDelay.count() sums.append(total) counts.append(count) total_delays = sum(sums) n_flights = sum(counts) mean = total_delays / n_flights
Thanks for raising an issue @gurvinder-yadav. filenames is defined here
filenames
Are you sure you ran all the notebook cells in order?
Closing due to inactivity.
sums = [] counts = [] for fn in filenames: #filenames variable does not exist df = pd.read_csv(fn) by_origin = df.groupby('Origin') total = by_origin.DepDelay.sum() count = by_origin.DepDelay.count() sums.append(total) counts.append(count) total_delays = sum(sums) n_flights = sum(counts) mean = total_delays / n_flights