0

I saw here that this should work :

test = pd.Series({
383:    3.000000,
663:    1.000000,
726:    1.000000,
737:    9.000000,
833:    8.166667
})
test[lambda x: x!=1]

And i ran it and it did work, So i dont get why this wouldnt :

ex=pandas.Series({
383:    "Hello",
663:    "Hello",
726:    "Gallo",
737:    "Jello",
833:    "Gallo"
})
pprint(ex[lambda item : item.startswith("Hello")])

I get error :

AttributeError: 'Series' object has no attribute 'startswith'

Any one can tell me whats going on, why is item parameter a Seria? why x!=1 seemed to work on the actual values in the seria while item.startswith doesnt?

Ofek Ron
  • 8,354
  • 13
  • 55
  • 103

0 Answers0