I'm using pandas.read_rsq_query() method to convert my SQL query shown below to a dataframe.
This is the query:
SELECT begin_ts, process_name, avg(count) FROM ecn_stats_2019_06_21 WHERE process_name LIKE 'matching_%_gw' and name = 'raw_msg_count' and begin_ts = '2019-06-21 12:55:00' GROUP BY begin_ts, process_name ORDER BY begin_ts, process_name;
When I run the SQL query in my terminal I get the output below:
begin_ts | process_name | avg
------------------------+----------------+----------------------
2019-06-21 12:55:00-04 | matching_01_gw | 252722.250000000000
2019-06-21 12:55:00-04 | matching_02_gw | 233463.000000000000
2019-06-21 12:55:00-04 | matching_03_gw | 287673.666666666667
2019-06-21 12:55:00-04 | matching_04_gw | 201417.000000000000
2019-06-21 12:55:00-04 | matching_05_gw | 243640.500000000000
2019-06-21 12:55:00-04 | matching_06_gw | 235529.333333333333
2019-06-21 12:55:00-04 | matching_07_gw | 203518.666666666667
2019-06-21 12:55:00-04 | matching_08_gw | 266112.666666666667
2019-06-21 12:55:00-04 | matching_09_gw | 1066127.000000000000
2019-06-21 12:55:00-04 | matching_10_gw | 734972.000000000000
2019-06-21 12:55:00-04 | matching_11_gw | 237903.000000000000
2019-06-21 12:55:00-04 | matching_12_gw | 238116.000000000000
(12 rows)
But the resulting dataframe looks like this:
begin_ts process_name avg
0 2019-06-21 16:55:00+00:00 matching_01_gw 2.527222e+05
1 2019-06-21 16:55:00+00:00 matching_02_gw 2.334630e+05
2 2019-06-21 16:55:00+00:00 matching_03_gw 2.876737e+05
3 2019-06-21 16:55:00+00:00 matching_04_gw 2.014170e+05
4 2019-06-21 16:55:00+00:00 matching_05_gw 2.436405e+05
5 2019-06-21 16:55:00+00:00 matching_06_gw 2.355293e+05
6 2019-06-21 16:55:00+00:00 matching_07_gw 2.035187e+05
7 2019-06-21 16:55:00+00:00 matching_08_gw 2.661127e+05
8 2019-06-21 16:55:00+00:00 matching_09_gw 1.066127e+06
9 2019-06-21 16:55:00+00:00 matching_10_gw 7.349720e+05
10 2019-06-21 16:55:00+00:00 matching_11_gw 2.379030e+05
11 2019-06-21 16:55:00+00:00 matching_12_gw 2.381160e+05
When I print the self.endTime variable from the SQL query I get
self.endTime: 2019-06-21 12:55:00
How can I stop the dataframe from converting my datetime object to UTC? I tried removing the '-04' from the end of the datetime object as reflected above, but no luck.
Edit: Using df['begin_ts'] = df['begin_ts'].dt.tz_convert('US/Eastern') solved my problem
Follow Up Question:
How can I tell the dataframe to not use scientific notation?