Skip to content

Deprecations and FutureWarnings Fixes #128

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Jun 13, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def about_package(init_posixpath: pathlib.Path) -> dict:
# Dependencies for the package itself
DEPENDENCIES = [
"numpy>=1.19.0",
"pandas>=1.0",
"pandas>=2.1",
]

# Extra dependencies
Expand All @@ -53,7 +53,7 @@ def about_package(init_posixpath: pathlib.Path) -> dict:
url=ABOUT_TFS["__url__"],
packages=setuptools.find_packages(include=(MODULE_NAME,)),
include_package_data=True,
python_requires=">=3.7",
python_requires=">=3.9",
license=ABOUT_TFS["__license__"],
classifiers=[
"Development Status :: 5 - Production/Stable",
Expand Down
2 changes: 1 addition & 1 deletion tfs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
__title__ = "tfs-pandas"
__description__ = "Read and write tfs files."
__url__ = "https://github.com/pylhc/tfs"
__version__ = "3.7.2"
__version__ = "3.7.3"
__author__ = "pylhc"
__author_email__ = "pylhc@github.com"
__license__ = "MIT"
Expand Down
6 changes: 4 additions & 2 deletions tfs/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,10 @@ def _element_is_list(element):
raise TfsFormatError("Lists or tuple elements are not accepted in a TfsDataFrame")

# ----- Check that no element is non-physical value in the dataframe ----- #
with pd.option_context('mode.use_inf_as_na', True):
inf_or_nan_bool_df = data_frame.isna()
# The pd.option_context('mode.use_inf_as_na', True) context manager raises FutureWarning
# and will likely disappear in pandas 3.0 so we replaced inf values by NaNs before calling
# .isna(). Since .replace() returns a copy we're not modifying the original dataframe.
inf_or_nan_bool_df = data_frame.replace([np.inf, -np.inf], np.nan).isna() #

if inf_or_nan_bool_df.to_numpy().any():
LOGGER.warning(
Expand Down
2 changes: 1 addition & 1 deletion tfs/writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ def quote_strings(s):
return f'"{s}"'
return s

data_frame = data_frame.applymap(quote_strings)
data_frame = data_frame.map(quote_strings)
return data_frame


Expand Down