Donate. I desperately need donations to survive due to my health

Get paid by answering surveys Click here

Click here to donate

Remote/Work from Home jobs

extra 'L' after converting dataframe to dictionary in python

I'm converting a dataframe to dictionary, but the values of one column get an undesired 'L' after the converting. So does anyone know why is it and is there any way to delete this 'L'

The dataframe looks like this enter image description here

I'm tring to use the first 6 columns as the key of the dict and the last column as the value, and here is what I did. df4=df3.set_index(['ROUTE_NAME','TX_MRKR_ID_FROM','TX_MRKR_OFFSET_FROM', 'TX_MRKR_ID_TO','TX_MRKR_OFFSET_TO','EFF_YEAR']) df4=df4.to_dict() However after the conversion all the values under EFF_YEAR get an additional 'L' and become 2016L, 2000L, and 2001L etc. dictionary created

I need to iterate through this dictionary and use the keys to find corresponding value in the next step, so could anyone teach me how to delete this undesired 'L'

Thanks a lot

Sincerely

Wilson

Comments