use of tech.tablesaw.api.DateTimeColumn in project symja_android_library by axkr.
the class DateMapFunctions method atTime.
/**
* Returns a DateTime column where each value consists of the dates from this column combined with
* the corresponding times from the other column
*/
default DateTimeColumn atTime(TimeColumn timeColumn) {
DateTimeColumn newColumn = DateTimeColumn.create(this.name() + " " + timeColumn.name());
for (int r = 0; r < this.size(); r++) {
int c1 = this.getIntInternal(r);
int c2 = timeColumn.getIntInternal(r);
if (valueIsMissing(c1) || valueIsMissing(c2)) {
newColumn.appendMissing();
} else {
newColumn.appendInternal(PackedLocalDateTime.create(c1, c2));
}
}
return newColumn;
}
use of tech.tablesaw.api.DateTimeColumn in project symja_android_library by axkr.
the class DateTimeMapFunctions method lead.
@Override
default DateTimeColumn lead(int n) {
DateTimeColumn column = lag(-n);
column.setName(name() + " lead(" + n + ")");
return column;
}
use of tech.tablesaw.api.DateTimeColumn in project symja_android_library by axkr.
the class CsvWriter method writeValues.
private void writeValues(Table table, CsvWriteOptions options, int r, String[] entries, int c) {
DateTimeFormatter dateFormatter = options.dateFormatter();
DateTimeFormatter dateTimeFormatter = options.dateTimeFormatter();
ColumnType columnType = table.column(c).type();
if (dateFormatter != null && columnType.equals(ColumnType.LOCAL_DATE)) {
DateColumn dc = (DateColumn) table.column(c);
entries[c] = options.dateFormatter().format(dc.get(r));
} else if (dateTimeFormatter != null && columnType.equals(ColumnType.LOCAL_DATE_TIME)) {
DateTimeColumn dc = (DateTimeColumn) table.column(c);
entries[c] = options.dateTimeFormatter().format(dc.get(r));
} else {
if (options.usePrintFormatters()) {
entries[c] = table.getString(r, c);
} else {
entries[c] = table.getUnformatted(r, c);
}
}
}
use of tech.tablesaw.api.DateTimeColumn in project symja_android_library by axkr.
the class DateMapFunctions method atTime.
/**
* Returns a DateTime column where each value consists of the dates from this column combined with
* the corresponding times from the other column
*/
default DateTimeColumn atTime(LocalTime time) {
Preconditions.checkNotNull(time);
DateTimeColumn newColumn = DateTimeColumn.create(this.name() + " " + time.toString());
for (int r = 0; r < this.size(); r++) {
int c1 = this.getIntInternal(r);
if (valueIsMissing(c1)) {
newColumn.appendMissing();
} else {
LocalDate value1 = PackedLocalDate.asLocalDate(c1);
newColumn.appendInternal(PackedLocalDateTime.pack(value1, time));
}
}
return newColumn;
}
Aggregations