Quantcast
Channel: Forums - Python
Viewing all articles
Browse latest Browse all 2485

Calculate new field based on values in another field

$
0
0
I have a large file (~2.5 million rows) that contains a field of dates and times. There are 60 different dates in this field in the form YYYYMMDDHHMM. I want to add a new field such that the earliest times = 1, the second earliest = 2, and so on up to 60.

I understand that I can use an "if-else" statement in the Code Block, but I don't want to write out 60 different if statements.

I was thinking some sort of while loop that references items in a list of unique date values, but i can't seem to get anything to work.

Does anybody have any ideas?

Thanks

Viewing all articles
Browse latest Browse all 2485

Trending Articles