I've spent the last couple of days trying to merge two #pandas #dataframes using the same inner merge I've done in a previous project. No matter what I tried it wouldn't work and no one responded to my StackOverflow questions. Here's a video on some tips how to fix an empty dataframe when doing an inner merge of two dataframes.
Step 1: Check the datatypes of the column you're trying to join on. So if you're trying to merge df and df1 together and you're using PyCharm, do this: print(df.dtypes) and then print (df1.dtypes) and make sure they are of the same datatype. For example, object and object, int64 and int64, float64, etc.
If they are not the same, make them the same by using .astype(str) or int or float.
Step 2: If you're joining two dataframes on a string and they are both object datatypes, then check to make sure there are no trailing or leading spaces. For example, I had to add .rstrip() to the column I was joining to remove the trailing spaces.
Please like this video if it helped you.
Watch video How to Fix Empty DataFrame when Merging Two DataFrames | (Troubleshooting #6) online, duration hours minute second in high quality that is uploaded to the channel Brandon Jacobson 25 March 2022. Share the link to the video on social media so that your subscribers and friends will also watch this video. This video clip has been viewed 3,702 times and liked it 44 visitors.