Skip to content

Commit 26ff9b3

Browse files
committed
Changing notnull, to notna
1 parent e1fed97 commit 26ff9b3

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

doc/source/whatsnew/v1.3.0.rst

+1
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,7 @@ I/O
389389
- Bug in :func:`read_json` when ``orient="split"`` does not maintain numeric string index (:issue:`28556`)
390390
- :meth:`read_sql` returned an empty generator if ``chunksize`` was no-zero and the query returned no results. Now returns a generator with a single empty dataframe (:issue:`34411`)
391391
- Bug in :func:`read_hdf` returning unexpected records when filtering on categorical string columns using ``where`` parameter (:issue:`39189`)
392+
- Bug in :func:`read_sas` raising ``ValueError`` when ``datetimes`` were null (:issue:`39725`)
392393

393394
Period
394395
^^^^^^

pandas/io/sas/sas7bdat.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
from pandas.errors import EmptyDataError, OutOfBoundsDatetime
2424

2525
import pandas as pd
26+
from pandas import notna
2627

2728
from pandas.io.common import get_handle
2829
from pandas.io.sas._sas import Parser
@@ -54,15 +55,15 @@ def _convert_datetimes(sas_datetimes: pd.Series, unit: str) -> pd.Series:
5455
if unit == "s":
5556
s_series = sas_datetimes.apply(
5657
lambda sas_float: datetime(1960, 1, 1) + timedelta(seconds=sas_float)
57-
if pd.notnull(sas_float)
58+
if notna(sas_float)
5859
else pd.NaT
5960
)
6061
s_series = cast(pd.Series, s_series)
6162
return s_series
6263
elif unit == "d":
6364
d_series = sas_datetimes.apply(
6465
lambda sas_float: datetime(1960, 1, 1) + timedelta(days=sas_float)
65-
if pd.notnull(sas_float)
66+
if notna(sas_float)
6667
else pd.NaT
6768
)
6869
d_series = cast(pd.Series, d_series)

0 commit comments

Comments
 (0)