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

Which is better r or python?

770


What does means by “call by reference” in python?

861


What is a for loop in python?

767


Is python a scripting or programming?

748


What is jinja python?

870


Are methods and constructors the same thing?

793


How to count the occurrences of a perticular element in the list?

906


Do sheeps sleep?

769


Which is better ruby or python?

746


Which website is best for learning python?

804


How do you upgrade pip?

790


What is python constructor?

804


How are instance variables different from class variables?

895


Is java or python more useful?

780


How for loop will works in python?

895