Matt123
Matt123

Reputation: 411

Pandas joining on index is producing all NaN for right-side DataFrame

I am trying to join two pandas DataFrames on index. The both have the same number of rows and everything about the index appears to be correct. However, when I run the code,

df1=df2.join(df3)

iIt produces all NaN for df3's values. I have been searching google for a while now and have no idea why.

I have tried casting into pandas data frames and also reset_index. Neither did the trick.

df1=df2.join(df3)

producing all NaN for df3's columns

In the expected results the NaN's would all have the values of df3. The actual results are producing all NaN.

Upvotes: 0

Views: 221

Answers (1)

Matt123
Matt123

Reputation: 411

My answer to this was to change the index types on both my dataframes. In my particular instance I converted to string. Thanks!

Upvotes: 1

Related Questions