Posts

Showing posts from September, 2021

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 ]))