user3682157
user3682157

Reputation: 1695

Referencing Column Titles That Contain Spaces in Python 3 (Pandas)

Simple question here: I am trying to reference two columns and then divide them, but the column titles contain spaces.

Title 1: First Word Sum
Title 2: First Word Clicks

When I try to do something like this, it doesn't work:

cvr = (final.First Word Sum / final.First Word Clicks)

How do I rectify this? Thank you

Upvotes: 0

Views: 262

Answers (1)

Karthik V
Karthik V

Reputation: 1897

You cannot do it the way you are trying to. However the following would work:

cvr = final['First Word Sum'] / final['First Word Clicks']

Upvotes: 1

Related Questions