Python Pandas

 I need to create dictionary from csv file and get values.


The CSV is 


items.csv 

A,100000

B, 100000

C, 1000045

I need to search with first column and get second column over a dict.


What I did is to transpose the table.


items = pd.read_csv('items.csv', index_col=0, header=None).T.to_dict()
def search_value(key_item):
for item in items.keys():
if item == key_item:
print(str(items[item][1]))



Comments

Popular posts from this blog

सिंह खरायो कथा

राजु र चन्द्रमा मामा

Privacy Policy