【发布时间】:2015-03-09 00:25:09
【问题描述】:
dictionary = {'Year': [1985, 1985, 1986, 1986, 1987, 1987, 1987]}
pdf = pd.DataFrame(dictionary)
Year
0 1985
1 1985
2 1986
3 1986
4 1987
5 1987
6 1987
我有一个名为 pdf 的数据框,我需要按以下格式形成一个 new data frame:
Year count
1985 2
1986 2
1987 3
如何在 pandas 中有效地做到这一点?
【问题讨论】:
标签: python python-2.7 pandas