Binary operations on int DataMatrix · Issue #3 · pandas-dev/pandas (original) (raw)
Navigation Menu
- Explore
- Pricing
Provide feedback
Saved searches
Use saved searches to filter your results more quickly
Appearance settings
Description
Reported by kwgoodman, Jun 12, 2010
When adding two int DataMatrix's a ValueError is raised when matrix.py attempt to fill missing values with NaN:
dma1 = pandas.DataMatrix([[1, 2], [3, 4]], ['a', 'b'], ['c', 'd'])
dma2 = pandas.DataMatrix([[1, 2], [3, 4]], ['b', 'a'], ['d', 'c'])
dma1 + dma2ValueError: cannot convert float NaN to integer
Delete comment Comment 1 by kwgoodman, Jun 12, 2010
Possible fix:
x = np.array([1.0])
issubclass(x.dtype.type, np.inexact)
True
x = np.array([1])
issubclass(x.dtype.type, np.inexact)
False
x = np.array([1.0], dtype=object)
issubclass(x.dtype.type, np.inexact)
False
x = np.array([1.0], dtype=str)
issubclass(x.dtype.type, np.inexact)
False