How to call a column in DataFrame that has a space in the name

You are welcome to ask - this is what this forum is for.

Your understanding is correct. Quoting the crucial passage from your post above:

Column names in a DataFrame are labels. For this reason both symbols and strings are allowed to be used when referencing them without introducing an ambiguity.

So from user’s perspective you do not need to think how technically column names are stored. Think of them as “labels”. You can use either Symbol or string to reference the column.


Now, given you asked (but this should not matter to you as a user). Internally column names are stored as Symbols, and if you use a string to look-up a column it is internally converted to Symbol (but as a user you do not have to think about it). The reason why we internally use Symbol is that symbol lookup is faster. However, we also allow strings as they are easier to manipulate. This is explained in Section 6.6 of “Julia for Data Analysis” book (in general - i.e. without specific reference to DataFrame object) and then section 8.3 (specifically in DataFrame) context.

2 Likes