这看起来很奇怪。
有一个数据框(df_ceremonies):
Year Ceremony_Date
0 1927/28 May 16, 1929
1 1928/29 April 3, 1930
2 1929/30 November 5, 1930
3 1930/31 November 10, 1931
4 1931/32 November 18, 1932
5 1932/33 March 16, 1934
6 1934 February 27, 1935
7 1935 March 5, 1936
这是第二个df:
Year Ceremony Award Winner Name Film
0 1927/1928 1 Actor NaN Richard Barthelmess The Noose
1 1927/1928 1 Actor 1.0 Emil Jannings The Last Command
2 1927/1928 1 Actress NaN Louise Dresser A Ship Comes In
3 1927/1928 1 Actress 1.0 Janet Gaynor 7th Heaven
4 1927/1928 1 Actress NaN Gloria Swanson Sadie Thompson
这是命令&结果。注意这些年份直到1934年才加入,因此跳过1927/1928等。它们都是对象数据类型。为什么这样?
df_revised = pd.merge(df, df_ceremonies, on='Year')
Year Ceremony Award Winner Name Film Ceremony_Date
0 1934 7 Actor 1.0 Clark Gable It Happened One Night February 27, 1935
1 1934 7 Actor NaN Frank Morgan The Affairs of Cellini February 27, 1935
2 1934 7 Actor NaN William Powell The Thin Man February 27, 1935
3 1934 7 Actress 1.0 Claudette Colbert It Happened One Night February 27, 1935
4 1934 7 Actress NaN Bette Davis Of Human Bondage February 27, 1935