Skip to content

Commit 442b8c1

Browse files
committed
Whatsnew, issue tag, test reordering.
1 parent 8d675ad commit 442b8c1

File tree

3 files changed

+22
-11
lines changed

3 files changed

+22
-11
lines changed

doc/source/whatsnew/v0.19.0.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,7 @@ API changes
437437
- ``pd.Timedelta(None)`` is now accepted and will return ``NaT``, mirroring ``pd.Timestamp`` (:issue:`13687`)
438438
- ``Timestamp``, ``Period``, ``DatetimeIndex``, ``PeriodIndex`` and ``.dt`` accessor have gained a ``.is_leap_year`` property to check whether the date belongs to a leap year. (:issue:`13727`)
439439
- ``pd.read_hdf`` will now raise a ``ValueError`` instead of ``KeyError``, if a mode other than ``r``, ``r+`` and ``a`` is supplied. (:issue:`13623`)
440+
- ``.values`` will now return ``np.float64`` with a ``DataFrame`` with ``np.int64`` and ``np.uint64`` dtypes, conforming to ``np.find_common_type`` (:issue:`10364`, :issue:`13917`)
440441

441442

442443

pandas/tests/frame/test_block_internals.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ def test_as_matrix_lcd(self):
104104
values = self.mixed_float.as_matrix(['C'])
105105
self.assertEqual(values.dtype, np.float16)
106106

107+
# GH 10364
107108
# B uint64 forces float because there are other signed int types
108109
values = self.mixed_int.as_matrix(['A', 'B', 'C', 'D'])
109110
self.assertEqual(values.dtype, np.float64)

pandas/tests/types/test_cast.py

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -192,33 +192,42 @@ def test_possibly_convert_objects_copy(self):
192192

193193

194194
class TestCommonTypes(tm.TestCase):
195-
def setUp(self):
196-
super(TestCommonTypes, self).setUp()
197-
198195
def test_numpy_dtypes(self):
196+
# identity
199197
self.assertEqual(_find_common_type([np.int64]), np.int64)
200198
self.assertEqual(_find_common_type([np.uint64]), np.uint64)
201199
self.assertEqual(_find_common_type([np.float32]), np.float32)
202200
self.assertEqual(_find_common_type([np.object]), np.object)
203201

202+
# into ints
204203
self.assertEqual(_find_common_type([np.int16, np.int64]),
205204
np.int64)
206205
self.assertEqual(_find_common_type([np.int32, np.uint32]),
207206
np.int64)
208-
self.assertEqual(_find_common_type([np.object, np.float32]),
209-
np.object)
210-
self.assertEqual(_find_common_type([np.object, np.int16]),
211-
np.object)
212-
self.assertEqual(_find_common_type([np.int16, np.float64]),
213-
np.float64)
207+
self.assertEqual(_find_common_type([np.uint16, np.uint64]),
208+
np.uint64)
209+
210+
# into floats
211+
self.assertEqual(_find_common_type([np.float16, np.float32]),
212+
np.float32)
214213
self.assertEqual(_find_common_type([np.float16, np.int16]),
215214
np.float32)
215+
self.assertEqual(_find_common_type([np.float32, np.int16]),
216+
np.float32)
217+
self.assertEqual(_find_common_type([np.uint64, np.int64]),
218+
np.float64)
219+
self.assertEqual(_find_common_type([np.int16, np.float64]),
220+
np.float64)
216221
self.assertEqual(_find_common_type([np.float16, np.int64]),
217222
np.float64)
223+
224+
# into others
218225
self.assertEqual(_find_common_type([np.complex128, np.int32]),
219226
np.complex128)
220-
self.assertEqual(_find_common_type([np.uint64, np.int64]),
221-
np.float64)
227+
self.assertEqual(_find_common_type([np.object, np.float32]),
228+
np.object)
229+
self.assertEqual(_find_common_type([np.object, np.int16]),
230+
np.object)
222231

223232
def test_pandas_dtypes(self):
224233
with self.assertRaises(TypeError):

0 commit comments

Comments
 (0)