Skip to main content

All Questions

0 votes
1 answer
223 views

Iterate over specific column in dataframe with condition

I try to iterate over a specific column called Description of the dataframe RCMLocations. When the value of the column "Description" is equal to the value found in another dataframe called &...
Tessa's user avatar
  • 55
0 votes
2 answers
57 views

Pandas dataframe duplicates - Python

I have a simplified dataframe like this: ID RecordingType Date Value 1 FEVR 2019-05-22 18:37:10 1.36 1 FEVR 2019-05-22 18:41:12 1.35 1 FEVR 2019-...
mariant's user avatar
  • 131
0 votes
0 answers
113 views

How to choose value of x and y using pandas dataframe in Python based on condition?

I have a dataframe df: | a| b| c| | 4| 6| 8| | 2| 3| 1| My aim is to split the dataframe into x and y such that for every x I choose, whole dataframe columns are considered except one which can ...
Coder's user avatar
  • 85
0 votes
1 answer
40 views

DataFrame Pandas condition over a column

Dear fellows I´ve difficulties by performing a condition over a column in my DataFrame, i want to iterate over the column and extract only the values that starts with the number 6, the values from ...
Peter 1999's user avatar
1 vote
0 answers
42 views

update a value by running through every row in a data frame with conditions (another version of extension)

This is a further extension of my previous question update a value by running through every row in a data frame with conditions (extension) Working with the same data frame that has an added column: ...
monica's user avatar
  • 27
0 votes
1 answer
82 views

update a value by running through every row in a data frame with conditions (extension)

This is an extension to the question, 'update a value by running through every row in a data frame with conditions' update a value by running through every row in a data frame with conditions Working ...
monica's user avatar
  • 27
0 votes
1 answer
313 views

How can I iterate over a dataframe containing multiple conditions (using iterrows()) and flag columns based on these conditions using np.where?

I am trying to generate flags based on multiple conditions. I would like to do the following in a more iterable way: # sample dataframe data = [[1, 1980.0, 2000.0]] df = pd.DataFrame(data, columns=[&...
user's user avatar
  • 781
0 votes
2 answers
45 views

get prefix out a size range with different size formats

I have column in a df with a size range with different sizeformats. artikelkleurnummer size 6725 0161810ZWA B080 6726 0161810ZWA B085 6727 0161810ZWA B090 6728 ...
Ron Kieftenbeld's user avatar
0 votes
1 answer
616 views

Loop to create multiple lists, with different naming

I would like to create a loop that creates multiple lists, named differently. I have a dataframe that contains an excel file that I am trying to filter through depending on the month. (ideally the ...
Keyt Weyner's user avatar
-2 votes
1 answer
75 views

Filter and change data frame sum() and remove rows based on conditions

From data frame df need to receive data frame result, we need to iterate over df.id if there are more rows with same id and they are negative then we can sum() the quantity one by one, if the result ...
user avatar
1 vote
1 answer
41 views

How to find the next zero that follows a specified value and pull out its time stamp?

I have a df that looks something like this but longer: df = pd.DataFrame({ 'Time' : [1,2,7,10,15,16,77,98,999,1000,1121,1245,1373,1490,1555], 'ID' : ['1', '1', '1', '1', '1', '2', '2', '2', '...
Tahnee's user avatar
  • 77
1 vote
1 answer
190 views

Select columns based on last value in pandas dataframe

I have a dataframe below as an example. I want to iterate through each wag number and select only columns A or B based on its last value. For example if we look at wag == 1 then last value of A == 3 ...
Roman Lents's user avatar
1 vote
1 answer
1k views

How to apply multiple conditions to dataframe with loop

I have the following dataframe dict1 = {'x_math_lp': {'John':'0', 'Lisa': 1, 'Karyn': '2'}, 'o_math_lp': {'John': 0.005, 'Lisa': 0....
newbzzs's user avatar
  • 315
-1 votes
1 answer
30 views

How to combine lists(first three columns) to generate output shown in last column in python

List1 List2 List3 output MAN TH ESE MAN-TH-ESE PA MAN-TH-PA PWP TH ESE PWP-TH-ESE PA PWP-TH-PA PR ESE PWP-PR-ESE PA PWP-PR-PA MAD TH ESE MAD-TH-ESE PA MAD-TH-PA PR ESE MAD-PR-ESE PA MAD-PR-PA ETI TH ...
user6903964's user avatar
0 votes
1 answer
753 views

How to write for loop for iterating a DataFrame and subset it to include only those columns that are retrieved at each iteration?

The aim is to get a subset DataFrame such as with three columns after each iteration 'id', 'reference','sample 1' when sample 1 is 0 (do this for every sample) 'id', 'reference','sample 1' when sample ...
Aruna Saraswathy's user avatar

15 30 50 per page