Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2001
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*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 smc.vnet.net
  • Subject: [mg30592] Re: [mg30558] Import numbers and dates
  • From: Tomas Garza <tgarza01 at prodigy.net.mx>
  • Date: Thu, 30 Aug 2001 03:51:40 -0400 (EDT)
  • References: <200108290540.BAA04928@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

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).
In[1]:=
data = ReadList["martin.txt", Word]
Out[1]=
{"07-01-85", "101.101897", "07-01-85", "101.101897"}
In[2]:=
par = Transpose[Partition[data, 2]]
Out[2]=
{{"07-01-85", "07-01-85"}, {"101.101897", "101.101897"}}
In[3]:=
StringLength[par[[1,1]]]
Out[3]=
11
In[4]:=
Flatten[Transpose[{(StringTake[#1, 8] & ) /@ par[[1]],
    ToExpression /@ par[[2]]}]]
Out[4]=
{"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" <mrMICE.fi at cbs.dk>
To: mathgroup at smc.vnet.net
Subject: [mg30592] [mg30558] Import numbers and dates


> Hi
>
> I want to import some data which consists 3862 lines, each lines looks
like
> 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 :-)
>
> TIA
> 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