1
上的數據幀的產率輸出否則res = ans.groupby(['Unique_Inventor_Number_x', 'AppYearStr_x']).Citation.nunique()
的最接近的值作爲填充一個數據幀的空單元與前述細胞
Unique_Inventor_Number_x AppYearStr_x
2.0 1987.0 1
5.0 1977.0 1
6.0 1977.0 1
1987.0 1
1993.0 4
7.0 1990.0 1
1994.0 10
1996.0 6
1998.0 6
1999.0 4
9.0 1979.0 1
如所看到的,而不是在所有Unique_Inventor_Number_x
細胞被填充。我想填充所有這些細胞與前述整數這樣的:
Unique_Inventor_Number_x AppYearStr_x
2.0 1987.0 1
5.0 1977.0 1
6.0 1977.0 1
6.0 1987.0 1
6.0 1993.0 4
7.0 1990.0 1
7.0 1994.0 10
7.0 1996.0 6
7.0 1998.0 6
7.0 1999.0 4
9.0 1979.0 1
什麼是快捷方式大熊貓做到這一點?
你試過df.fillna(method ='ffill')? – Vaishali