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

What is the use of repr function in python?

821


How do you break in python?

831


What is the best free website to learn python?

874


Can you explain how python is interpreted.

975


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

907


How can I represent an 'enum' in python?

986


What is sockets? Explain.

936


Explain split() and join() function.

864


What is the enumerate() function in python?

1043


What’s the difference between a list and a dictionary?

902


What happens with the following function definition?

957


What is python's parameter passing mechanism?

924


How will you remove an object from a list?

883


Is python faster than matlab?

876


What are disadvantages of python?

908