Skip to content

Commit aa5fc55

Browse files
authored
Broken examples due to pandas v3.0.0 (#2664)
* .resample('m') -> .resample('ME') Broken on pandas v3.0.0 v2.1 docs https://pandas.pydata.org/pandas-docs/version/2.1/user_guide/timeseries.html#dateoffset-objects v3.0 docs https://pandas.pydata.org/pandas-docs/stable/user_guide/timeseries.html#dateoffset-objects Related to #2600 * .shift(freq="-30T") -> .shift(freq="-30min") * freq='1T' -> freq='1min' * freq='H' -> freq='h' * resample('m') -> resample('ME') [2 - another file] * shift(freq='-30T') -> shift(freq='-30min') [2 - missed entry] * pandas.read_csv param delim_whitespace removed Fix per https://pandas.pydata.org/pandas-docs/stable/whatsnew/v3.0.0.html (find text delim_whitespace) Issue/discussion: pandas-dev/pandas#55569 * Update v0.14.1.rst * Whatsnew rewording in imperative mood As per https://common-changelog.org/
1 parent b3a3782 commit aa5fc55

File tree

13 files changed

+16
-15
lines changed

13 files changed

+16
-15
lines changed

benchmarks/benchmarks/scaling.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def setup(self):
1515
lon = np.array((4.99, 5, 5.01))
1616
self.coordinates = np.array([(lati, loni) for
1717
(lati, loni) in zip(lat, lon)])
18-
self.times = pd.date_range('2019-01-01', freq='1T', periods=self.n)
18+
self.times = pd.date_range('2019-01-01', freq='1min', periods=self.n)
1919
self.positions = np.array([[0, 0], [100, 0], [100, 100], [0, 100]])
2020
self.clearsky_index = pd.Series(np.random.rand(self.n),
2121
index=self.times)

docs/examples/adr-pvarray/plot_fit_to_matrix.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
25 1000 75.0 273.651
5252
26 1100 75.0 301.013
5353
'''
54-
df = pd.read_csv(StringIO(iec61853data), delim_whitespace=True)
54+
df = pd.read_csv(StringIO(iec61853data), sep=r"\s+")
5555

5656
# %%
5757
#

docs/examples/agrivoltaics/plot_diffuse_PAR_Spitters_relationship.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757

5858
solar_position = pvlib.solarposition.get_solarposition(
5959
# TMY timestamp is at end of hour, so shift to center of interval
60-
tmy.index.shift(freq="-30T"),
60+
tmy.index.shift(freq="-30min"),
6161
latitude=metadata["latitude"],
6262
longitude=metadata["longitude"],
6363
altitude=metadata["altitude"],

docs/examples/bifacial/plot_bifi_model_mc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
# create site location and times characteristics
4141
lat, lon = 36.084, -79.817
4242
tz = 'Etc/GMT+5'
43-
times = pd.date_range('2021-06-21', '2021-6-22', freq='1T', tz=tz)
43+
times = pd.date_range('2021-06-21', '2021-6-22', freq='1min', tz=tz)
4444

4545
# create site system characteristics
4646
axis_tilt = 0

docs/examples/bifacial/plot_bifi_model_pvwatts.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
# using Greensboro, NC for this example
3333
lat, lon = 36.084, -79.817
3434
tz = 'Etc/GMT+5'
35-
times = pd.date_range('2021-06-21', '2021-06-22', freq='1T', tz=tz)
35+
times = pd.date_range('2021-06-21', '2021-06-22', freq='1min', tz=tz)
3636

3737
# create location object and get clearsky data
3838
site_location = location.Location(lat, lon, tz=tz, name='Greensboro, NC')

docs/examples/bifacial/plot_pvfactors_fixed_tilt.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
# %%
3131
# First, generate the usual modeling inputs:
3232

33-
times = pd.date_range('2021-06-21', '2021-06-22', freq='1T', tz='Etc/GMT+5')
33+
times = pd.date_range('2021-06-21', '2021-06-22', freq='1min', tz='Etc/GMT+5')
3434
loc = location.Location(latitude=40, longitude=-80, tz=times.tz)
3535
sp = loc.get_solarposition(times)
3636
cs = loc.get_clearsky(times)

docs/examples/floating-pv/plot_floating_pv_cell_temperature.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@
140140

141141
solar_position = pvlib.solarposition.get_solarposition(
142142
# TMY timestamp is at end of hour, so shift to center of interval
143-
tmy.index.shift(freq='-30T'),
143+
tmy.index.shift(freq='-30min'),
144144
latitude=metadata['latitude'],
145145
longitude=metadata['longitude'],
146146
altitude=metadata['altitude'],

docs/examples/irradiance-decomposition/plot_diffuse_fraction.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
# NOTE: TMY3 files timestamps indicate the end of the hour, so shift indices
3636
# back 30-minutes to calculate solar position at center of the interval
3737
solpos = get_solarposition(
38-
greensboro.index.shift(freq="-30T"), latitude=metadata['latitude'],
38+
greensboro.index.shift(freq="-30min"), latitude=metadata['latitude'],
3939
longitude=metadata['longitude'], altitude=metadata['altitude'],
4040
pressure=greensboro.pressure*100, # convert from millibar to Pa
4141
temperature=greensboro.temp_air)

docs/examples/irradiance-transposition/plot_seasonal_tilt.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,6 @@ def get_orientation(self, solar_zenith, solar_azimuth):
9696
'Seasonal 20/40 Production': mc.results.ac,
9797
'Fixed 30 Production': mc2.results.ac,
9898
})
99-
results.resample('m').sum().plot()
99+
results.resample('ME').sum().plot()
100100
plt.ylabel('Monthly Production')
101101
plt.show()

docs/examples/irradiance-transposition/plot_transposition_gain.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def calculate_poa(tmy, solar_position, surface_tilt, surface_azimuth):
8080
column_name = f"FT-{tilt}"
8181
# TMYs are hourly, so we can just sum up irradiance [W/m^2] to get
8282
# insolation [Wh/m^2]:
83-
df_monthly[column_name] = poa_irradiance.resample('m').sum()
83+
df_monthly[column_name] = poa_irradiance.resample('ME').sum()
8484

8585
# single-axis tracking:
8686
orientation = tracking.singleaxis(solar_position['apparent_zenith'],
@@ -95,10 +95,10 @@ def calculate_poa(tmy, solar_position, surface_tilt, surface_azimuth):
9595
solar_position,
9696
orientation['surface_tilt'],
9797
orientation['surface_azimuth'])
98-
df_monthly['SAT-0.4'] = poa_irradiance.resample('m').sum()
98+
df_monthly['SAT-0.4'] = poa_irradiance.resample('ME').sum()
9999

100100
# calculate the percent difference from GHI
101-
ghi_monthly = tmy['ghi'].resample('m').sum()
101+
ghi_monthly = tmy['ghi'].resample('ME').sum()
102102
df_monthly = 100 * (df_monthly.divide(ghi_monthly, axis=0) - 1)
103103

104104
df_monthly.plot()

0 commit comments

Comments
 (0)