Skip to content

Commit

Permalink
use index_col to avoid mean error
Browse files Browse the repository at this point in the history
  • Loading branch information
davidwilby authored Feb 6, 2024
1 parent 2408c73 commit 12801b5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion episodes/14-looping-data-sets.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <region> from the filename, expected to be in the format 'data/gapminder_gdp_<region>.csv'.
# we will split the string using the split method and `_` as our separator,
# retrieve the last string in the list that split returns (`<region>.csv`),
Expand Down

0 comments on commit 12801b5

Please sign in to comment.