Skip to content

Commit

Permalink
Trying to fix an edge case with pandas versioning
Browse files Browse the repository at this point in the history
  • Loading branch information
simon-m-mudd committed Feb 2, 2024
1 parent 49667af commit 547efa5
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
4 changes: 4 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,7 @@ History

* Added some code to make sure the package works on pandas versions < 2.0.0 (SMM)

0.4 (2024-02-02)
-----------------

* For utterly crazy reasons, I need to make this package resiliant against cases where the pandas version using .__version__ is different than that from pkg_resources
2 changes: 1 addition & 1 deletion nrfapy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

__author__ = """Simon M Mudd and Simon Moulds"""
__email__ = '[email protected]'
__version__ = '0.3'
__version__ = '0.4'


from .nrfapy import *
5 changes: 3 additions & 2 deletions nrfapy/nrfapy.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,9 @@ def _build_ts(response, date_index):
print("pandas is not installed.")
return

if pkg_resources.parse_version(pandas_version) < pkg_resources.parse_version("2.0.0"):
#print(f"pandas version is below 2.0.0. Running alternate behavior...")
pandas_version = pd.__version__
if pkg_resources.parse_version(pandas_version) < pkg_resources.parse_version("2.2.0"):
#print(f"pandas version is below 2.2.0. Running alternate behavior...")
df['time'] = pd.to_datetime(df['time'])
else:
#print(f"pandas version is {pandas_version}. Running normal behavior...")
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,6 @@
test_suite='tests',
tests_require=test_requirements,
url='https://github.com/simon-m-mudd/nrfapy',
version='0.3',
version='0.4',
zip_safe=False,
)

0 comments on commit 547efa5

Please sign in to comment.