airbud
airbud

Reputation: 49

Removing data based on value from rows with spaces

I am new to this, so I am sorry for the simple question. I am currently trying to remove rows based on values from the data frame right now I can make it work, but only if I remove a column with no space in between. So my question is without renaming Host Name to a one word or adding an underscore how can I get this to work ? I currently have this


info.columns = ['Host Name', 'Space']
info

output: 
Host Name           Space
Desktop123           500
desktop213           500
desktop              Node


info=info[info.Host Name !='Node']
info.head()

File "<ipython-input-24-2800ffbe7476>", line 1
    info=info[info.'Host Name' !='Node']
                             ^
SyntaxError: invalid syntax

Upvotes: 0

Views: 52

Answers (1)

Parmandeep Chaddha
Parmandeep Chaddha

Reputation: 484

Change

info=info[info.Host Name !='Node']

TO:

info=info[info['Host Name'] !='Node']

Upvotes: 3

Related Questions