How do you write a python code that looks at a specific cell in a csv file?
I have the following data in a csv file
1 0 100
2 11 150
3 0 189
4 0 195
5 21 245
I need to write a program in python that will count the number of non zero values in the SECOND column only. Any hints? All help is greatly appreciated.
machine91
0
Newbie Poster
Recommended Answers
Jump to PostInteresting! One way I was able to reproduce that is with an extra line at the end of the input file. Here's a successful run:
-> cat -E test.txt 1 0 100$ 2 11 150$ 3 0 189$ 4 0 195$ 5 21 245$ -> python test.py …
All 3 Replies
JeoSaurus
32
Posting Whiz in Training
machine91
0
Newbie Poster
JeoSaurus
32
Posting Whiz in Training
vegaseat
commented:
nice effort
+15
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.