It’s an header and not a row
Note that you must be working on your local computer and you are not using the course assignments, but doing things yourself in Pandas. It looks like there must be something wrong with the way you have converted the input data to “CSV” files. Note that you also lost one of the rows of the “features” dimension of X_train. Your code shows it as 12287 x 209. It should be 12288 x 209. Stripping off the first color of the first pixel of each image probably won’t make much difference, but is something to check.
yes you are right but i dunno why one row is missing i mean i am only applying read_csv so i dont know whats the deal.
still cant wrap my head around a shape of 0 rows and y columns i mean what kind of a shape would that be can you even write it in a piece of paper.
There is such a thing as a 1D array in numpy. Dunno about pandas. Try this:
A = np.random.randn(4)
Maybe 0 x 209 is the pandas way of saying the same thing.
Note that Prof Ng does briefly discuss 1D numpy arrays in DLS C1 W2, if I remember correctly, but his recommendation is not to use them. A 1D array is a vector with one dimension, but it has no “orientation” meaning that it’s not a “row vector” or a “column vector”. It is just a “vector”. But Prof Ng recommends always using two dimensions, so a row vector will be 1 x n and a column vector will be n x 1. The reason for this is that we will be performing algebraic operations between vectors and matrices, which are 2 dimensional objects by definition. It just makes all the rules and results clearer to require that our vectors also have 2 dimenions.
The default behavior of
pd.read_csv is to treat the first line of the csv file as headers and thus not a data row.
I recommend you to be familiar with how
pd.read_csv works with headers by checking out its documentation page, then use your browser’s search tool to locate all appearances of “header”, and experiment and understand how to use the input arguments relevant to headers to correctly read your csv files.