Skip to content

Commit 6a10fb4

Browse files
committed
Merge remote-tracking branch 'upstream/master' into 32bit-ci
2 parents 9af5c20 + d850140 commit 6a10fb4

File tree

3 files changed

+21
-5
lines changed

3 files changed

+21
-5
lines changed

doc/source/user_guide/io.rst

+4-5
Original file line numberDiff line numberDiff line change
@@ -5686,7 +5686,7 @@ ignored.
56865686
dtypes: float64(1), int64(1)
56875687
memory usage: 15.3 MB
56885688
5689-
Given the next test set:
5689+
The following test functions will be used below to compare the performance of several IO methods:
56905690

56915691
.. code-block:: python
56925692
@@ -5791,7 +5791,7 @@ Given the next test set:
57915791
def test_parquet_read():
57925792
pd.read_parquet("test.parquet")
57935793
5794-
When writing, the top-three functions in terms of speed are ``test_feather_write``, ``test_hdf_fixed_write`` and ``test_hdf_fixed_write_compress``.
5794+
When writing, the top three functions in terms of speed are ``test_feather_write``, ``test_hdf_fixed_write`` and ``test_hdf_fixed_write_compress``.
57955795

57965796
.. code-block:: ipython
57975797
@@ -5825,7 +5825,7 @@ When writing, the top-three functions in terms of speed are ``test_feather_write
58255825
In [13]: %timeit test_parquet_write(df)
58265826
67.6 ms ± 706 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)
58275827
5828-
When reading, the top three are ``test_feather_read``, ``test_pickle_read`` and
5828+
When reading, the top three functions in terms of speed are ``test_feather_read``, ``test_pickle_read`` and
58295829
``test_hdf_fixed_read``.
58305830

58315831

@@ -5862,8 +5862,7 @@ When reading, the top three are ``test_feather_read``, ``test_pickle_read`` and
58625862
24.4 ms ± 146 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)
58635863
58645864
5865-
For this test case ``test.pkl.compress``, ``test.parquet`` and ``test.feather`` took the least space on disk.
5866-
Space on disk (in bytes)
5865+
The files ``test.pkl.compress``, ``test.parquet`` and ``test.feather`` took the least space on disk (in bytes).
58675866

58685867
.. code-block:: none
58695868

pandas/core/base.py

+10
Original file line numberDiff line numberDiff line change
@@ -1201,6 +1201,16 @@ def factorize(self, sort: bool = False, na_sentinel: Optional[int] = -1):
12011201
>>> ser.searchsorted([1, 3], side='right')
12021202
array([1, 3])
12031203
1204+
>>> ser = pd.Series(pd.to_datetime(['3/11/2000', '3/12/2000', '3/13/2000']))
1205+
>>> ser
1206+
0 2000-03-11
1207+
1 2000-03-12
1208+
2 2000-03-13
1209+
dtype: datetime64[ns]
1210+
1211+
>>> ser.searchsorted('3/14/2000')
1212+
3
1213+
12041214
>>> ser = pd.Categorical(
12051215
... ['apple', 'bread', 'bread', 'cheese', 'milk'], ordered=True
12061216
... )

pandas/tests/series/test_constructors.py

+7
Original file line numberDiff line numberDiff line change
@@ -689,6 +689,13 @@ def test_constructor_coerce_float_valid(self, float_dtype):
689689
expected = Series([1, 2, 3.5]).astype(float_dtype)
690690
tm.assert_series_equal(s, expected)
691691

692+
def test_constructor_invalid_coerce_ints_with_float_nan(self, any_int_dtype):
693+
# GH 22585
694+
695+
msg = "cannot convert float NaN to integer"
696+
with pytest.raises(ValueError, match=msg):
697+
Series([1, 2, np.nan], dtype=any_int_dtype)
698+
692699
def test_constructor_dtype_no_cast(self):
693700
# see gh-1572
694701
s = Series([1, 2, 3])

0 commit comments

Comments
 (0)