From fa191ae54a64da3fbbb189b92a1b3c19cfa37368 Mon Sep 17 00:00:00 2001 From: kp992 <145801876+kp992@users.noreply.github.com> Date: Wed, 3 Apr 2024 09:53:32 +0530 Subject: [PATCH] Use map instead of applymap (#330) * Use map instead of applymap * Update lectures/inflation_history.md --------- Co-authored-by: mmcky Co-authored-by: Matt McKay --- lectures/inflation_history.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lectures/inflation_history.md b/lectures/inflation_history.md index e4d813d3..5f840b4a 100644 --- a/lectures/inflation_history.md +++ b/lectures/inflation_history.md @@ -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 @@ -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]