In order to convert the first column of a data frame to a series, I wrote:
dict1 = {'col1': [1, 2, 3, 4, 7, 11],
'col2': [4, 5, 6, 9, 5, 0],
'col3': [7, 5, 8, 12, 1,11]
}
df1 = pd.DataFrame(data=dict1)
series5 = df1.ix[:,0]
However, Python gives me error:
AttributeError: 'DataFrame' object has no attribute 'ix'
How can I handle this situation? Why am I wrong?
question from:
https://stackoverflow.com/questions/65641423/converting-a-column-of-a-data-frame-to-series-with-pandas 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…