benmiroglio / pymatch

MIT License
276 stars 129 forks source link

Allow spaces inside column names #18

Open JohannesWiesner opened 5 years ago

JohannesWiesner commented 5 years ago

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.

mc51 commented 5 years ago

@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.

JohannesWiesner commented 5 years ago

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