【发布时间】:2018-05-22 09:29:21
【问题描述】:
如何打印/返回特定值的索引?
movies_per_year = pd.DataFrame(movies_per_year)
movies_per_year.columns = ["count"]
print(movies_per_year)
count
year
1891 1
1893 1
1894 2
1895 2
1896 2
1898 5
在这里,我的索引是年份。我想返回 count 为 1 的所有索引。此外,movies_per_year.max() 返回 5。因此,它应该返回 1898。
【问题讨论】:
-
我一开始就试过了,对我没用。
标签: python python-3.x pandas dataframe