Group Abstract Group Abstract

Message Boards Message Boards

0
|
79 Views
|
4 Replies
|
2 Total Likes
View groups...
Share
Share this post:

Accessing and using TimeSeries data in Mathematica imported from Excel

Posted 3 days ago

Hi Community Member,

I am trying to import a simple Excel spreadsheet containing a date stamp column and a data column of closing prices. While the import appears successful, the resulting TimeSeries object seems to list the closing prices as the keys rather than the dates, which is somewhat concerning. I have attached the notebook and Excel spreadsheet for reference.

Additionally, when I attempt to access the data within the TimeSeries object, I get mixed results. While functions like Histogram work correctly, other functions such as Mean, StandardDeviation, and FindDistribution either fail with an error message or simply redisplay the TimeSeries object.

Although I have used Mathematica for calculations for several years, I am new to working with data files. I have reviewed the documentation and examples but have not been able to resolve the issue.

Could you please help me get on the right track?

Thanks so much,

Mitch Sandlin

POSTED BY: Mitchell Sandlin
4 Replies

After doing Piotr's suggestion, we can create your dataset with the Timestamp column as desired (the "Close" column is already in the format we want for Dataset): dataFINSX = Import[(*path to xlsx file*), "TimeSeries"][[1]]; dataset = Association["TimesStamp" -> #[[1]], #[[2]]] & /@ dataFINSX["DatePath"] // Dataset; And now we can do some calculations with the closing values: dataset[Mean, "Close"] (*15.9247*) dataset[EstimatedDistribution[#, NormalDistribution[mu, sigma]] &, "Close"] (*NormalDistribution[15.9247, 1.65351]*)

POSTED BY: David Trimas

Hi Piotr;

I tried your suggestion; however, it didn't seem to change anything throughout the notebook - Please see attached.

Thanks so much, I certainly appreciate the help.

Mitch Sandlin

Attachments:
POSTED BY: Mitchell Sandlin

Mitch,

In the notebook you should replace dataFINSX = Import["C:\\Users\\masandlin\\Downloads\\FGINX_Data20260718.xlsx", "TimeSeries"] with dataFINSX = First@Import["C:\\Users\\masandlin\\Downloads\\FGINX_Data20260718.xlsx", "TimeSeries"]

POSTED BY: Piotr Wendykier

Everything will work when you call First on the result of Import before passing it to other functions. XLSX Import returns the list of objects.

POSTED BY: Piotr Wendykier
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard