Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

What is the best way to get the first five entries of a data frame?

Answer Posted / glibwaresoftsolutions

You can use the `.head()` method in pandas to get the first five rows of a DataFrame:
python
import pandas as pd
df = pd.DataFrame({'a': [1, 2, 3, 4, 5, 6]})
first_five = df.head(5)

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do you add in python?

893


What is python’s standard way of identifying a block of code?

891


How do you iterate over a list and pull element indices at the same time?

1093


Explain the use of try: except raise, and finally?

831


How do you get all values from a python dictionary?

886


Which is the default function in a class?

1010


How do you find the number of references pointing to a particular object?

1002


How do I run notepad ++ in python?

1033


How many items are in a list python?

959


Does python support interfaces like in java?

1191


Can you learn python with no experience?

1021


Define the support for apex that exists?

979


Is python object-oriented? What is object-oriented programming?

895


What is numpy in python?

991


What are the different uses of help() and dir() functions in python?

952