I have a small Excel file with the data as it the below print screen shows:
which are imported by Python through a .csv file by the following code:
import csvwith open(r"C:\Users\ac324485\Downloads\Daily files\File.csv") as csvfile: rows = list(csv.reader(csvfile)) data_header = rows[0] data_rows = rows[1:]for x in data_header: print(x)for x in data_rows: print(x)
Neeraj thanks I will try, in the meantime confirming that yes, I would like to have this input file in Python and writing back to it also some values (those will come from other application as final target)
csehz
ASKER
Do you have maybe an idea which does not use pandas library, so rather the import csv one?
There are multiple libraries you can use to deal with csv files but I find pandas very much practical when dealing with tabular data, it's my personal preference. Actually I don't use Python much so have no idea about csv library and it's methods. You may look into the csv documentation for more info.
BTW you may give this a try...
Open in new window