pymatch icon indicating copy to clipboard operation
pymatch copied to clipboard

Allow spaces inside column names

Open JohannesWiesner opened this issue 6 years ago • 2 comments

My data frame contains columns such as Current Age or Subject Type, so the column names contain spaces. When I initialized an instance of the Matcher Class I got:

SyntaxError: invalid syntax

It took me a while to understand that my column names are not allowed to have spaces in them. However, I prefer them to 'look pretty', because eventually you want to plot your data and then it is nice when you don't have to work on the matplotlib or seaborn plots to change x- or y-axis titles.

Please either allow for spaces inside column names or update the documentation so that it is clear, that column names must not contain spaces.

JohannesWiesner avatar Aug 01 '19 14:08 JohannesWiesner

@JohannesWiesner check out the last commit in my fork. It should fix the problem: The issue is in constructing the formula for patsy which doesn't allow for white spaces in var-names. However, variables can be escaped to avoid that.

Let me know how it works for you.

mc51 avatar Aug 03 '19 08:08 mc51

@mc51 your fork solves this issue. You can reference it in your pull request to close it.

JohannesWiesner avatar Aug 13 '19 13:08 JohannesWiesner