0

I have a dataset that i saved as a csv in Sublime after pasting from excel

When I call csv.reader to print all the rows, the whole set is printed out (fantastic):

Output 1

Output # 1

Now that I want to call to print the first row of my dataset "print(row[0])", the first entire column of my dataset prints out:

Output 2 Output # 2

PLEASE HELP! I am trying to learn python.

1
  • Please include code instead of images of your code: this is really difficult to read Commented May 10, 2017 at 3:42

2 Answers 2

1

row is a row. row[0] is the first element of that row.

If you want to just print the first row, do print(row) then break to stop the iteration.

Sign up to request clarification or add additional context in comments.

Comments

0

You have to use such code:

import csv
with open("exampleSet.csv") as productivityCost:
   readPC = csv.reader(productivityCost, delimeter = ",")
   print(row[0])

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.