How Do I Keep the Timezone of My Index When Serializing/Deserializing a Pandas DataFrame Using JSON
Fleeting- Référence externe : https://stackoverflow.com/questions/41493423/how-do-i-keep-the-timezone-of-my-index-when-serializing-deserializing-a-pandas-d
Pandas will convert everything to UTC when using to_json
So when you load the json, localize it to UTC. There’s no way to know what tz was used beforehand though:
In [4]: df2 = pd.read_json(’test_data_01.json’) df2.index = df2.index.tz_localize(‘UTC’)