0

I like to seperate an nominal variable into two new variables like indoor and outdoor. e.g. indoor = df[df.Indoor - outdoor == "indoor"]
the variable name in the original file is "Indoor - outdoor"

My question, how to input in order to transfer in a new one? The example results in an error message because [df.Indoor - outdoor ...] obviously cannot find the related variable.

I have tried df.'Indoor - outdoor' and df."Indoor - outdoor" but that is not working. Thanks for your help.

Move_On
  • 19
  • 3
  • I have renamed my variable, now it is working. Have no idea how to do deal it with the given name including spaces ... df = df.rename(index=str, columns={"Indoor - outdoor": "Indoor_outdoor"}) – Move_On Jan 20 '19 at 15:06
  • Possible duplicate of [Pandas column access w/column names containing spaces](https://stackoverflow.com/questions/13757090/pandas-column-access-w-column-names-containing-spaces) – Gino Mempin Jan 21 '19 at 00:09

0 Answers0