Skip to content

Commit ad2ad47

Browse files
tkfwesm
authored andcommitted
BUG: replace complex64 with complex128
As mentioned in #1098.
1 parent 5c1937b commit ad2ad47

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

pandas/core/internals.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1116,7 +1116,7 @@ def form_blocks(data, axes):
11161116
blocks.append(float_block)
11171117

11181118
if len(complex_dict):
1119-
complex_block = _simple_blockify(complex_dict, items, np.complex64)
1119+
complex_block = _simple_blockify(complex_dict, items, np.complex128)
11201120
blocks.append(complex_block)
11211121

11221122
if len(int_dict):
@@ -1222,7 +1222,7 @@ def _interleaved_dtype(blocks):
12221222
elif have_dt64 and not have_float and not have_complex:
12231223
return np.datetime64
12241224
elif have_complex:
1225-
return np.complex64
1225+
return np.complex128
12261226
else:
12271227
return np.float64
12281228

pandas/src/inference.pyx

+5-5
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ _TYPE_MAP = {
1111
np.uint64: 'integer',
1212
np.float32: 'floating',
1313
np.float64: 'floating',
14-
np.complex64: 'complex',
14+
np.complex128: 'complex',
1515
np.complex128: 'complex',
1616
np.string_: 'string',
1717
np.unicode_: 'unicode',
@@ -223,7 +223,7 @@ def maybe_convert_numeric(ndarray[object] values, set na_values):
223223
cdef:
224224
Py_ssize_t i, n
225225
ndarray[float64_t] floats
226-
ndarray[complex64_t] complexes
226+
ndarray[complex128_t] complexes
227227
ndarray[int64_t] ints
228228
bint seen_float = 0
229229
bint seen_complex = 0
@@ -233,7 +233,7 @@ def maybe_convert_numeric(ndarray[object] values, set na_values):
233233
n = len(values)
234234

235235
floats = np.empty(n, dtype='f8')
236-
complexes = np.empty(n, dtype='c8')
236+
complexes = np.empty(n, dtype='c16')
237237
ints = np.empty(n, dtype='i8')
238238

239239
for i from 0 <= i < n:
@@ -278,7 +278,7 @@ def maybe_convert_objects(ndarray[object] objects, bint try_float=0,
278278
cdef:
279279
Py_ssize_t i, n
280280
ndarray[float64_t] floats
281-
ndarray[complex64_t] complexes
281+
ndarray[complex128_t] complexes
282282
ndarray[int64_t] ints
283283
ndarray[uint8_t] bools
284284
bint seen_float = 0
@@ -293,7 +293,7 @@ def maybe_convert_objects(ndarray[object] objects, bint try_float=0,
293293
n = len(objects)
294294

295295
floats = np.empty(n, dtype='f8')
296-
complexes = np.empty(n, dtype='c8')
296+
complexes = np.empty(n, dtype='c16')
297297
ints = np.empty(n, dtype='i8')
298298
bools = np.empty(n, dtype=np.uint8)
299299

pandas/tests/test_frame.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1693,7 +1693,7 @@ def test_constructor_scalar_inference(self):
16931693
self.assert_(df['int'].dtype == np.int64)
16941694
self.assert_(df['bool'].dtype == np.bool_)
16951695
self.assert_(df['float'].dtype == np.float64)
1696-
self.assert_(df['complex'].dtype == np.complex64)
1696+
self.assert_(df['complex'].dtype == np.complex128)
16971697
self.assert_(df['object'].dtype == np.object_)
16981698

16991699
def test_constructor_DataFrame(self):

pandas/tests/test_internals.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def get_float_ex(cols=['a', 'c', 'e']):
2727
return make_block(floats, cols, TEST_COLS)
2828

2929
def get_complex_ex(cols=['h']):
30-
complexes = (get_float_mat(N, 1).T * 1j).astype(np.complex64)
30+
complexes = (get_float_mat(N, 1).T * 1j).astype(np.complex128)
3131
return make_block(complexes, cols, TEST_COLS)
3232

3333
def get_obj_ex(cols=['b', 'd']):
@@ -211,7 +211,7 @@ def test_block_id_vector_item_dtypes(self):
211211

212212
result = self.mgr.item_dtypes
213213
expected = ['float64', 'object', 'float64', 'object', 'float64',
214-
'bool', 'int64', 'complex64']
214+
'bool', 'int64', 'complex128']
215215
self.assert_(np.array_equal(result, expected))
216216

217217
def test_union_block_items(self):

0 commit comments

Comments
 (0)