Skip to content

Commit 14ab558

Browse files
committed
Simplify conditional branch in _read function in readers.py
1 parent 5e40ff5 commit 14ab558

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

pandas/io/parsers/readers.py

+4-8
Original file line numberDiff line numberDiff line change
@@ -542,13 +542,9 @@ def _read(
542542
"""Generic reader of line files."""
543543
# if we pass a date_parser and parse_dates=False, we should not parse the
544544
# dates GH#44366
545-
if (
546-
kwds.get("date_parser", None) is not None
547-
and kwds.get("parse_dates", None) is None
548-
):
549-
kwds["parse_dates"] = True
550-
elif kwds.get("parse_dates", None) is None:
551-
kwds["parse_dates"] = False
545+
if kwds.get("parse_dates", None) is None:
546+
# Set parse_dates to True if date_parser is set else set it to False
547+
kwds["parse_dates"] = kwds.get("date_parser", None) is not None
552548

553549
# Extract some of the arguments (pass chunksize on).
554550
iterator = kwds.get("iterator", False)
@@ -564,7 +560,7 @@ def _read(
564560
"The 'chunksize' option is not supported with the 'pyarrow' engine"
565561
)
566562
else:
567-
chunksize = validate_integer("chunksize", kwds.get("chunksize", None), 1)
563+
chunksize = validate_integer("chunksize", chunksize, 1)
568564

569565
nrows = kwds.get("nrows", None)
570566

0 commit comments

Comments
 (0)