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

All Questions

Tagged with
0 votes
2 answers
65 views

How to Iterate Over a Dictionary of DataFrames Based on String Values

I have an Excel file with three sheets, each sharing the same structure but containing different data. Initially, I successfully wrote 'success' in all rows of the 'Dummy' column where the STUDENT ...
machukovich's user avatar
0 votes
1 answer
69 views

How to left blank/fill up a column with zeros depending on a string value of a cell?

I am manipulating an excel file with three different sheets: Ideally, the Dummy column has to be filled up with zeros by default, except for when the student's name is either 'Roberto' or 'Leonardo', ...
machukovich's user avatar
-2 votes
1 answer
53 views

Conditional Concatenation for Exchange Contact Imports

*CSV contains fake information Python on Kaggle w/ Pandas + Numpy Context: Goal is to import/update Exchange contacts. Users want to search for parent email by their student(s). Input (see CSV ...
outlookContactImporter's user avatar
1 vote
2 answers
83 views

IF Nested IF Pandas

I will insert and fill columns "Mark" info dataframe with IF statement, but in row Duration(Mins) = "10.0" the result is None, dtypes columns Duration(Mins) is float64, thanks for ...
Bihaqi Al Rafik's user avatar
-2 votes
1 answer
34 views

Value in Dataframe unintentionally fulfilling If-Statement

I am trying to trouble shoot why this may be happening. I am trying to go through my dataframe while skipping incomplete data. On my Dataframe the column with "Median Income" either has a ...
Amaranth_Gray'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
1 vote
2 answers
58 views

Lookup value in dataframe based on condition

I have a main dataframe and three smaller dataframes. Ultimately, I want to create a new column in the main dataframe that indicates whether each row meets two conditions. The value in column A of ...
be84's user avatar
  • 51
0 votes
1 answer
69 views

How to calculate cumulative distance based on conditions with python

I would like to create a function to calculate cumulative distance between a series of points based on a single condition of turning angles of trajectories. I have this data frame: Angles X ...
kokovado00's user avatar
0 votes
1 answer
78 views

Checking only when it is .tolist()

I have to put a column in a list to be able to find matches. I am trying to create a table "mytable" that gets data from going through each row of another table "table_main" and if ...
Melika02's user avatar
0 votes
1 answer
74 views

calculation of a pandas dataframe based on its previous row of same column (please use numpy since dataset is huge)

x = {"INPUT" : ['A','B','B','B','B','B','A','B','B','C','B','B','C','B','B','A','B','C']} df = pd.DataFrame(x) df Condition for calculation of “OUTPUT” column condition(1)if INPUT value A ...
Krishnendu Dutta's user avatar
0 votes
2 answers
68 views

if statement comparing dates with in pandas

I have this dataframe (forec_pivot2): data = {'Month': ['2023-11','2023-12','2024-01','2024-02','2024-03','2024-04','2024-05','2024-06',], 'EU': [30, 40 , 29 , 25 , 27 , 27 , 37 , 29], 'Japan': [...
Guillermo Nieva Sánchez's user avatar
0 votes
1 answer
82 views

Why is my if-elif-else statement all outputting the same value?

example dataframe I am trying to evaluate a variety of conditions for the values in the testResp.keys_raw, location, and money columns of my .csv files. Depending on those conditions, I want to set ...
Annie Cooper's user avatar
-1 votes
1 answer
66 views

if function not returning result as expected [closed]

I'm trying to add a 'Yes' in respective column if a certain string is found in a subject column: i.e. if 'visual' is found in the entry of the column Description, it should return a 'Yes' in the '...
Rayily's user avatar
  • 3
0 votes
2 answers
164 views

How to get cell value by column name (different for every row) in DataFrame? [duplicate]

I have a DataFrame with several rows and columns, and for every row, would like to obtain the cell value where its column name corresponds to a certain value, given in the last column, which is ...
user22760872's user avatar
0 votes
2 answers
61 views

Creating new conditional column based on two columns [duplicate]

I want to create a new column (3rd column) in which I want to add 1 or 0 depending on following condition: If column 1 and column 2 have the same value, then enter 1 in the 3rd column If value doesn'...
Commerce Session's user avatar

15 30 50 per page
1
2 3 4 5
69