草庐IT

yearofbirth

全部标签

java - 这段Java代码有没有错误?

classCreature{privateintyearOfBirth=10;publicvoidsetYearOfBirth(intyear){yearOfBirth=year;}voidsetYearOfBirth(Creatureother){yearOfBirth=other.yearOfBirth;//isthiscorrectitcompilesfine}intgetYearOfBirth(){returnyearOfBirth;}publicstaticvoidmain(Stringargs[]){Creaturec=newCreature();c.setYearOfBi

python - Pandas +群

数据集包含4列,其中name是child的名字,yearofbirth表示child出生的年份,number表示以该特定名字命名的婴儿的数量。Forexample,entry1reads,intheyear1880,7065girlchildrenwerenamedMary.通过pandas,我试图找出每年哪个名字是最常用的。我的代码df.groupby(['yearofbirth']).agg({'number':'max'}).reset_index()以上代码部分回答了手头的问题。我想要名称和最大数量。 最佳答案 基于this