# Having trouble with Part

I'm very new to Mathematica. I'm just trying to plot some data, but Mathematica says there isn't a 7th element my data which is an array of 7 elements. The code before the plot is here:

x = Import["C:\\Useres\\PC\\Documents\\alt.csv","Table"];
a = x[[;;,7]];
tmp = x[[;;, 1;;6]];
dt = DateObject[tmp];


Mathematica also says it cannot take positions 1 through 6 in the first row of my data. I have to be doing something wrong, but I have no idea what.

I've searched as much as I could to find out what's wrong, but everything I find on Mathematica is super technical jargon I don't understand and irrelevant to my issue besides.

Any help would be appreciated.

### Edit

x is a file with 16,382 rows and 7 columns. The first six columns are the date and time, and the last is altitude. The interval between rows is one second.

• Where's your definition of x? – John Doty Oct 20 at 22:54
• What is x? Please post a complete code that allows to fully reproduce your issue. For examples, it x is a string your code won't work. – corey979 Oct 20 at 22:55
• Assuming x = {2018, 09, 27, 12, 13, 50, 153.2}, ;; is equivalent to All which is why x[[;;,7]] generates an error. Why not just x[[7]] or x[[1 ;; 6]]. If you had a list of lists then the form you are using would apply. e.g. {x, x}[[;; , 7]]. – Rohit Namjoshi Oct 20 at 22:56
• What is the result of Dimensions[x]? – MassDefect Oct 21 at 0:55
• Thanks @MassDefect, that lead me to my answer. The output showed only one column, not seven. – Oliver Oct 21 at 17:52

I used Dimensions[x] and found that Mathematica was only outputting one column.

Mathematica sees the csv data file as only having one column because "Table" is written in the import function when it should be "csv".
So this code:

x = Import["C:\\Useres\\PC\\Documents\\alt.csv","Table"];


x = Import["C:\\Useres\\PC\\Documents\\alt.csv","csv"];

• Actually, just Import["C:\\Useres\\PC\\Documents\\alt.csv","csv"] will work. – m_goldberg Oct 28 at 1:48