Skip to content

Commit fa191ae

Browse files
kp992mmcky
andauthored
Use map instead of applymap (#330)
* Use map instead of applymap * Update lectures/inflation_history.md --------- Co-authored-by: mmcky <[email protected]> Co-authored-by: Matt McKay <[email protected]>
1 parent 585a66f commit fa191ae

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lectures/inflation_history.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ def process_df(df):
259259
df = df[~df.index.duplicated(keep='first')]
260260
261261
# Convert attribute values to numeric
262-
df = df.applymap(lambda x: float(x) \
262+
df = df.map(lambda x: float(x) \
263263
if x != '—' else np.nan)
264264
265265
# Finally, we only focus on data between 1919 and 1925
@@ -367,7 +367,7 @@ for i in range(4):
367367
# Apply process_entry on the selected sheet
368368
sheet_list = [
369369
pd.read_excel(xls, 'Table3.' + str(ind),
370-
header=1).iloc[:row].applymap(process_entry)
370+
header=1).iloc[:row].map(process_entry)
371371
for ind, row in zip(indices, rows)]
372372
373373
sheet_list = [process_df(df) for df in sheet_list]

0 commit comments

Comments
 (0)