Linked Questions
10 questions linked to/from selecting across multiple columns with pandas
44
votes
2
answers
62k
views
Boolean indexing on multiple pandas columns [duplicate]
despite there being at least two good tutorials on how to index a DataFrame in Python's pandas library, I still can't work out an elegant way of SELECTing on more than one column.
>>> d = pd....
2
votes
5
answers
17k
views
Pandas: filter on multiple columns [duplicate]
I am working in Pandas, and I want to apply multiple filters to a data frame across multiple fields.
I am working with another, more complex data frame, but I am simplifying the contex for this ...
0
votes
1
answer
227
views
Drop rows where meet criteria of column values [duplicate]
I have a dataframe named df
a b
0 str1 0
1 str2 .8
2 str3 .4
3 str4 .1
I am iterating through this dataframe. (which i know is not the most efficient way).
I want to drop ...
0
votes
0
answers
81
views
Pandas 'isin' : Retrieving rows except a list of column indexes [duplicate]
I want to retrieve rows which are not the indexes of a list of columns.
Below is a df :
I'm trying to extract rows of 'text' columns which are not state, gender. I tried the below to retrieve rows ...
0
votes
2
answers
5k
views
Python conditional filtering in csv file
Please help! I have tried different things/packages writing a program that takes in 4 inputs and returns the writing score statistics of a group based on those combination of inputs from a csv file. ...
3
votes
1
answer
3k
views
How to apply single condition to a list of columns in a dataframe and add value to 4th column without using multiple OR's
I need to apply a single condition to 3 columns of a dataframe and change value of 4th without using or statement .
I can do with np.where but if the no of columns is big it's going to take a lot ...
1
vote
2
answers
3k
views
Filtering a DataFrame based on multiple column criteria
How would I filter a dataframe using 'and' ? In other words, if I have a dataframe named m and it has columns a,b,c,d,e, how would i return all rows where the values in column b are greater than 120 ...
1
vote
1
answer
1k
views
Python Pandas: What causes slowdown in different column selection methods?
After seeing this question about replicating SQL select-statement-like behavior in Pandas, I added this answer showing two ways that could shorten the verbose syntax given in the accepted answer to ...
3
votes
2
answers
2k
views
pandas: iterative filtering a DataFrame's rows
Suppose I have a DataFrame like so,
df = pd.DataFrame([['x', 1, 2], ['x', 1, 3], ['y', 2, 2]],
columns=['a', 'b', 'c'])
To select all rows where c == 2 and a == 'x', I could do ...
2
votes
1
answer
566
views
Pandas - Selecting over multiple columns
NB: A question similar to this has been asked before but it doesn't exactly answer my question.
How do I subset a pandas dataframe, with many columns, based on certain large number of columns ...