0
我用下面的代碼在我的數據幀過濾掉一些行的字符串內容:大熊貓數據框:過濾的行基於列
my_df_1 = my_df[my_df.col1.startswith('good_')]
,但我得到了以下錯誤:
AttributeErrorTraceback (most recent call last)
<ipython-input-3-dbd2d6731148> in <module>()
----> 1 my_df_1 = my_df[my_df.col1.startswith('good_')]
/usr/local/lib/python2.7/dist-packages/pandas/core/generic.pyc in __getattr__(self, name)
2742 if name in self._info_axis:
2743 return self[name]
-> 2744 return object.__getattribute__(self, name)
2745
2746 def __setattr__(self, name, value):
AttributeError: 'Series' object has no attribute 'starts with'
有誰知道我錯過了什麼?謝謝!