Skip to content

Commit

Permalink
Use map instead of applymap (#330)
Browse files Browse the repository at this point in the history
* Use map instead of applymap

* Update lectures/inflation_history.md

---------

Co-authored-by: mmcky <mamckay@gmail.com>
Co-authored-by: Matt McKay <mmcky@users.noreply.github.com>
  • Loading branch information
3 people authored Apr 3, 2024
1 parent 585a66f commit fa191ae
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lectures/inflation_history.md
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ def process_df(df):
df = df[~df.index.duplicated(keep='first')]
# Convert attribute values to numeric
df = df.applymap(lambda x: float(x) \
df = df.map(lambda x: float(x) \
if x != '—' else np.nan)
# Finally, we only focus on data between 1919 and 1925
Expand Down Expand Up @@ -367,7 +367,7 @@ for i in range(4):
# Apply process_entry on the selected sheet
sheet_list = [
pd.read_excel(xls, 'Table3.' + str(ind),
header=1).iloc[:row].applymap(process_entry)
header=1).iloc[:row].map(process_entry)
for ind, row in zip(indices, rows)]
sheet_list = [process_df(df) for df in sheet_list]
Expand Down

1 comment on commit fa191ae

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.