I have two columns in a Pandas df that I would like to operate on. First, I would like to remove non-numeric values such as "High" from the column "score" and cast the remaining values as int (all data was input as strings). Next I would like to sum "score" based on unique "measure_id". How can I perform these two functions?
The df is:
nationwide_measures = pd.read_sql_query("""select state,
measure_id,
measure_name,
score
from timely_and_effective_care___hospital;""", conn)
My failed attempt is:
nationwide_measures1 = nationwide_measures.to_numeric(nationwide_measures{:,'score'}, errors='coerce')