I use in my code this declaration to create a film tab. But, how can I create the same using a .csv with the same columns? To be more clear, I have a .csv file with a tab in which are present columns with this data: " 'Film1_name', 'sequel', 6, date, available". How can I read this .csv to have the equivalent of the code written below? Thank you.
Films=(
['Film1_name', 'sequel', 6, date, available],
['Film2_name', 'sequel', 1, date, not available],
['Film3_name', 'sequel', 2, date, available],
)
In the .csv file data are presented (with no column names) as:
Film1_name |sequel | 6 |date| available
Film2_name |sequel | 1 |date| not available
Film3_name |sequel | 2 |date| available
I want to extract columns because after I want to execute a for cycle as:
for j in self.Films:
Film_principal= j[0]
Possible_sequel = j[1]
CodePudding user response:
you can use read_csv from pandas library https://pandas.pydata.org/docs/reference/api/pandas.read_csv.html#pandas.read_csv
CodePudding user response:
this give me only the last value of the column film....how could I have the entire column with the names of Films_principal ?
films=filmes_view.to_numpy()
print(films)
for j in films:
Film_principal=j[0]