I'm trying to call a field and getting an error.
Calling any field in this table gets the same error.
df_ret = pd.read_csv('Retention Data.csv', na_values=['.'])
print(df_ret["Cohorts Retention Rate"])
This is what my data looks like:

This is the error I get:
KeyError: 'Cohorts Retention Rate'
Using:
2.7.13 |Anaconda, Inc.| (default, Sep 21 2017, 17:38:20)
[GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)]
There appears to be whitespace in your column names. You can remove whitespace as follows:
df_ret.columns = df_ret.columns.str.strip()
You can then access the series as expected:
print(df_ret['Cohorts Retention Rate'])
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With