From 12801b523591b267ab62c813ab1a9cf8e1a5dd58 Mon Sep 17 00:00:00 2001 From: David Wilby <24752124+davidwilby@users.noreply.github.com> Date: Tue, 6 Feb 2024 16:19:31 +0000 Subject: [PATCH] use index_col to avoid mean error --- episodes/14-looping-data-sets.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/episodes/14-looping-data-sets.md b/episodes/14-looping-data-sets.md index ec19be367..476216d79 100644 --- a/episodes/14-looping-data-sets.md +++ b/episodes/14-looping-data-sets.md @@ -195,7 +195,7 @@ import pandas as pd import matplotlib.pyplot as plt fig, ax = plt.subplots(1,1) for filename in glob.glob('data/gapminder_gdp*.csv'): - dataframe = pd.read_csv(filename) + dataframe = pd.read_csv(filename, index_col="country") # extract from the filename, expected to be in the format 'data/gapminder_gdp_.csv'. # we will split the string using the split method and `_` as our separator, # retrieve the last string in the list that split returns (`.csv`),