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 in Python by Firoz
27 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 by Sakra

Related Questions In Python

+2 votes
6 answers

Slicing in Python

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

answered Oct 18, 2018 in Python by abc
140 views
0 votes
1 answer

Pandas dataframe with multiple lists in Python

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

answered Apr 5 in Python by Esha
197 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 in Python by Neha
• 330 points

edited Jul 8 by Kalgi 399 views
+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
9,118 views
0 votes
1 answer