Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialDaniel Carter
19,991 PointsCSV File Issues
I have followed the instructions, and for some reason cannot access the csv file. Is there something I need to download in order for it to work?
1 Answer
Daniel Carter
19,991 PointsHey Kris,
Thanks for responding. I'm on a Mac.
I haven't had any problems with this code:
import os import pandas as pd
We use os.path.join because Windows uses a back slash () to separate directories
while others use a forward slash (/)
users_file_name = os.path.join('data', 'users.csv')
I get an error message with the next block of code:
Open the file and print out the first 5 lines
with open(users_file_name) as lines:
for _ in range(5):
# The file
object is an iterator, so just get the next line
print(next(lines))
Ronak Bothra
818 Pointsdo you have a CSV file named 'users.csv'? if not then that might be the reason for the error.
KRIS NIKOLAISEN
54,972 PointsKRIS NIKOLAISEN
54,972 PointsCan you get this far with the file? Are you on a Mac or PC?