Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #16552

Re: hold question

From Bob Hanlon <hanlonr357@gmail.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: hold question
Date 2014-02-11 07:31 +0000
Message-ID <ldcjkk$q5g$1@smc.vnet.net> (permalink)
References <20140210080107.939DE6A07@smc.vnet.net>
Organization Time-Warner Telecom

Show all headers | View raw


Dates in an imported spreadsheet import as a DateList.


Importing first sheet:


data = Import[
  "/Users/hanlonr/Desktop/Workbook1.xlsx",
  {"Data", 1}]


{{"Date", "Col 2", "Col 3"}, {{2014, 2, 1, 0, 0, 0.}, "a",
  12.}, {{2014, 2, 2, 0, 0, 0.}, "b", 35.}, {{2014, 2, 3, 0, 0, 0.}, "c",
  26.}, {{2014, 2, 4, 0, 0, 0.}, "a", 17.}, {{2014, 2, 5, 0, 0, 0.}, "b",
  19.}}


Convert DateList to DateString:


data /. d : {__?NumberQ} ->
   DateString[d,
    {"Month", "/", "Day", "/", "Year"}] //
 Quiet


{{"Date", "Col 2", "Col 3"}, {"02/01/2014", "a", 12.}, {"02/02/2014", "b",
  35.}, {"02/03/2014", "c", 26.}, {"02/04/2014", "a", 17.}, {"02/05/2014",
  "b", 19.}}



Bob Hanlon




On Mon, Feb 10, 2014 at 3:01 AM, Francisco Gutierrez <fgutiers2002@yahoo.com
> wrote:

> Dear Group:
>
> Manipulating and importing/exporting dates is always a pain in the neck,
> in any of the languages I am aware of.
> Mathematica has functions to work around many of these issues, and I was
> actually able to complete the task
> I was involved in, but even then there is an issue I obviously do not
> understand.
>
> Say I have this date in an Excel sheet: 01/08/2007. I import in into
> Mathematica.  I want to prevent it from becoming an arithmetical
> expression, so
> I sorround it by Unevaluated, HoldAll, and other hold-like devices, but I
> do not obtain the desired result. The date becomes a division.
> For example, the output of HoldComplete[2+2] is  HoldComplete[2+2] , but
> instead the output of HoldComplete[ 01/08/2007]
> is HoldComplete[1/(8x 2007)].
>
> What I am overlooking?
> (Mathematica 9.0)
>

Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar


Thread

Re: hold question Bob Hanlon <hanlonr357@gmail.com> - 2014-02-11 07:31 +0000

csiph-web