Re: hold question
- To: mathgroup at smc.vnet.net
- Subject: [mg132334] Re: hold question
- From: Bob Hanlon <hanlonr357 at gmail.com>
- Date: Tue, 11 Feb 2014 02:58:22 -0500 (EST)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- Delivered-to: l-mathgroup@wolfram.com
- Delivered-to: mathgroup-outx@smc.vnet.net
- Delivered-to: mathgroup-newsendx@smc.vnet.net
- References: <20140210080107.939DE6A07@smc.vnet.net>
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 at 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)
>
- References:
- hold question
- From: Francisco Gutierrez <fgutiers2002@yahoo.com>
- hold question