Skip to content

ENH: Add Storage Options kwarg to read_table #43239

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 4 commits into from
Aug 31, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 1 addition & 0 deletions pandas/io/parsers/readers.py
Original file line number Diff line number Diff line change
Expand Up @@ -659,6 +659,7 @@ def read_table(
low_memory=_c_parser_defaults["low_memory"],
memory_map=False,
float_precision=None,
storage_options: StorageOptions = None,
):
# locals() should never be modified
kwds = locals().copy()
Expand Down
11 changes: 11 additions & 0 deletions pandas/tests/io/test_fsspec.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
read_parquet,
read_pickle,
read_stata,
read_table,
)
import pandas._testing as tm
from pandas.util import _test_decorators as td
Expand Down Expand Up @@ -122,6 +123,16 @@ def test_csv_options(fsspectest):
assert fsspectest.test[0] == "csv_read"


def test_read_table_options(fsspectest):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we parametrize the test added back then?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically changing the order of the arguments might break user code, but I don't think this is a real issue?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically changing the order of the arguments might break user code, but I don't think this is a real issue?

Its a kwarg do you have an example of how this might break user code?

Copy link
Member Author

@alimcmaster1 alimcmaster1 Aug 27, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we parametrize the test added back then?

Fair point they could be. The pattern used in the following tests in this file is the same. But I think thats better off as a sep issue.

test_csv_options
test_excel_options
test_arrowparquet_options
test_fastparquet_options
test_feather_options
test_pickle_options

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They aren't key word only yet, but as I said probably not relevant.

Yeah agree with the tests. Have not looked that closely, just checked the linked pr and saw that the test was the same, so was wondering

df = DataFrame({"a": [0]})
df.to_csv(
"testmem://test/test.csv", storage_options={"test": "csv_write"}, index=False
)
assert fsspectest.test[0] == "csv_write"
read_table("testmem://test/test.csv", storage_options={"test": "csv_read"})
assert fsspectest.test[0] == "csv_read"


@pytest.mark.parametrize("extension", ["xlsx", "xls"])
def test_excel_options(fsspectest, extension):
if extension == "xls":
Expand Down