Skip to content

Commit

Permalink
feat: deprecated Table.from_excel_file and Table.to_excel_file
Browse files Browse the repository at this point in the history
  • Loading branch information
lars-reimann committed May 5, 2024
1 parent 576492c commit ff224cf
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/safeds/data/tabular/containers/_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@ def from_excel_file(path: str | Path) -> Table:
Valid file extensions are `.xls`, '.xlsx', `.xlsm`, `.xlsb`, `.odf`, `.ods` and `.odt`.
!!! warning "Deprecated"
Convert your data to a CSV file and use
[Table.from_csv_file][safeds.data.tabular.containers._table.Table.from_csv_file] instead.
Parameters
----------
path:
Expand All @@ -150,6 +154,13 @@ def from_excel_file(path: str | Path) -> Table:
1 2 5
2 3 6
"""
warnings.warn(
"This method is deprecated and will be removed in a future version. "
"Convert your data to a CSV file and use `Table.from_csv_file` instead.",
DeprecationWarning,
stacklevel=2,
)

import pandas as pd

path = Path(path)
Expand Down Expand Up @@ -2357,6 +2368,9 @@ def to_excel_file(self, path: str | Path) -> None:
If the file and/or the directories do not exist, they will be created. If the file already exists, it will be
overwritten.
!!! warning "Deprecated"
Use [`to_csv_file`][safeds.data.tabular.containers.Table._table.to_csv_file] instead.
Parameters
----------
path:
Expand All @@ -2373,6 +2387,12 @@ def to_excel_file(self, path: str | Path) -> None:
>>> table = Table.from_dict({"a": [1, 2, 3], "b": [4, 5, 6]})
>>> table.to_excel_file("./src/resources/to_excel_file.xlsx")
"""
warnings.warn(
"This method is deprecated and will be removed in a future version. Use `Table.to_csv_file` instead.",
DeprecationWarning,
stacklevel=2,
)

import openpyxl

path = Path(path)
Expand Down

0 comments on commit ff224cf

Please sign in to comment.