Skip to main content
The 2024 Developer Survey results are live! See the results

All Questions

Tagged with
-1 votes
2 answers
56 views

Pandas alignment error during elementwise comparison [duplicate]

When checking element-wise equality of multiple columns of a dataframe against a single column, pandas raises a ValueError: Operands are not aligned. Do 'left, right = left.align(right, axis=1, copy=...
silence_of_the_lambdas's user avatar
0 votes
1 answer
38 views

Compare multiple columns in the dataframe and return column names with different values in a new column

Consider this df: data = [{'name': 'Muhammad', 'age_x': 20, 'city_x': 'Karachi', 'age_y': 20, 'city_y': 'Karachi'}, {'name': 'Ali', 'age_x': 19, 'city_x': 'Lahore', 'age_y': 30, 'city_y': None}...
nzskra's user avatar
  • 171
1 vote
1 answer
54 views

Compare two dataframes based on more than 1 column and deliver the change

So consider I have two dataframes: Old information: Name Id Club Number 0 Ronaldo 12414 Al-Nassr 7 1 Messi 4344134 Miami 30 2 Shevchenko 1234435 Milan 7 3 ...
nzskra's user avatar
  • 171
0 votes
1 answer
39 views

Python take data from two different dataframes, create a new dataframe and structure the data as collected from the other two

I'm very new to python and struck in an issue solving. # First Dataframe df1 = pd.DataFrame({ 'name': ['Adam','Ashley','Adam','Don',], 'items': ['Apple','Banana','Cherry','Date'], '...
Kush's user avatar
  • 13
2 votes
1 answer
42 views

How to group by and find new or disappearing items

I am trying to assess in a sales database whether the # of advertisements has changed. The example dataframe I am using is as such: df = pd.DataFrame({"offer-id": [1,1,2,2,3,4,5], "date&...
fußballball's user avatar
3 votes
2 answers
72 views

Comparison and indexing series of arrays with length > 1

Title sounds more complicated than the facts really are. Given the data data = [ np.array(['x'], dtype='object'), np.array(['y'], dtype='object'), np.array(['z'], dtype='object'), np....
MaxPowers's user avatar
  • 5,447
0 votes
2 answers
123 views

Pandas to Compare two dataframes row wise with indexed columns

I have a Two CSVs with same column names, i want to get row-wise difference to write it in a CSV file path. I have also indexed the "ID" column in both the files/Dataframes. Sample ...
Ridhi's user avatar
  • 41
1 vote
1 answer
33 views

Using 'gt' with two multindex datframes

I asked a question recently and Timeless replied with a fascinating bit of code that did what its supposed to do. Basicaly, Im working with a multiindex timeseries df from yahoo finance, using level 0 ...
AndysPythonStuff's user avatar
0 votes
1 answer
37 views

comparing 2 dataframes with different shape

I have some observed data for specific dates. Information of year, day, and month are in 3 different columns. and there are different measurements for moisture, temperature, and ... in other columns. ...
Zahra's user avatar
  • 3
0 votes
0 answers
26 views

Is it possible to combine dataframes from two separate programs?

Possibly a stupid question, but I'm very new. I have two separate large-ish (a couple million rows) csvs I'm trying to compare using dataframe functionality and I'm currently working on cleaning them ...
r0ck's user avatar
  • 1
0 votes
2 answers
47 views

Comparing pandas data frame columns and giving the same score to identical columns

Consider a pandas data frame containing 24 rows. I need to compare all columns and for columns who are identical give the same score. For example, if column A is identical to column C and F, then they ...
anna lordian's user avatar
-1 votes
1 answer
41 views

Compare adjacent column of a dataframe where arraysize is not equal

import pandas as pd import numpy as np df =pd.DataFrame({ 'ID1': \['1', '2', '2', '3','4','4', '5', '6', '6', '6', '7'\], 'ID2':\['a', 'a','b', 'a', 'a', 'b', 'a','a', 'b','c','a'\], 'AMT1':\['1',...
Priyanka Kumari's user avatar
0 votes
1 answer
107 views

Sum of columns over threshold in pandas

I'm trying to sum a bunch of columns in pandas and check whether that sum is over 100 or not. I already have the sum part sorted, what I'm trying to find is a way to compare each value of the sum to a ...
David Siret Marqués's user avatar
0 votes
1 answer
213 views

Compare two columns in two dataframes which has comma separated values

I have a dataframe df1 Id Items AQ a,b,c AT z,x,y AY k,l,m I have another df2 Id Items AQ b,c a AT z,y,x AY k,l,m,n I want to compare items columns of both dfs. Simply comparing gives false ...
Ann Alexis's user avatar
1 vote
2 answers
396 views

Python: How to compare values in columns in the same row and in the next row?

I have the following dataframe: Column A Column B Column C LONDON MADRID LONDON LONDON MADRID LONDON LONDON MADRID LONDON LONDON MADRID MADRID LONDON ...
just_learning's user avatar

15 30 50 per page
1
2 3 4 5
13