0
Help reading csv files
I have to read a csv files which headers are "capital", "mar high", "other stuff" in "capital" there are cities in each row like say Texas then "mar high" = 321 and there are more data in other rows about Texas with different mar heights.... Well, I need to read each data corresponding to "Texas" is Texas a capital? Idk it's just an example :P I was trying to do this with the csv module and using .DictReader() was I too lost? :,D
3 Respuestas
+ 2
Just see this code
https://code.sololearn.com/c6fiEfU43rcN/?ref=app
+ 1
import pandas as pd
df=pd.read_csv('file.csv',index='capital')
print(df.loc['Texas'])
0
I think I can do what I want with an if statement like if row["capital" ] =="Texas":
I'm trying that