9951 explained code solutions for 126 technologies


python-pandasGet first 10 rows (head) 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.head(10)ctrl + c
import pandas as pd

load Pandas module

pd.DataFrame

creates Pandas DataFrame object

.head(

returns first given amount of rows

(10)

return first 10 rows

rows

will contain selected rows