Skip to content

Commit

Permalink
Discontinue Polygons.to_dataframe(), Table.dataframe and Table.arrowt…
Browse files Browse the repository at this point in the history
…able()

* Discontinue Polygons.to_dataframe()

* Discontinue Table.dataframe

* Discontinue Table.arrowtable()
  • Loading branch information
perolavsvendsen authored Dec 11, 2023
1 parent 8e96fa9 commit 9aa3903
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 78 deletions.
14 changes: 0 additions & 14 deletions src/fmu/sumo/explorer/objects/polygons.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,6 @@ def __init__(self, sumo: SumoClient, metadata: Dict) -> None:
"""
super().__init__(sumo, metadata)

def to_dataframe(self) -> pd.DataFrame:
"""Get polygons object as a DataFrame
Returns:
DataFrame: A DataFrame object
"""
warn(
".to_dataframe() is deprecated, renamed to .to_pandas() ",
DeprecationWarning,
stacklevel=2,
)

return self.to_pandas()

def to_pandas(self) -> pd.DataFrame:
"""Get polygons object as a DataFrame
Expand Down
29 changes: 0 additions & 29 deletions src/fmu/sumo/explorer/objects/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,6 @@ def __init__(self, sumo: SumoClient, metadata: dict) -> None:
self._arrowtable = None
self._logger = logging.getLogger("__name__" + ".Table")

@property
def dataframe(self) -> pd.DataFrame:
"""Return object as a pandas DataFrame
Returns:
DataFrame: A DataFrame object
"""
warn(
".dataframe is deprecated, renamed to .to_pandas",
DeprecationWarning,
stacklevel=2,
)
return self.to_pandas()


def to_pandas(self) -> pd.DataFrame:
"""Return object as a pandas DataFrame
Expand Down Expand Up @@ -107,21 +93,6 @@ async def to_pandas_async(self) -> pd.DataFrame:
return self._dataframe


@property
def arrowtable(self) -> pa.Table:
"""Return object as an arrow Table
Returns:
pa.Table: _description_
"""
warn(
".arrowtable is deprecated, renamed to .to_arrow",
DeprecationWarning,
stacklevel=2,
)

return self.to_arrow()

def to_arrow(self) -> pa.Table:
"""Return object as an arrow Table
Expand Down
35 changes: 0 additions & 35 deletions tests/test_objects_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,26 +30,11 @@ def fixture_table(case):

### Table

def test_table_dataframe(table):
"""Test the dataframe property."""
with pytest.warns(DeprecationWarning, match=".dataframe is deprecated"):
df = table.dataframe
assert isinstance(df, pd.DataFrame)


def test_table_to_pandas(table):
"""Test the to_pandas method."""
df = table.to_pandas()
assert isinstance(df, pd.DataFrame)


def test_arrowtable(table):
"""Test the arrowtable property."""
with pytest.warns(DeprecationWarning, match=".arrowtable is deprecated"):
arrow = table.arrowtable
assert isinstance(arrow, pa.Table)


def test_table_to_arrow(table):
"""Test the to_arrow() method"""
arrow = table.to_arrow()
Expand All @@ -74,26 +59,6 @@ def test_aggregated_summary_arrow(case):
)


def test_aggregated_summary_arrow_with_deprecated_function_name(case):
"""Test usage of Aggregated class with default type with deprecated function name"""

table = AggregatedTable(case, "summary", "eclipse", "iter-0")

assert len(table.columns) == 972 + 2
column = table["FOPT"]

with pytest.warns(
DeprecationWarning,
match=".arrowtable is deprecated, renamed to .to_arrow()",
):
assert isinstance(column.arrowtable, pa.Table)
with pytest.raises(IndexError) as e_info:
table = table["banana"]
assert (
e_info.value.args[0] == "Column: 'banana' does not exist try again"
)


def test_aggregated_summary_pandas(case):
"""Test usage of Aggregated class with item_type=pandas"""
table = AggregatedTable(case, "summary", "eclipse", "iter-0")
Expand Down

0 comments on commit 9aa3903

Please sign in to comment.