Rachid
Rachid

Reputation: 115

Unable to perform pd.merge

I have 2 csv's I want to perform outer join based on index (index is a combination of 2 columns)

frame1=pd.read_csv("Gamesa_G114 (Carlos Almeida)1.csv",index_col=['Dispositivo','Fecha'],sep=',',dtype='str')
frame2=pd.read_csv("Gamesa_G114 (Carlos Almeida).csv",index_col=['Dispositivo','Fecha'],sep=',',dtype='str')

Snapshot of both the frames enter image description here

Now I am performing outer join

frame=pd.merge(left=frame1,right=frame2,left_index=True,right_index=True,how='outer',suffixes=('_left', '_right'))

But it gives an error

TypeError: unorderable types: str() > float()

For stacktrace of error http://pastebin.com/eWYfnMRT

Why it is saying TypeError: unorderable types: str() > float() if I have already specified dtype='str' while reading csv

I have performed merge various times but never I have encountered this problem of type error.

Post edit Frame info enter image description here

Upvotes: 0

Views: 132

Answers (1)

sid
sid

Reputation: 107

This may be not a solution to your answer but a comment on dtype

You need to pass a dictionary in dtype E.g. {‘a’: np.float64, ‘b’: np.int32} instead of the String.

I am using answer space to write this because i don't have enough permission to comment.

Upvotes: 0

Related Questions