How to add rows with identical items in different columns in Pandas together

I have a sample dataframe that looks like below. I’d like to eventually group row 1 and row 3 together, since they contain identical items in different columns. x y count a,b b,a 5 a,c …

Converting list to comma separated integers to be substituted in IN clause of Pandas dataframe query

I have a list of integers that contains EMPI_ID emp_list = [1,2] I have a variable that defines the SQL query emp_sql = ”’ select emp_id , emp_name from emp where emp in (%s) ”’ Columns …

pandas: Match data by months and days

How can I match data only by months and dates and not by year: 1. Data 2. Desired output

How can I make a: for i in range work with a float [closed]

So I was working on this project but I ran stuck (again), I have a excel file with 344 columns and he should check if a cell has a certain and if it has then it should continue and print a word. If it …

Aggregate data with two conditions

I have a data frame that looks something like this: df = date name val1 val2 ———————————– 14:55:00 name1 1 2 14:55:00 name1 2 4 15:…

Python Rank with non numeric columns

I’m trying to find a way to do nested ranking (row number) in python that is equivalent to the following in TSQL: I have a table thank looks like this: data = { ‘col1’:[11,11,11,22,22,33,33], ‘…

How to find churned customers on a monthly basis? Python Pandas

I have a large customer dataset, it has things like Customer ID, Service ID, Product, etc. So the two ways we can measure churn are at a Customer-ID level, if the entire customer leaves and at a …

How can I get unique values from csv?

I have a small question. How can I print all the texts belonging to that author by selecting the author from the csv that I read with the pandas below, can you help with the python code? (ex. I want …

Splitting columns and reformat date using pandas

I have an object, slist that I need to split, reformat the date, and export as a tab delimited file. For the splitting I think I’m tripping up understanding the first row? Here is slist: I’ve tried …

Drop data frames with condition contains (os.path.exists)

Trying to drop rows with path that doesn’t exist… data_docs = pd.read_csv(‘Documents_data.csv’) data_docs.drop(data_docs[os.path.exists(str(data_docs[‘file path’]))].index, inplace=True) Error: …