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

All Questions

-1 votes
4 answers
62 views

removing values in pandas according to condition

In pandas dataframe I want to remove the row with duplicate employee id but accoridng to the condition where the salary is null my original data is EEID Name gender salary 0 EMP01 ayushi ...
vasu's user avatar
  • 1
-2 votes
1 answer
70 views

How to set values in a dataframe column that depends if another column value is bigger than a dict/lookup table

I have a dataset with date and id columns, and I want to set a third column 'Status' where if the date is before the value in the dict/lookup table, then 'On', 'Off' if on or after the date. For ...
yungkenny's user avatar
2 votes
1 answer
38 views

NVL join using pandas

I want to perform a NVL join with pandas, e.g. in SQL: select * from TA join TB on TA.column = NVL(TB.column, TA.column) Here is a complete example in SQL, showing what would be expected: /* first ...
Carmellose's user avatar
  • 5,011
1 vote
1 answer
53 views

Python : 2 (or more) conditional strings in a groupby agg

Here is my issue : In my Pandas dataframe "Dataset", I would like to get the following result : when the column "Product" has the value "Ref_01" at least once, I want to ...
R_User_001's user avatar
1 vote
0 answers
39 views

Python: duplicated row with condition in dataframe

we have this dataframe: ID Dest Change RL1 Z32 Yes RL1 Z32 No RL1 Z33 Yes RL1 Z33 Yes RL2 Z32 Yes And I need to identify that "Dest" Z32 is duplicated with the condition of having &...
DANIEL GARCIA DE CACERES HERRA's user avatar
0 votes
1 answer
63 views

Selecting extreme temperature values from pandas dataframe column where selection process includes several complicating conditions

Have weather data set that includes daily high temperature in Celsius in a pandas dataframe that is as simple as the date and daily high temperature (rounded to the tenth value). Here is a sample data ...
MC Hammerabi's user avatar
0 votes
1 answer
55 views

How to merge two dataframes on an interval?

I have two dataframes, mp and sp. mp contains state route (int), ~1/10 milepost (float) marks, latitude (float), longitude (float). route milepost lon lat 2091 2 ...
J. Sizzler's user avatar
0 votes
1 answer
35 views

Python merge/join/concat with boolean condition

I would translate this SQL code (see below) in python code. I think I can use pandas.merge/join but I don't know how define the boolean condition. create table gg as select b.*, a.value from table b ...
Pex82's user avatar
  • 1
0 votes
1 answer
42 views

Merge pandas dataframes on duplicate keys with certain conditions on other columns

As the title suggests, I want to combine two Pandas datasets where both has duplicate keys but also considering a certain condition on other columns (in this case the date columns). I have these two ...
rayyar's user avatar
  • 109
0 votes
1 answer
87 views

pandas fillna based on condition from another dataframe

Table 1 ID Condition Access1 Access2 1 aa nan nan 2 aa nan nan 3 bb nan nan 4 bb nan nan 5 aa nan nan 6 bb nan nan 7 aa nan nan Table 2 Name Condition Accessor1 Accessor2 John aa Yes No ...
user23638854's user avatar
1 vote
4 answers
92 views

Python pandas - Adding a list to a dataframe cell if multiple conditions are met

I have been trying to add lists to cells in a dataframe. Simplified the dataframe looks something like this: Participant Session Column_C 1 1 2 1 3 1 3 2 4 1 4 2 Most participants only have ...
Tuur's user avatar
  • 13
0 votes
0 answers
61 views

Conditional Statement between two dataframes

I've scoured the forums here in search of an answer. I am trying to fill a column of df2 based on a condition in df1 and only if df1 and df2 code matches, then fill in df2 column X with df1 column X. ...
Drex's user avatar
  • 1
1 vote
1 answer
73 views

How to get the greatest of the dates comparing two columns with NaN values

1.I have a DF where the date should always be greater than date and pur_date.
arawind73's user avatar
0 votes
0 answers
47 views

adding a second conditional statement to an 'if' statement based on the value in a different dataframe column

I currently have the following conditional: if not tops_subset.eq(row.iloc[2:4]).all(axis=1).any(): For some background, it is from this code block: tops_df = pd.read_csv('tops.csv', header=None) ...
Tendekai Muchenje's user avatar
0 votes
1 answer
376 views

Python pandas, filter our data with isin and other conditions

I have tried to use below codes to filter out records from a dataframe, for data is either with item codes 04901 or 04940 and Year is in 2022. However, this is not work property, it only return nil ...
Bobzy3721's user avatar

15 30 50 per page
1
2 3 4 5
78