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 / nashiinformaticssolutions

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 I install pip?

867


Can we override a constructor?

884


What is a lambda form?

934


Convert a string representation of list to list.

799


What do you think is the output of the following code fragment?

862


What is == in python?

789


Is python is better than java?

880


What does tuple mean?

824


How do I watch a file for changes using python?

964


What are the list methods in python?

882


What are the advantages of python?

833


What is the difference between a tuple and a list?

995


What are the benefits of using python?

1019


Is nan in python pandas?

825


What tools that helps python development do you know?

863