DataFrame.tail
DataFrame.tail(n=5)
返回最后n行。
对于n的负值,此函数返回除前n行之外的所有行。
Example
import pandas as pddf = pd.DataFrame({'site':['google', 'baidu', 'wiki', 'pandas'],'age':[18, 39, 22, 45],'price': [1.0, 2.0, 3.0, 4.0],'color': ['red', 'black', None, 'red']})df.tail(3)--------------------------------------------------------site age price color1 baidu 39 2.0 black2 wiki 22 3.0 None3 pandas 45 4.0 red
Example
import pandas as pddf = pd.DataFrame({'site':['google', 'baidu', 'wiki', 'pandas'],'age':[18, 39, 22, 45],'price': [1.0, 2.0, 3.0, 4.0],'color': ['red', 'black', None, 'red']})df.tail(-3)------------------------------------------------------site age price color3 pandas 45 4.0 red
