Problem to Import Dates with ImportASCII()

newbie83
2009-10-27
2012-11-18
  • newbie83

    newbie83 - 2009-10-27

    Hello,
    now i have the next problem. I wrote a script which imports some data from a *.txt file in a table from SciDavis.
    My problem is, that the first column of the textfile is a date (e.g. "2009-10-21 12:42:30.924"). A whole row looks like this:
    "2009-10-21 12:42:30.924,50.315498352051,NULL,NULL,0,0". Each column is seperated by ",".
    When i import this with "importASCII()" the default type of a column in the table is numeric. But i need the first column as "Date and Time" and the others as "numeric". 
    Can someone help me please?

    best regards

     
  • Knut Franke

    Knut Franke - 2009-10-27

    The way to do this is to set the correct format for the first column before importing. You can do this either by hand or using something like:

        t = newTable("YourTable", 6, 1)
        t.column(0).setColumnMode("DateTime")
        # import data as before
        t.importASCII('your/data.txt', ',', 0, False, False, False, True)

    Cheers, Knut

     
  • newbie83

    newbie83 - 2009-10-27

    Thanks,
    it works.

    best regards

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks