Skip to content

Errors in the transformation parser: aes(x="np.log(column)", y="Not_Existing") #136

@jankatins

Description

@jankatins

The above example gives an error:

gg = ggplot(_df, aes(x="np.log(c_ratio_in)", y="np.log(ppy_ratio_in)")) + geom_point()
gg

 File "<string>", line 1
    data.get('np')data.get('log')(data.get('ppy_ratio_in'))
                     ^
SyntaxError: invalid syntax

-> There should be a better way to detect if something is a column or not -> Check if the potential column name is really in data.columns and only then surround it with the data.get(...)

This should also help against non existing columns:

_df.get("NotExisting")

-> No Error! -> The final plt simple shows nothing :-(

If there is an error in the eval, the error message is not helpfull:

gg = ggplot(_df, aes(x="log(c_ratio_in)", y="log(ppy_ratio_in)")) + geom_point()
gg
[...]
c:\data\external\ggplot\ggplot\ggplot.pyc in _build_df_from_transforms(data, aes)
    481                         item = "data.get('%s')" % item
    482                     lambda_column += item
--> 483                 data[name] = eval(lambda_column)
    484     return data

c:\data\external\ggplot\ggplot\ggplot.pyc in <module>()

TypeError: 'NoneType' object is not callable

-> At least the resulting eval line should be printed and then the exception reraised.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions