Skip to content

Use map instead of applymap #330

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading