Skip to content

Commit cc5d779

Browse files
committed
Merge branch 'master' of https://github.com/pandas-dev/pandas
2 parents 71edcce + 8d1b8ab commit cc5d779

34 files changed

+298
-206
lines changed

ci/code_checks.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ fi
225225
### DOCSTRINGS ###
226226
if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
227227

228-
MSG='Validate docstrings (GL03, GL04, GL05, GL06, GL07, GL09, GL10, SS02, SS04, SS05, PR03, PR04, PR05, PR10, EX04, RT01, RT04, RT05, SA02, SA03)' ; echo $MSG
228+
MSG='Validate docstrings (GL03, GL04, GL05, GL06, GL07, GL09, GL10, SS01, SS02, SS04, SS05, PR03, PR04, PR05, PR10, EX04, RT01, RT04, RT05, SA02, SA03)' ; echo $MSG
229229
$BASE_DIR/scripts/validate_docstrings.py --format=actions --errors=GL03,GL04,GL05,GL06,GL07,GL09,GL10,SS02,SS04,SS05,PR03,PR04,PR05,PR10,EX04,RT01,RT04,RT05,SA02,SA03
230230
RET=$(($RET + $?)) ; echo $MSG "DONE"
231231

doc/source/whatsnew/v1.2.0.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -623,6 +623,7 @@ I/O
623623
- Bug in :meth:`DataFrame.to_hdf` was not dropping missing rows with ``dropna=True`` (:issue:`35719`)
624624
- Bug in :func:`read_html` was raising a ``TypeError`` when supplying a ``pathlib.Path`` argument to the ``io`` parameter (:issue:`37705`)
625625
- :meth:`to_excel` and :meth:`to_markdown` support writing to fsspec URLs such as S3 and Google Cloud Storage (:issue:`33987`)
626+
- Bug in :meth:`read_fw` was not skipping blank lines (even with ``skip_blank_lines=True``) (:issue:`37758`)
626627

627628
Plotting
628629
^^^^^^^^

pandas/_libs/lib.pyx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,8 @@ def memory_usage_of_objects(arr: object[:]) -> int64_t:
118118

119119
def is_scalar(val: object) -> bool:
120120
"""
121+
Return True if given object is scalar.
122+
121123
Parameters
122124
----------
123125
val : object
@@ -927,6 +929,8 @@ def indices_fast(ndarray index, const int64_t[:] labels, list keys,
927929

928930
def is_float(obj: object) -> bool:
929931
"""
932+
Return True if given object is float.
933+
930934
Returns
931935
-------
932936
bool
@@ -936,6 +940,8 @@ def is_float(obj: object) -> bool:
936940

937941
def is_integer(obj: object) -> bool:
938942
"""
943+
Return True if given object is integer.
944+
939945
Returns
940946
-------
941947
bool
@@ -945,6 +951,8 @@ def is_integer(obj: object) -> bool:
945951

946952
def is_bool(obj: object) -> bool:
947953
"""
954+
Return True if given object is boolean.
955+
948956
Returns
949957
-------
950958
bool
@@ -954,6 +962,8 @@ def is_bool(obj: object) -> bool:
954962

955963
def is_complex(obj: object) -> bool:
956964
"""
965+
Return True if given object is complex.
966+
957967
Returns
958968
-------
959969
bool
@@ -971,7 +981,7 @@ cpdef bint is_interval(object obj):
971981

972982
def is_period(val: object) -> bool:
973983
"""
974-
Return a boolean if this is a Period object.
984+
Return True if given object is Period.
975985

976986
Returns
977987
-------

pandas/io/parsers.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3750,6 +3750,19 @@ def _make_reader(self, f):
37503750
self.infer_nrows,
37513751
)
37523752

3753+
def _remove_empty_lines(self, lines) -> List:
3754+
"""
3755+
Returns the list of lines without the empty ones. With fixed-width
3756+
fields, empty lines become arrays of empty strings.
3757+
3758+
See PythonParser._remove_empty_lines.
3759+
"""
3760+
return [
3761+
line
3762+
for line in lines
3763+
if any(not isinstance(e, str) or e.strip() for e in line)
3764+
]
3765+
37533766

37543767
def _refine_defaults_read(
37553768
dialect: Union[str, csv.Dialect],

pandas/tests/arithmetic/conftest.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import pytest
33

44
import pandas as pd
5+
from pandas import Float64Index, Int64Index, RangeIndex, UInt64Index
56
import pandas._testing as tm
67

78
# ------------------------------------------------------------------
@@ -93,10 +94,10 @@ def zero(request):
9394

9495
@pytest.fixture(
9596
params=[
96-
pd.Float64Index(np.arange(5, dtype="float64")),
97-
pd.Int64Index(np.arange(5, dtype="int64")),
98-
pd.UInt64Index(np.arange(5, dtype="uint64")),
99-
pd.RangeIndex(5),
97+
Float64Index(np.arange(5, dtype="float64")),
98+
Int64Index(np.arange(5, dtype="int64")),
99+
UInt64Index(np.arange(5, dtype="uint64")),
100+
RangeIndex(5),
100101
],
101102
ids=lambda x: type(x).__name__,
102103
)

pandas/tests/arithmetic/test_datetime64.py

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
import pandas as pd
1919
from pandas import (
20+
DateOffset,
2021
DatetimeIndex,
2122
NaT,
2223
Period,
@@ -166,8 +167,8 @@ class TestDatetime64SeriesComparison:
166167
[NaT, NaT, Timedelta("3 days")],
167168
),
168169
(
169-
[pd.Period("2011-01", freq="M"), NaT, pd.Period("2011-03", freq="M")],
170-
[NaT, NaT, pd.Period("2011-03", freq="M")],
170+
[Period("2011-01", freq="M"), NaT, Period("2011-03", freq="M")],
171+
[NaT, NaT, Period("2011-03", freq="M")],
171172
),
172173
],
173174
)
@@ -1078,7 +1079,7 @@ def test_dt64arr_add_timestamp_raises(self, box_with_array):
10781079
3.14,
10791080
np.array([2.0, 3.0]),
10801081
# GH#13078 datetime +/- Period is invalid
1081-
pd.Period("2011-01-01", freq="D"),
1082+
Period("2011-01-01", freq="D"),
10821083
# https://github.com/pandas-dev/pandas/issues/10329
10831084
time(1, 2, 3),
10841085
],
@@ -1288,7 +1289,7 @@ def test_dt64arr_add_sub_relativedelta_offsets(self, box_with_array):
12881289
("microseconds", 5),
12891290
]
12901291
for i, kwd in enumerate(relative_kwargs):
1291-
off = pd.DateOffset(**dict([kwd]))
1292+
off = DateOffset(**dict([kwd]))
12921293

12931294
expected = DatetimeIndex([x + off for x in vec_items])
12941295
expected = tm.box_expected(expected, box_with_array)
@@ -1298,7 +1299,7 @@ def test_dt64arr_add_sub_relativedelta_offsets(self, box_with_array):
12981299
expected = tm.box_expected(expected, box_with_array)
12991300
tm.assert_equal(expected, vec - off)
13001301

1301-
off = pd.DateOffset(**dict(relative_kwargs[: i + 1]))
1302+
off = DateOffset(**dict(relative_kwargs[: i + 1]))
13021303

13031304
expected = DatetimeIndex([x + off for x in vec_items])
13041305
expected = tm.box_expected(expected, box_with_array)
@@ -1431,14 +1432,14 @@ def test_dt64arr_add_sub_DateOffset(self, box_with_array):
14311432
# GH#10699
14321433
s = date_range("2000-01-01", "2000-01-31", name="a")
14331434
s = tm.box_expected(s, box_with_array)
1434-
result = s + pd.DateOffset(years=1)
1435-
result2 = pd.DateOffset(years=1) + s
1435+
result = s + DateOffset(years=1)
1436+
result2 = DateOffset(years=1) + s
14361437
exp = date_range("2001-01-01", "2001-01-31", name="a")._with_freq(None)
14371438
exp = tm.box_expected(exp, box_with_array)
14381439
tm.assert_equal(result, exp)
14391440
tm.assert_equal(result2, exp)
14401441

1441-
result = s - pd.DateOffset(years=1)
1442+
result = s - DateOffset(years=1)
14421443
exp = date_range("1999-01-01", "1999-01-31", name="a")._with_freq(None)
14431444
exp = tm.box_expected(exp, box_with_array)
14441445
tm.assert_equal(result, exp)
@@ -1527,7 +1528,7 @@ def test_dt64arr_add_sub_offset_array(
15271528
[
15281529
(
15291530
"__add__",
1530-
pd.DateOffset(months=3, days=10),
1531+
DateOffset(months=3, days=10),
15311532
[
15321533
Timestamp("2014-04-11"),
15331534
Timestamp("2015-04-11"),
@@ -1538,7 +1539,7 @@ def test_dt64arr_add_sub_offset_array(
15381539
),
15391540
(
15401541
"__add__",
1541-
pd.DateOffset(months=3),
1542+
DateOffset(months=3),
15421543
[
15431544
Timestamp("2014-04-01"),
15441545
Timestamp("2015-04-01"),
@@ -1549,7 +1550,7 @@ def test_dt64arr_add_sub_offset_array(
15491550
),
15501551
(
15511552
"__sub__",
1552-
pd.DateOffset(months=3, days=10),
1553+
DateOffset(months=3, days=10),
15531554
[
15541555
Timestamp("2013-09-21"),
15551556
Timestamp("2014-09-21"),
@@ -1560,7 +1561,7 @@ def test_dt64arr_add_sub_offset_array(
15601561
),
15611562
(
15621563
"__sub__",
1563-
pd.DateOffset(months=3),
1564+
DateOffset(months=3),
15641565
[
15651566
Timestamp("2013-10-01"),
15661567
Timestamp("2014-10-01"),

pandas/tests/arithmetic/test_interval.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,6 @@ def test_index_series_compat(self, op, constructor, expected_type, assert_func):
290290
def test_comparison_operations(self, scalars):
291291
# GH #28981
292292
expected = Series([False, False])
293-
s = Series([pd.Interval(0, 1), pd.Interval(1, 2)], dtype="interval")
293+
s = Series([Interval(0, 1), Interval(1, 2)], dtype="interval")
294294
result = s == scalars
295295
tm.assert_series_equal(result, expected)

0 commit comments

Comments
 (0)