DataFrame slicing in Python

0 votes
How to extract a set of columns and rows from a large dataframe into a smaller dataframe. In this, I know the column headings, but the row numbers are not known, but I know the specific row contents to extract?
Jul 15, 2019 in Python by Firoz
832 views

1 answer to this question.

0 votes

You can use criteria based subset for example.

df[df.year == 2001]

In the above statement, it will subset the data where the year column has value 2001.

answered Jul 15, 2019 by Sakra

Related Questions In Python

+2 votes
6 answers

Slicing in Python

Index: ------------> ...READ MORE

answered Oct 18, 2018 in Python by abc
1,843 views
–1 vote
1 answer
0 votes
1 answer

Pandas dataframe with multiple lists in Python

You can do it like this import pandas ...READ MORE

answered Apr 6, 2019 in Python by Esha
1,984 views
+1 vote
3 answers

How to change/update cell value in Python Pandas dataframe?

You can use the at() method to ...READ MORE

answered Apr 8, 2019 in Python by Kunal
147,690 views
0 votes
2 answers
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 7, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 4,604 views
0 votes
1 answer
+5 votes
6 answers

Lowercase in Python

You can simply the built-in function in ...READ MORE

answered Apr 11, 2018 in Python by hemant
• 5,790 points
4,336 views
0 votes
1 answer

How to convert a Pandas GroupBy object to DataFrame in Python

g1 here is a DataFrame. It has a hierarchical index, ...READ MORE

answered Nov 12, 2018 in Python by Nymeria
• 3,560 points
34,558 views
+1 vote
1 answer

How to find index of element in dataframe Python ?

First, use the dataframe to match the ...READ MORE

answered Apr 8, 2019 in Python by Esha
282,728 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP