Danny David Leybzon
Danny David Leybzon

Reputation: 680

Conditional row select with Pandas

I want to select a sub-set of a pandas dataframe df where the column text has the value '0.0, 0.0'. I thought the command for this would be df.ix[df['text'] == "0.0, 0.0"] but this returns

<console>:1: error: identifier expected but symbol literal found.
   df.ix[df['text'] == "0.0, 0.0"]
            ^
<console>:1: error: unclosed character literal
   df.ix[df['text'] == "0.0, 0.0"]
                 ^

What am I doing wrong?

Upvotes: 1

Views: 89

Answers (1)

Danny David Leybzon
Danny David Leybzon

Reputation: 680

As DSM pointed out, the error appears to be an error from the Scala programming language. This is because I was using a Zeppelin Notebook, and had failed to specify that the code should be interpreted with the pyspark interpreter. After specifying the interpreter, the code worked as expected.

Upvotes: 1

Related Questions