Skip to content

Commit

Permalink
resolve FutureWarning: Setting an item of incompatible dtype is depre…
Browse files Browse the repository at this point in the history
…cated
  • Loading branch information
bl-young committed Feb 16, 2024
1 parent f538990 commit c41189a
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions stewi/DMR.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"""

import pandas as pd
import numpy as np
import argparse
import urllib
import time
Expand Down Expand Up @@ -192,10 +193,10 @@ def standardize_df(input_df):
dmr_flows = flows[['FlowName', 'FlowID']
].drop_duplicates(subset=['FlowName'])
output_df = output_df.merge(dmr_flows, on='FlowName', how='left')
output_df.loc[output_df.FlowID_x.isin(
flows.PARAMETER_CODE), ['FlowID']] = output_df['FlowID_x']
output_df.loc[~output_df.FlowID_x.isin(
flows.PARAMETER_CODE), ['FlowID']] = output_df['FlowID_y']
output_df['FlowID'] = np.where(
output_df.FlowID_x.isin(flows.PARAMETER_CODE),
output_df['FlowID_x'],
output_df['FlowID_y'])
output_df = output_df.drop(columns=['FlowID_x', 'FlowID_y'])

return output_df
Expand Down

0 comments on commit c41189a

Please sign in to comment.