Skip to content

BUG: replace complex64 with complex128 #1246

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pandas/core/internals.py
Original file line number Diff line number Diff line change
Expand Up @@ -1116,7 +1116,7 @@ def form_blocks(data, axes):
blocks.append(float_block)

if len(complex_dict):
complex_block = _simple_blockify(complex_dict, items, np.complex64)
complex_block = _simple_blockify(complex_dict, items, np.complex128)
blocks.append(complex_block)

if len(int_dict):
Expand Down Expand Up @@ -1222,7 +1222,7 @@ def _interleaved_dtype(blocks):
elif have_dt64 and not have_float and not have_complex:
return np.datetime64
elif have_complex:
return np.complex64
return np.complex128
else:
return np.float64

Expand Down
10 changes: 5 additions & 5 deletions pandas/src/inference.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ _TYPE_MAP = {
np.uint64: 'integer',
np.float32: 'floating',
np.float64: 'floating',
np.complex64: 'complex',
np.complex128: 'complex',
np.complex128: 'complex',
np.string_: 'string',
np.unicode_: 'unicode',
Expand Down Expand Up @@ -223,7 +223,7 @@ def maybe_convert_numeric(ndarray[object] values, set na_values):
cdef:
Py_ssize_t i, n
ndarray[float64_t] floats
ndarray[complex64_t] complexes
ndarray[complex128_t] complexes
ndarray[int64_t] ints
bint seen_float = 0
bint seen_complex = 0
Expand All @@ -233,7 +233,7 @@ def maybe_convert_numeric(ndarray[object] values, set na_values):
n = len(values)

floats = np.empty(n, dtype='f8')
complexes = np.empty(n, dtype='c8')
complexes = np.empty(n, dtype='c16')
ints = np.empty(n, dtype='i8')

for i from 0 <= i < n:
Expand Down Expand Up @@ -278,7 +278,7 @@ def maybe_convert_objects(ndarray[object] objects, bint try_float=0,
cdef:
Py_ssize_t i, n
ndarray[float64_t] floats
ndarray[complex64_t] complexes
ndarray[complex128_t] complexes
ndarray[int64_t] ints
ndarray[uint8_t] bools
bint seen_float = 0
Expand All @@ -293,7 +293,7 @@ def maybe_convert_objects(ndarray[object] objects, bint try_float=0,
n = len(objects)

floats = np.empty(n, dtype='f8')
complexes = np.empty(n, dtype='c8')
complexes = np.empty(n, dtype='c16')
ints = np.empty(n, dtype='i8')
bools = np.empty(n, dtype=np.uint8)

Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/test_frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -1691,7 +1691,7 @@ def test_constructor_scalar_inference(self):
self.assert_(df['int'].dtype == np.int64)
self.assert_(df['bool'].dtype == np.bool_)
self.assert_(df['float'].dtype == np.float64)
self.assert_(df['complex'].dtype == np.complex64)
self.assert_(df['complex'].dtype == np.complex128)
self.assert_(df['object'].dtype == np.object_)

def test_constructor_DataFrame(self):
Expand Down
4 changes: 2 additions & 2 deletions pandas/tests/test_internals.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def get_float_ex(cols=['a', 'c', 'e']):
return make_block(floats, cols, TEST_COLS)

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

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

result = self.mgr.item_dtypes
expected = ['float64', 'object', 'float64', 'object', 'float64',
'bool', 'int64', 'complex64']
'bool', 'int64', 'complex128']
self.assert_(np.array_equal(result, expected))

def test_union_block_items(self):
Expand Down