Strange error about invalid syntax

Getting “invalid syntax” on a plain return statement is pretty much impossible. If you use it outside of a function, you get ‘return’ outside function, if you have the wrong indentation you get IndentationError, etc. The only way I can get a SyntaxError: invalid syntax on a return statement, is if in fact it doesn’t say return at all, but if … Read more

What does this Django regular expression mean? `?P`

In django, named capturing groups are passed to your view as keyword arguments. Unnamed capturing groups (just a parenthesis) are passed to your view as arguments. The ?P is a named capturing group, as opposed to an unnamed capturing group. http://docs.python.org/library/re.html (?P<name>…) Similar to regular parentheses, but the substring matched by the group is accessible within … Read more

Print empty line?

You will always only get an indent error if there is actually an indent error. Double check that your final line is indented the same was as the other lines — either with spaces or with tabs. Most likely, some of the lines had spaces (or tabs) and the other line had tabs (or spaces). … Read more

Importing Pandas gives error AttributeError: module ‘pandas’ has no attribute ‘core’ in iPython Notebook

Apparently the error I got when trying to import pandas for the first time was ValueError: unknown locale: UTF-8 Trying to import again afterwards, gave another error as described in my question above. I found the solution to solve the ValueError on IPython Notebook locale error After updating my bash profile, the error AttributeError: module ‘pandas’ has no attribute ‘core’ did … Read more