I am trying to merge two pandas df:
Final_data
sp_return date dj_return
0 0.000000 1927 0.306237
1 0.394938 1928 0.512283
2 -0.124227 1929 -0.176560
3 -0.235981 1930 -0.292411
4 -0.416280 1931 -0.478050
5 -0.054336 1932 -0.142564
6 0.454805 1933 0.654280
7 -0.073477 1934 0.025883
8 0.372718 1935 0.345200
9 0.260973 1936 0.230361
10 -0.402949 1937 -0.346893
And the following:
date president_name party
0 1921 Warren G. Harding R
1 1922 Warren G. Harding R
2 1923 Calvin Coolidge R
3 1924 Calvin Coolidge R
4 1925 Calvin Coolidge R
5 1926 Calvin Coolidge R
6 1927 Calvin Coolidge R
7 1928 Calvin Coolidge R
8 1929 Herbert Hoover R
9 1930 Herbert Hoover R
10 1931 Herbert Hoover R
11 1932 Herbert Hoover R
Using the following code:
final_data1 = presidents.merge(final_data, on='date')
However, what I get at the end is an empty "final_data1" df. Do you have any suggestions why this might happen?
Please, advise me this issue.
dates. (Seepresidents.info()andfinal_data.info()for the dtypes). If one says "object" and the other "int", that would explain the problem. (If the values are strings, the dtype is reported as "object".)