Java Code Examples for tech.tablesaw.api.Table#print()

The following examples show how to use tech.tablesaw.api.Table#print() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DataFramePrinterTest.java    From tablesaw with Apache License 2.0 6 votes vote down vote up
@Test
public void printWithLargeFloatNumber() {
  FloatColumn col = FloatColumn.create("testCol");
  col.append(33.333333333333328f);
  col.append(900719925474f);
  col.append(9007199254.1f);
  col.append(90071992.11f);
  col.append(90071.11f);
  Table table = Table.create("large float table", col);
  String out = table.print();
  assertTrue(out.contains("33.33333206176758"));
  assertTrue(out.contains("900719902720"));
  assertTrue(out.contains("9007199232"));
  assertTrue(out.contains("90071992"));
  assertTrue(out.contains("90071.109375"));
}
 
Example 2
Source File: DataFramePrinterTest.java    From tablesaw with Apache License 2.0 6 votes vote down vote up
@Test
public void printWithLargeFloatNumber() {
  FloatColumn col = FloatColumn.create("testCol");
  col.append(33.333333333333328f);
  col.append(900719925474f);
  col.append(9007199254.1f);
  col.append(90071992.11f);
  col.append(90071.11f);
  Table table = Table.create("large float table", col);
  String out = table.print();
  assertTrue(out.contains("33.33333206176758"));
  assertTrue(out.contains("900719902720"));
  assertTrue(out.contains("9007199232"));
  assertTrue(out.contains("90071992"));
  assertTrue(out.contains("90071.109375"));
}
 
Example 3
Source File: DataFramePrinterTest.java    From tablesaw with Apache License 2.0 5 votes vote down vote up
@Test
public void printNull() {
  DoubleColumn col = DoubleColumn.create("testCol");
  col.append(5.0);
  col.appendCell(null);
  col.append(3.0);
  Table table = Table.create("nullCellTable", col);
  String out = table.print();
  assertTrue(out.contains("          "));
}
 
Example 4
Source File: DataFramePrinterTest.java    From tablesaw with Apache License 2.0 5 votes vote down vote up
@Test
public void printOneRow() throws IOException {
  Table table = Table.read().csv("../data/bush.csv");
  String out = table.print(1);
  assertTrue(out.contains("2004-02-04"));
  assertTrue(out.contains("53"));
  assertTrue(out.contains("fox"));
}
 
Example 5
Source File: DataFramePrinterTest.java    From tablesaw with Apache License 2.0 5 votes vote down vote up
@Test
public void printWithSmallDoubleNumber() {
  DoubleColumn col = DoubleColumn.create("testCol");
  col.append(0.000003);
  Table table = Table.create("small decimal table", col);
  String out = table.print();
  assertTrue(out.contains("0.000003"));
}
 
Example 6
Source File: DataFramePrinterTest.java    From tablesaw with Apache License 2.0 5 votes vote down vote up
@Test
public void printWithSmallFloatNumber() {
  FloatColumn col = FloatColumn.create("testCol");
  col.append(0.000003f);
  Table table = Table.create("small float table", col);
  String out = table.print();
  assertTrue(out.contains("0.000003"));
}
 
Example 7
Source File: DataFramePrinterTest.java    From tablesaw with Apache License 2.0 5 votes vote down vote up
@Test
public void printWithExponent() {
  DoubleColumn col = DoubleColumn.create("testCol");
  col.append(0.000003);
  col.append(123.000003);
  col.setPrintFormatter(NumberColumnFormatter.standard());
  Table table = Table.create("small float table", col);
  String out = table.print();
  assertTrue(out.contains("3.0E-6"));
  assertTrue(out.contains("123.000003"));
}
 
Example 8
Source File: DataFramePrinterTest.java    From tablesaw with Apache License 2.0 5 votes vote down vote up
@Test
public void printWithLargeDoubleNumber() {
  DoubleColumn col = DoubleColumn.create("testCol");
  col.append(33.333333333333328);
  col.append(9007199254740992d);
  col.append(900719925474099.1d);
  col.append(90071992547409.11d);
  Table table = Table.create("large float table", col);
  String out = table.print();
  assertTrue(out.contains("33.3333333333333"));
  assertTrue(out.contains("9007199254740992"));
  assertTrue(out.contains("900719925474099.1"));
  assertTrue(out.contains("90071992547409.11"));
}
 
Example 9
Source File: DataFramePrinterTest.java    From tablesaw with Apache License 2.0 5 votes vote down vote up
@Test
public void printNull() {
  DoubleColumn col = DoubleColumn.create("testCol");
  col.append(5.0);
  col.appendCell(null);
  col.append(3.0);
  Table table = Table.create("nullCellTable", col);
  String out = table.print();
  assertTrue(out.contains("          "));
}
 
Example 10
Source File: DataFramePrinterTest.java    From tablesaw with Apache License 2.0 5 votes vote down vote up
@Test
public void printOneRow() throws IOException {
  Table table = Table.read().csv("../data/bush.csv");
  String out = table.print(1);
  assertTrue(out.contains("2004-02-04"));
  assertTrue(out.contains("53"));
  assertTrue(out.contains("fox"));
}
 
Example 11
Source File: DataFramePrinterTest.java    From tablesaw with Apache License 2.0 5 votes vote down vote up
@Test
public void printWithSmallDoubleNumber() {
  DoubleColumn col = DoubleColumn.create("testCol");
  col.append(0.000003);
  Table table = Table.create("small decimal table", col);
  String out = table.print();
  assertTrue(out.contains("0.000003"));
}
 
Example 12
Source File: DataFramePrinterTest.java    From tablesaw with Apache License 2.0 5 votes vote down vote up
@Test
public void printWithSmallFloatNumber() {
  FloatColumn col = FloatColumn.create("testCol");
  col.append(0.000003f);
  Table table = Table.create("small float table", col);
  String out = table.print();
  assertTrue(out.contains("0.000003"));
}
 
Example 13
Source File: DataFramePrinterTest.java    From tablesaw with Apache License 2.0 5 votes vote down vote up
@Test
public void printWithExponent() {
  DoubleColumn col = DoubleColumn.create("testCol");
  col.append(0.000003);
  col.append(123.000003);
  col.setPrintFormatter(NumberColumnFormatter.standard());
  Table table = Table.create("small float table", col);
  String out = table.print();
  assertTrue(out.contains("3.0E-6"));
  assertTrue(out.contains("123.000003"));
}
 
Example 14
Source File: DataFramePrinterTest.java    From tablesaw with Apache License 2.0 5 votes vote down vote up
@Test
public void printWithLargeDoubleNumber() {
  DoubleColumn col = DoubleColumn.create("testCol");
  col.append(33.333333333333328);
  col.append(9007199254740992d);
  col.append(900719925474099.1d);
  col.append(90071992547409.11d);
  Table table = Table.create("large float table", col);
  String out = table.print();
  assertTrue(out.contains("33.3333333333333"));
  assertTrue(out.contains("9007199254740992"));
  assertTrue(out.contains("900719925474099.1"));
  assertTrue(out.contains("90071992547409.11"));
}