Skip to content

Tag: pandas

Pandas: I want make a new column based on a series

What I want is just to add a column that copy the value of tmp with respect to serial number of c2 and map to c1. Expected result: The length of c1 sequence and c2 sequence are the same. Longer sequence for reproduct: Answer Use Series.map with DataFrame.drop_duplicates, because c2 has duplicates: Details: So…

How to find the index of certain lists in a list of lists?

I have 50 folders containing the same file name but different contents Data_220_beta_0.1_47.0_53.0ND.csv. I am skipping certain folders which is mentioned in list I. Now, when the code scans all the remaining folders, it looks for values which are different and X = [x for x in X if min(x) != max(x)] contains …

Add one day for certain time

I want to update my date column with certain times because some of the dates are not correct. For some reason, they key in the date with time between 00:00 and 7:30 with the day before. For example: Which supposes to be like this: I know I can update all of dates with this code. But I have no idea

Pandas multiple comparison on a single row

My source data looks like this: I need to compare Second column with Third, Fourth Column with Fifth Column, Sixth with Seventh. Column names can change. So I have to consider the column positions and my first column with always has column name as id. so if atleast one of comparisons (‘1_src1’ vs …