0

union's merge works fine, now I need to merge union and GDP so I have the union of 3 sets.

union = pd.merge(energy, ScimEn, how='outer', left_index=True, right_index=True)
allunion = pd.merge(GDP, union, how='outer', left_index=True, right_index=True)

allunion's merge returns :

File "pandas/_libs/join_helper.pxi", line 1063, in 
pandas._libs.join.outer_join_indexer_object
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 
18: ordinal not in range(128)

how can I fix this? Even if I combine them directly in one statement it does the same, I also set set_index of all Dataframes to be the same and merge inner worked before.

Deesha
  • 538
  • 8
  • 27
Rami.K
  • 189
  • 2
  • 11
  • Interesting. Are you able to print your three dataframes? – 9769953 Aug 13 '18 at 13:57
  • I guess this is a result of lazy evaluation. Some details on the error are at https://stackoverflow.com/questions/18649512/unicodedecodeerror-ascii-codec-cant-decode-byte-0xe2-in-position-13-ordinal – 9769953 Aug 13 '18 at 13:58
  • What version of Python and Pandas are you using? – 9769953 Aug 13 '18 at 13:58
  • please include sample data. Additionally it looks like your data is using special characters, is it on a language different than English? – Yuca Aug 13 '18 at 14:01
  • Please show how data frames *energy*, *GDP*, etc. are generated as they may run in different *encoding* (an available parameter in [`read_table/read_csv`](https://pandas.pydata.org/pandas-docs/stable/generated/pandas.read_table.html) calls). – Parfait Aug 13 '18 at 14:59

0 Answers0