Skip to content

Commit

Permalink
Fixed timezone issue in filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
saeedamen committed Jun 27, 2018
1 parent c4845b8 commit d819ff7
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions findatapy/timeseries/filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,9 +294,13 @@ def filter_time_series_by_date_offset(self, start_date, finish_date, data_frame,
DataFrame
"""

if data_frame.index.tz is not None:
start_date = start_date.replace(tzinfo=data_frame.index.tz)
finish_date = finish_date.replace(tzinfo=data_frame.index.tz)
if hasattr(data_frame.index, 'tz'):
if data_frame.index.tz is None:
start_date = start_date.replace(tzinfo=data_frame.index.tz)
finish_date = finish_date.replace(tzinfo=data_frame.index.tz)

if 'int' in str(data_frame.index.dtype):
return data_frame

try:
data_frame = self.filter_time_series_aux(start_date, finish_date, data_frame, offset)
Expand Down

0 comments on commit d819ff7

Please sign in to comment.