Last active
November 23, 2023 06:41
-
-
Save sandiprb/8ed48310ff7f7472b33471b57c4f4eb2 to your computer and use it in GitHub Desktop.
Conver Django qs Pandas dataframe to non timezone column
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.utils.timezone import pytz | |
def formatted_date(naive_date): | |
aware_date = naive_date.astimezone(pytz.timezone(settings.TIME_ZONE)) | |
return aware_date.strftime("%d-%m-%Y, %H:%M:%S") | |
df['date'] = df['date'].apply(formatted_date) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment