Permalink
Browse files

ENH: treat complex number in internals.form_blocks

  • Loading branch information...
tkf committed Apr 20, 2012
1 parent ba08846 commit a351e9435208b99ee1ba6e9aa0c5863613ab3177
Showing with 7 additions and 0 deletions.
  1. +7 −0 pandas/core/internals.py
View
@@ -980,13 +980,16 @@ def form_blocks(data, axes):
# put "leftover" items in float bucket, where else?
# generalize?
float_dict = {}
+ complex_dict = {}
int_dict = {}
bool_dict = {}
object_dict = {}
datetime_dict = {}
for k, v in data.iteritems():
if issubclass(v.dtype.type, np.floating):
float_dict[k] = v
+ elif issubclass(v.dtype.type, np.complexfloating):
+ complex_dict[k] = v
elif issubclass(v.dtype.type, np.datetime64):
datetime_dict[k] = v
elif issubclass(v.dtype.type, np.integer):
@@ -1001,6 +1004,10 @@ def form_blocks(data, axes):
float_block = _simple_blockify(float_dict, items, np.float64)
blocks.append(float_block)
+ if len(complex_dict):
+ complex_block = _simple_blockify(complex_dict, items, np.complex64)
+ blocks.append(complex_block)
+
if len(int_dict):
int_block = _simple_blockify(int_dict, items, np.int64)
blocks.append(int_block)

0 comments on commit a351e94

Please sign in to comment.