Skip to content

Commit 9b69a9d

Browse files
committed
tentative workaround for pandas 1.0.0 reindexing bug
1 parent 13ce49f commit 9b69a9d

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

rdtools/clearsky_temperature.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,13 @@ def get_clearsky_tamb(times, latitude, longitude, window_size=40,
103103
df = df.resample(freq_actual).interpolate(method='linear')
104104
df['month'] = df.index.month
105105

106+
# workaround for pandas #26683 reindexing bug in pandas 1.0.0
107+
tz = times.tz
108+
df.index = df.index.tz_convert('UTC').tz_localize(None)
109+
times = times.tz_convert('UTC').tz_localize(None)
106110
df = df.reindex(times, method='nearest')
111+
times = times.tz_localize('UTC').tz_convert(tz)
112+
df.index = df.index.tz_localize('UTC').tz_convert(tz)
107113

108114
utc_offsets = [y.utcoffset().total_seconds() / 3600.0 for y in df.index]
109115

0 commit comments

Comments
 (0)