filtering

How to filtering pandas dataframe by multiple columns

How to filtering pandas dataframe by multiple columns Question: I would like to get values from column n where values in subset of other columns is True. Example, the data frame: t, f = True, False data = [ [t, f, f, ‘1’], [f, f, f, ‘2’], [f, t, f, ‘3’], [f, f, t, ‘4’] …

Total answers: 3

Find youngest member of a list of people

Find youngest member of a list of people Question: I’m learning Python right now and I have a problem with finding the youngest one in my list. class ember : def __init__(self,name,age,sex,weight,): self.name = str(name) self.age = int(age) self.sex = str(sex) self.weight = int(weight) e1=ember("Pisti1", 13, "Ferfi", 45) e2=ember("Pisti2", 14, "Ferfi", 46) e3=ember("Pisti3", 15, "Ferfi", …

Total answers: 2

How to filter emails based on received date using microsoft graph api with python

How to filter emails based on received date using microsoft graph api with python Question: I’m working on a python script to retrieve emails based on receiveddatetime. When i run my script i get the error below. Below is my whole script. import msal import json import requests def get_access_token(): tenantID = ‘yyy’ authority = …

Total answers: 1

Exclude/Filter values from dataframe with function .isin() in Pandas

Exclude/Filter values from dataframe with function .isin() in Pandas Question: I’m working on a Pandas dataframe with transactional data (customer purchases) and want to exclude rows with certain customer numbers contained in a column ‘CUSTOMER_ID’. To achieve this, I created a list with the customer numbers to be exluded: excluded_customers = [‘2000’, ‘2100’, ‘3100’, ‘4000’, …

Total answers: 1

How to get values outside an interval pandas DataFrame

How to get values outside an interval pandas DataFrame Question: I’m trying to get the values outside an interval in pandas dataframe, and I was trying to avoid iterating over the rows. is there any way to do that? This is what I was trying, but it gives the error ValueError: The truth value of …

Total answers: 3

Comparing all contents of two files

Comparing all contents of two files Question: I am trying to compare two files. One file has a list of stores. The other list has the same list of stores, except it is missing a few from a filter I had run against it from another script. I would like to compare these two files, …

Total answers: 2

Filtering a dataframe on dynamic columns and values Python Pandas?

Filtering a dataframe on dynamic columns and values Python Pandas? Question: The goal is to filter a DataFrame on a dynamic number of columns with their respective individual values. To achieve this, I’ve created a filter mask from a dictionary which I should be able to use each time. However this filter mask becomes a …

Total answers: 1

Filter view based on the users Group

Filter view based on the users Group Question: I am trying to filter the query further to only show records where the Groups matches the logged in users group. I am new to Python and not sure how to add an additional filter into the below view. View @login_required(login_url=’login’) def home(request): q= request.GET.get(‘q’) if request.GET.get(‘q’) …

Total answers: 1