Skip to content
Advertisement

Serach List names in a dataframe column pandas

I am trying to match my list of server with the pandas dataframe in the column Server Name if the name in the list matches in the Server Name then print the entire row.

there are chances names is the my_List do not match entirely like one of the server name in my_List is tick1001.example.us.com while in Server Name.

This this my kind of list

JavaScript

Below is the Data Sample.

JavaScript

Below is my code tried:

JavaScript

Expected:

JavaScript

Advertisement

Answer

Try below:

Use read().splitlines() as every line comes with its end of line characters (nr) as in your example; this way the characters are removed.

JavaScript

this should be working.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement