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
134 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
283 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 5, 2019 in Python by Esha
641 views
0 votes
1 answer

Python Pandas Dataframe: set_value is deprecated and will be removed in a future release

The set_value function is deprecated and you will ...READ MORE

answered Apr 8, 2019 in Python by Jai
6,957 views
+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 6, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 1,370 views
0 votes
0 answers
+4 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,800 points
1,013 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,520 points
21,601 views
+1 vote
2 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
76,042 views