-
-
Notifications
You must be signed in to change notification settings - Fork 19.1k
Closed
Labels
BugDtype ConversionsUnexpected or buggy dtype conversionsUnexpected or buggy dtype conversionsIndexingRelated to indexing on series/frames, not to indexes themselvesRelated to indexing on series/frames, not to indexes themselves
Description
Assignment to mixed-type DataFrame with float32 numpy array coerce to float64
>>> import pandas as pd
>>> import numpy as np
>>> df = pd.DataFrame([[1, 2, 'a'], [3, 4, 'b']], dtype=np.float32)
>>> A = df.iloc[:, 0:1].values
>>> df.iloc[:, 0:1] = A
>>> df[0].dtype
dtype('float64')
Shouldn't the result be dtype('float32')
?
See also http://stackoverflow.com/questions/35230388/why-does-pandas-coerce-my-numpy-float32-to-float64
Metadata
Metadata
Assignees
Labels
BugDtype ConversionsUnexpected or buggy dtype conversionsUnexpected or buggy dtype conversionsIndexingRelated to indexing on series/frames, not to indexes themselvesRelated to indexing on series/frames, not to indexes themselves