Message Boards Message Boards

GROUPS:

Import timeseries csv data?

Posted 3 months ago
532 Views
|
3 Replies
|
5 Total Likes
|

Hello, I am usually MATLAB user. I am considering switching from MATLAB to Mathematica.

Now please help me, I am very struggling to import time series csv in Mathematica. Very first step for users except me, but it takes too many time...

The data format is

2020, 10, 27, 3, 45, 14.579, 38.1726, 143.41, 3390., 47071, 9999, -7711.6, -22813.8, 47340.9, 93.54, -0.4, -0.31 ...

First 1-6 is YYYY,MM,DD,hh,mm,ss, and followings are each sensor data.

I cannot found how to import this data and plot.

3 Replies

Try this for a start:

FILENAME = "test.csv";
Column[
MapIndexed[DateListPlot[{#1}, PlotLabel -> Row[{"Column ", First[#2]}]] & , 
 First[
   Import[
     FILENAME, {"CSV", "Data"}
 ] ] /.   {yyyy_Integer, MM_, dd_, hh_, mm_, ss_, (data__)?NumberQ} :> 
          Thread[{DateObject[{yyyy, MM, dd, hh, mm, ss}], {data}}]]]
Posted 3 months ago

I appreciate to your help. But I cannot find where the data was imported and the values... It will take long time...

Posted 3 months ago

The answer from Rolf imports and plots the data in one step. To just import the data

data = First[Import[FILENAME, {"CSV", "Data"}]] /. 
  {yyyy_Integer, MM_, dd_,  hh_, mm_, ss_, (data__)?NumberQ} :> 
    Thread[{DateObject[{yyyy, MM, dd, hh, mm, ss}], {data}}]
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract