Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I just got a trial version of Mathematica. I want to experiment with using it for data analysis.

I have a CSV file here that I would like to import into Mathematica so that the data is represented as a matrix (2D array) where the columns are represented as column vectors rather than each cell representing a row. I also need to chop off the headers, too.

Here's what I've got so far:

data = Import["https://raw.githubusercontent.com/camenergydatalab/EnergyDataSimulationChallenge/master/challenge1/data/dataset_500.csv"]
share|improve this question

closed as off-topic by Kuba, Pickett, bobthechemist, Simon Woods, Yves Klett May 22 at 17:01

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Kuba, Pickett, bobthechemist, Simon Woods, Yves Klett
If this question can be reworded to fit the rules in the help center, please edit the question.

    
"chop the headers": data[[2;;] –  Öskå May 22 at 12:39
    
...and for the columns: column #1 data[[2;;,1]], column #2 data[[2;;,2]] etc –  Mike Honeychurch May 22 at 12:51
1  
Or perhaps Transpose[Rest[data]]. You also might look at this answer. I think it might be relevant to your situation. –  m_goldberg May 22 at 13:16

1 Answer 1

up vote 1 down vote accepted

I see the answer completely in the comments. Use

data = Transpose@Rest@Import[
"https://raw.githubusercontent.com/camenergydatalab/EnergyDataSimulationChallenge/master/challenge1/data/dataset_500.csv"];

You can then verify that this was your intention with

TableForm@data

Hit the "Show Full Output" button, and you will get a very long table that is easier to inspect with the horizontal scroll bar. Here is a screenshot of what the corner of that full output looks like:

enter image description here

share|improve this answer
    
I tend to think that since the answer is in the comments, as you acknowledge, the answer should be a Community Wiki :) –  Öskå May 22 at 14:13
    
I should say, I see the "solution" in the comments. I do not quite see my complete well refined verifiable answer there. :) –  J. W. Perry May 22 at 14:27

Not the answer you're looking for? Browse other questions tagged or ask your own question.