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
37 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
160 views
0 votes
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
227 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
1,263 views
0 votes
1 answer
+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 530 views
0 votes
0 answers
+4 votes
6 answers
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
10,543 views
+1 vote
1 answer

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
22,690 views