nxcals.api.extraction.data.builders.DataFrame.show

DataFrame.show(n: int = 20, truncate: Union[bool, int] = True, vertical: bool = False) None

Prints the first n rows to the console.

New in version 1.3.0.

Parameters:
  • n (int, optional) – Number of rows to show.

  • truncate (bool or int, optional) – If set to True, truncate strings longer than 20 chars by default. If set to a number greater than one, truncates long strings to length truncate and align cells right.

  • vertical (bool, optional) – If set to True, print output rows vertically (one line per column value).

Examples

>>> df
DataFrame[age: int, name: string]
>>> df.show()
+---+-----+
|age| name|
+---+-----+
|  2|Alice|
|  5|  Bob|
+---+-----+
>>> df.show(truncate=3)
+---+----+
|age|name|
+---+----+
|  2| Ali|
|  5| Bob|
+---+----+
>>> df.show(vertical=True)
-RECORD 0-----
 age  | 2
 name | Alice
-RECORD 1-----
 age  | 5
 name | Bob