पंडों ने मुझे क्यों बताया कि मेरे पास ऑब्जेक्ट हैं, हालांकि चयनित कॉलम में प्रत्येक आइटम एक स्ट्रिंग है - स्पष्ट रूपांतरण के बाद भी।
यह मेरा डेटाफ़्रेम है:
<class 'pandas.core.frame.DataFrame'>
Int64Index: 56992 entries, 0 to 56991
Data columns (total 7 columns):
id 56992 non-null values
attr1 56992 non-null values
attr2 56992 non-null values
attr3 56992 non-null values
attr4 56992 non-null values
attr5 56992 non-null values
attr6 56992 non-null values
dtypes: int64(2), object(5)
उनमें से पांच हैं dtype object। मैं स्पष्ट रूप से उन वस्तुओं को तार में परिवर्तित करता हूं:
for c in df.columns:
if df[c].dtype == object:
print "convert ", df[c].name, " to string"
df[c] = df[c].astype(str)
फिर, df["attr2"]अभी भी है dtype object, हालांकि type(df["attr2"].ix[0]पता चलता है str, जो सही है।
के बीच पांडा अलग है int64और float64और object। जब नहीं है तो इसके पीछे क्या तर्क है dtype str? strद्वारा कवर क्यों किया जाता है object?



