Skip to content

Multiple issues with StrInCol #18

Open

Description

@kaushik327

Reproduce:

df = pd.read_csv('./datasets/dataranch__supermarket-sales-prediction-xgboost-fastai__SampleSuperstore.csv')
if '41' in df['Profit'].to_string():
    pass

This errors, since somewhere in the rewriting process, df['Profit'] becomes df[Profit], which causes NameError: name 'Profit' is not defined.

df_multi_index = df.set_index(['Postal Code', 'Sub-Category'])
for col in df_multi_index.columns:
    if 'ou' in df_multi_index[col].to_string():
        pass

This also errors, since the existing rewriting rule (which uses index.astype(str)) doesn't work for a MultiIndex, yielding TypeError: Setting a MultiIndex dtype to anything other than object is not supported.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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