The CSV file contains: ID,Name 1,AS 2,er 3,rtf 4,addfs

The list contains the name for example (er,rtf) I want to find the ID's corresponding to these names mentioned above How to find the ID's using the Python code.

Thanks in advance


closed as unclear what you're asking by Stephen Rauch, oW_, Sean Owen Oct 13 '18 at 1:58

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.


This question should be posted in StackOverflow.

Store your CSV into a Pandas DataFrame and operate on that.

import pandas as pd


for each in names:
    print(df.loc[df['Name'] == each, 'ID'].iloc[0])
  • 1
    $\begingroup$ @Sheetal Happy to help! If this answer (and any other answers to your questions in general) resolved your issue, please mark it as accepted by selecting the check mark below the voting buttons on the left. $\endgroup$ – Anakimi Oct 11 '18 at 5:25

Not the answer you're looking for? Browse other questions tagged or ask your own question.