Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2001

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Import numbers and dates

  • To: mathgroup at
  • Subject: [mg30592] Re: [mg30558] Import numbers and dates
  • From: Tomas Garza <tgarza01 at>
  • Date: Thu, 30 Aug 2001 03:51:40 -0400 (EDT)
  • References: <>
  • Sender: owner-wri-mathgroup at

I guess it all depends on what you want to do with your data once yoou have
read them into your notebook. If you want to keep the date part as it is,
i.e., xx-xx-xx, and the number part as such, you may proceed as follows. I'm
taking your example exactly as it is, and paste it in an Excel table with
name"martin.txt" (it is essential that is saved as txt form).
data = ReadList["martin.txt", Word]
{"07-01-85", "101.101897", "07-01-85", "101.101897"}
par = Transpose[Partition[data, 2]]
{{"07-01-85", "07-01-85"}, {"101.101897", "101.101897"}}
Flatten[Transpose[{(StringTake[#1, 8] & ) /@ par[[1]],
    ToExpression /@ par[[2]]}]]
{"07-01-85", 101.101897, "07-01-85", 101.101897}

Then you may work with the numerical  values and leave the dates alone. But
if you wish to use the dates too, you might easily convert them to the
standard {year, month, day}which would then be available to the
Miscellaneous`Calendar` functions.

Tomas Garza
Mexico City
----- Original Message -----
From: "Martin Richter" < at>
To: mathgroup at
Subject: [mg30592] [mg30558] Import numbers and dates

> Hi
> I want to import some data which consists 3862 lines, each lines looks
> this:
> 07-01-85    101.101897  07-01-85    101.101897
> So 1. and 3. rows are dates and should be read that way and 2. and 4. rows
> are real numbers. I have tried something like this:
> data = Import["file.txt", "Table", DateStyle -> European];
> Indeed this is easy in Excel but I would like to use Mathematica 4.1.
> (I properly getting environmental damage :-)
> Martin
> ---------------------------------------
> Please remove PET to reply by email

  • Prev by Date: Re: Mathematica to PDF
  • Next by Date: Re: Delete All Output (bug)
  • Previous by thread: Import numbers and dates
  • Next by thread: Re: Import numbers and dates