Skip to content

Tag: pandas

Apply if else condition in specific pandas column by location

I am trying to apply a condition to a pandas column by location and am not quite sure how. Here is some sample data: The first line works to subtract 1 in the correct locations, however, the remaining cells become NaN. The second line of code does not work – the error is: Answer Instead of selected the first …

how can I find a date with incorrect Syntax and fix it

I am new to python. I have a dataset I converted it to dataframe. all my dates are objects now. I need to convert them into dates in order to find the age of patients. My dimensions are 3400×14 long. there are date values inside which have incorrect syntax. I cannot find them. is there a way to find them…