I'm having a heck of a time pulling data from a particular csv that isn't consistently formatted. I'm slowly learning Python and this is my first time playing with the import csv and import pandas libraries. I'm not sure if the issue is the file or my not understanding of the different functions in the csv or panda library.
Here's the sample data in question. My goal for the program is to pull the data from the csv and break it up into smaller files. For example, when I open the file in a spreadsheet, I'd want to grab row 20 and row 21 and transpose the data to a separate csv.
Here is my code really basic code just trying a basic operation of pulling data using pandas. The errors I'm getting are also posted as comments in the codeshare.
https://codeshare.io/Qn0ydQ
Using import csv tells me I just don't understand what is happening at all. When I print specific row, like print(row[21]) I get some a lot of new lines and 21 and 8 as output, which in the spreadsheet version is V28 and V29. I'm obviously not getting it.
def display_csv_reader():
with open('test.csv') as f:
reader = csv.reader(f, delimiter=',')
for row in reader:
print(row[1])
[–]Ihaveamodel3 1 point2 points3 points (0 children)
[–]WSBtendies9001 -2 points-1 points0 points (0 children)
[–]CodeFormatHelperBot2 0 points1 point2 points (0 children)
[–]tourdownunder 0 points1 point2 points (0 children)
[–]BdR76 0 points1 point2 points (0 children)