-
-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Closed
Labels
BugDtype ConversionsUnexpected or buggy dtype conversionsUnexpected or buggy dtype conversionsNumeric OperationsArithmetic, Comparison, and Logical operationsArithmetic, Comparison, and Logical operations
Milestone
Description
import pandas as pd
import numpy as np
df = pd.DataFrame({'num':[1,2,3], 'num2': np.random.randn(3), 'strings':list('abc')})
df.sum().values # array(['6', '-1.47818918058', 'abc'], dtype=object)
The issue is that axis=0 tries to coerce the dtypes and np.array
will promote the numerics to strings.
Note that:
df.T.sum(axis=1).values # array([6, -1.4781891805780178, 'abc'], dtype=object)
Maybe com._coerce_to_dtypes
should just return the list?
Metadata
Metadata
Assignees
Labels
BugDtype ConversionsUnexpected or buggy dtype conversionsUnexpected or buggy dtype conversionsNumeric OperationsArithmetic, Comparison, and Logical operationsArithmetic, Comparison, and Logical operations