Skip to content

Commit 72b9a66

Browse files
alimcmaster1feefladder
authored andcommitted
ENH: Add Storage Options kwarg to read_table (pandas-dev#43239)
1 parent b1b5eef commit 72b9a66

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

doc/source/whatsnew/v1.4.0.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ Other enhancements
9595
- :meth:`Series.sample`, :meth:`DataFrame.sample`, and :meth:`.GroupBy.sample` now accept a ``np.random.Generator`` as input to ``random_state``. A generator will be more performant, especially with ``replace=False`` (:issue:`38100`)
9696
- :meth:`Series.ewm`, :meth:`DataFrame.ewm`, now support a ``method`` argument with a ``'table'`` option that performs the windowing operation over an entire :class:`DataFrame`. See :ref:`Window Overview <window.overview>` for performance and functional benefits (:issue:`42273`)
9797
- :meth:`.GroupBy.cummin` and :meth:`.GroupBy.cummax` now support the argument ``skipna`` (:issue:`34047`)
98-
-
98+
- :meth:`read_table` now supports the argument ``storage_options`` (:issue:`39167`)
9999

100100
.. ---------------------------------------------------------------------------
101101

pandas/io/parsers/readers.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -693,19 +693,20 @@ def read_table(
693693
escapechar=None,
694694
comment=None,
695695
encoding=None,
696+
encoding_errors: str | None = "strict",
696697
dialect=None,
697698
# Error Handling
698699
error_bad_lines=None,
699700
warn_bad_lines=None,
700701
# TODO (2.0): set on_bad_lines to "error".
701702
# See _refine_defaults_read comment for why we do this.
702703
on_bad_lines=None,
703-
encoding_errors: str | None = "strict",
704704
# Internal
705705
delim_whitespace=False,
706706
low_memory=_c_parser_defaults["low_memory"],
707707
memory_map=False,
708708
float_precision=None,
709+
storage_options: StorageOptions = None,
709710
):
710711
# locals() should never be modified
711712
kwds = locals().copy()

pandas/tests/io/test_fsspec.py

+12
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
read_parquet,
1414
read_pickle,
1515
read_stata,
16+
read_table,
1617
)
1718
import pandas._testing as tm
1819
from pandas.util import _test_decorators as td
@@ -122,6 +123,17 @@ def test_csv_options(fsspectest):
122123
assert fsspectest.test[0] == "csv_read"
123124

124125

126+
def test_read_table_options(fsspectest):
127+
# GH #39167
128+
df = DataFrame({"a": [0]})
129+
df.to_csv(
130+
"testmem://test/test.csv", storage_options={"test": "csv_write"}, index=False
131+
)
132+
assert fsspectest.test[0] == "csv_write"
133+
read_table("testmem://test/test.csv", storage_options={"test": "csv_read"})
134+
assert fsspectest.test[0] == "csv_read"
135+
136+
125137
@pytest.mark.parametrize("extension", ["xlsx", "xls"])
126138
def test_excel_options(fsspectest, extension):
127139
if extension == "xls":

0 commit comments

Comments
 (0)