简体   繁体   中英

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM