0
$\begingroup$

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

$\endgroup$

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.

0
$\begingroup$

This question should be posted in StackOverflow.

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

import pandas as pd

df=pd.read_csv('nameofyourcsv.csv')
names=('er','rtf')

for each in names:
    print(df.loc[df['Name'] == each, 'ID'].iloc[0])
$\endgroup$
  • 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.