9951 explained code solutions for 126 technologies


python-pandasGet last N rows (tail) from data frame


import pandas as pd

data = pd.DataFrame({
  'Phone': ['ip5', 'ip6', 'ip8', 'sms', 'xi'],
  'Phone Price': [204, 304, 404, 405, 305]
})

rows = data.tail(3)ctrl + c
import pandas as pd

load Pandas module

pd.DataFrame

creates Pandas DataFrame object

.tail(

returns last given amount of rows

(3)

return last 3 rows

rows

will contain selected rows