Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
ML_mini_challenge/i.py
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
18 lines (14 sloc)
518 Bytes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import csv | |
# The path to your CSV file | |
csv_file_path = 'category.csv' | |
# Initialize an empty list to store the names | |
names = [] | |
# Open the CSV file and read each row | |
with open(csv_file_path, mode='r', encoding='utf-8') as file: | |
reader = csv.reader(file) | |
next(reader) # Skip the header row if there is one | |
for row in reader: | |
# Assuming names are in the first column | |
names.append(row[1]) | |
# names now contains all the names from the first column of your CSV | |
print(names) |