# 8.34:  .replace() method, or .loc[] assignment.  Returning to the 'precip' column, replace the
# non-numeric value we identified previously with 0.  Use vectorized condition as in previous, or
# the Series .replace() method.

import pandas as pd

df = pd.read_csv('../weather_newyork_narrow.csv')


df = df.replace('T', 0)

# alt. solution (instead of above) using .loc[]
# df.loc[ df.precip == 'T', 'precip' ] = 0

print(df.precip.unique())

# once the value has been replaced,
# uncomment to try the comparison again
# hitemps = df.loc[ (df.high > 90) & (df.precip > 0.5) ]


# After replacing the value, run .unique() to see that the anomalous value is no longer there.
# 
# Then you may uncomment the .loc[] to see that it still doesn't work.  Any idea why?  We'll come
# back to this.

