Skip to content

Commit

Permalink
handle exception for Pandas < 2.0. Update whatsnew/pending.rst
Browse files Browse the repository at this point in the history
  • Loading branch information
cdeline committed Nov 9, 2023
1 parent 4b7e30e commit b92a1b4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion bifacial_radiance/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,10 @@ def _subhourlydatatoGencumskyformat(gencumskydata, label='right'):


#Resample to hourly. Gencumsky wants right-labeled data.
gencumskydata = gencumskydata.resample('60T', closed='right', label='right').mean(numeric_only=True)
try:
gencumskydata = gencumskydata.resample('60T', closed='right', label='right').mean()
except TypeError: # Pandas 2.0 error
gencumskydata = gencumskydata.resample('60T', closed='right', label='right').mean(numeric_only=True)

if label == 'left': #switch from left to right labeled by adding an hour
gencumskydata.index = gencumskydata.index + pd.to_timedelta('1H')
Expand Down
4 changes: 2 additions & 2 deletions docs/sphinx/source/whatsnew/pending.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ API Changes
*A new function can now be called to compile results and report out final irradiance and performance data: :py:class:`~bifacial_radiance.RadianceObj.compileResults`.
*Multiple modules and rows can now be selected in a single analysis scan. ``modWanted`` and ``rowWanted`` inputs in :py:class:`~bifacial_radiance.RadianceObj.analysis1axis` can now be a list, to select multiple rows and modules for scans. (:issue:`405`)(:pull:`408`)
*To support multiple modules and row scans for 1axis simulations, outputs like Wm2Front are now stored in ``trackerdict``.``Results`` (:issue:`405`)(:pull:`408`)
* ``mismatch.mad_fn`` has new functionality and input parameter `axis`. If a 2D matrix or dataframe is passed in as data, MAD is calculated for each row (default) or column by passing 'axis=1'
* ``mismatch.mad_fn`` has new functionality and input parameter `axis`. If a 2D matrix or dataframe is passed in as data, MAD is calculated along the row (default) or along the columns by passing 'axis=1'
Enhancements
~~~~~~~~~~~~


Bug fixes
~~~~~~~~~
* Pandas 2.0 errors have not yet been fixed. Constraining pandas < 2.0 in setup.py until (:issue:`449`) is fixed
* Fixed Pandas 2.0 errors by re-factoring ``mismatch.mad_fn`` (:issue:`449`)

Documentation
~~~~~~~~~~~~~~
Expand Down

0 comments on commit b92a1b4

Please sign in to comment.