Context: I'm trying to build a seaborn heatmap in order to map the following type of data (in a dataframe):
(This can be up to 50 fruits and 5500 stores)
My problem (I think) is that seaborn appears to want to use ascii but my data is in utf-8. When I read the csv file, I can't do the following:
df = pd.read_csv('data.csv', encoding = 'ascii')
without getting the following error:
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe9 in position 3: ordinal not in range(128)
When I bring it in using utf-8, it will read and I can reshape it to heatmap-friendly form but then when trying to run:
sns.heatmap(df2)
I get a similar UnicodeDecodeError
I do have simple special characters (colons, backspaces, etc.) in either my store or fruit fields so I'm wondering what the best approach is here.
- Should I run something on my dataframe to remove the utf-8 character then encode in ascii?
- Should I be doing something to my source .csv file to remove the utf-8 characters?
- Can I run seaborn another way to let is accept the encoding I have?
If anybody has a preferred method, can they help me with the proper code to get it done?
Python version 2.7.12 :: Anaconda 4.1.1 (64-bit) Pandas (0.18.1) Seaborn (0.7.1)