Last active
July 20, 2021 03:56
-
-
Save grigory93/064f2a7183a2987893dce398a013d980 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from datetime import date | |
import datatable as dt | |
dt.Frame([dt.Type.date32.min, date(2021, 7, 20), dt.Type.date32.max], stype='date32') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DT = dt.Frame([1, 1000, 100000], stype='date32') | |
DT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DT = dt.Frame({"Date": ["2021-05-24", "2021-05-26", "2021-05-27"]}, stype='date32') | |
DT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DT = dt.Frame({"Date": ["2021-05-24", "2021-05-26", "2021-05-27"]}) | |
DT[0] = dt.Type.date32 | |
DT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DT = dt.Frame({"Date": ["05/24/2021", "05/26/2021", "05/27/2021"]}, stype='date32') | |
DT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DT = dt.Frame({"Date": ["05/24/2021", "05/26/2021", "05/27/2021"]}) | |
DT[:, dt.update(Date = | |
dt.time.ymd(dt.as_type(dt.str.slice(dt.f.Date, 6, 10), int), | |
dt.as_type(dt.str.slice(dt.f.Date, 0, 2), int), | |
dt.as_type(dt.str.slice(dt.f.Date, 3, 5), int)))] | |
DT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from datetime import datetime | |
dt.Frame([dt.Type.time64.min, datetime(2021, 7, 20, 1, 32, 52, 125555), dt.Type.time64.max]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DT = dt.Frame(Time = ["2018-01-31 03:16:57", "2021-06-15 15:44:23.951", "1965-11-25 19:29:00"]) | |
DT[0] = dt.Type.time64 | |
DT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from datatable import f | |
DT = dt.Frame(Y=[2001, 2003, 2005, 2020, 1960], | |
M=[1, 5, 4, 11, 8], | |
D=[12, 18, 30, 1, 14], | |
h=[7, 14, 22, 23, 12], | |
m=[15, 30, 0, 59, 0], | |
s=[12, 23, 0, 59, 27], | |
ns=[0, 0, 0, 999999000, 123000]) | |
DT[:, dt.update(Time = dt.time.ymdt(f.Y, f.M, f.D, f.h, f.m, f.s, f.ns))] | |
DT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DT[dt.time.year(f.Time) < 2000, :] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment