Message Boards Message Boards

1
|
5349 Views
|
3 Replies
|
5 Total Likes
View groups...
Share
Share this post:

Import timeseries csv data?

Posted 4 years ago

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.

POSTED BY: H. Koge
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 BY: Rolf Mertig
Posted 4 years ago

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

POSTED BY: H. Koge
Posted 4 years 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}}]
POSTED BY: Rohit Namjoshi
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