First problem is is use np.asarray(['a','b',3]
all data are converting to strings, objects.
AA2 = pd.DataFrame(np.asarray(['a','b',3]))
print (AA2.dtypes)
0 object
dtype: object
print (AA2[0].apply(lambda x: type(x)))
0 <class 'str'>
1 <class 'str'>
2 <class 'str'>
Name: 0, dtype: object
If pass list get mixed data - numeric with strings:
AA2 = pd.DataFrame(['a','b',3])
print (AA2.dtypes)
0 object
dtype: object
print (AA2[0].apply(lambda x: type(x)))
0 <class 'str'>
1 <class 'str'>
2 <class 'int'>
Name: 0, dtype: object
But working with mixed values is problemtic, most numeric operations failed, so the best is avoid it.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…