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

What does isnull mean in python?

868


What is superclass and subclass in python?

958


What is used to create unicode strings in Python?

902


What should be the typical build environment for python based application development?

959


How to get indices of n maximum values in a numpy array?

847


How do you sort in python 3?

826


What is abnormal termination?

793


Can a beginner learn python?

864


What is an egg in python?

842


What is python identifiers?

890


Mention at least 3-4 benefits of using python over the other scripting languages such as javascript.

888


What is pandas?

841


What is the different between range () and xrange () functions in python?

944


Name some commonly used built-in modules in python?

852


How to split a string into a list?

1103