So, I’m currently trying to do the boolean indexing with numpy mission of the data analyst path (https://app.dataquest.io/m/290/boolean-indexing-with-numpy), but I’m getting this error message in jupyter notebook, when I try to open csv files with numpy.genfromtxt().
import numpy as np
import pandas as pd
hn = np.genfromtxt("Hacker News.csv", encoding = "utf8", delimiter = ",")'''
I’m using jupyter because I find it better to organize what I learn there than going back to the missions whenever I have a doubt or have to refresh something I’ve forgotten. The np.genfromtxt() worked just fine in the dataquest website, but not in jupyter. There I got this error message:
ValueError: Some errors were detected !
Line #4 (got 3 columns instead of 7)
Line #22 (got 2 columns instead of 7)
Line #27 (got 3 columns instead of 7)
Line #39 (got 8 columns instead of 7)
Line #46 (got 3 columns instead of 7)
Line #49 (got 3 columns instead of 7)
Line #56 (got 3 columns instead of 7)
Can someone tell me why ?
Something that I also found interesting is that I could open the file just fine with the python standard csv library (as shows in the missions is step one of the Data Analyst path), but not with the numpy library. I also managed to open the file with pandas( reader_csv) and it worked. So the problem seems really to be something with numpy.
Can anyone tell me the difference between reading csv files with standard csv library, numpy and pandas ? Also, how do I open csv files with numpy in Jupyter without getting the error message I’m receiving ?