1

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?

7
  • Did you modify any part of the error message? Commented Sep 13, 2016 at 17:30
  • No, I did not change the error message Commented Sep 13, 2016 at 17:31
  • It works fine when I try it. Can you add versions of your Python/pandas installations, which environment you are using etc? Commented Sep 13, 2016 at 17:32
  • 1
    .. are you sure you're using Python and not Scala? Commented Sep 13, 2016 at 17:36
  • @DSM I just realized I'm in a Zeppelin notebook and hadn't specified that it should be using the Py interpreter. My bad! Will question delete in 5 mins Commented Sep 13, 2016 at 17:37

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.