description |
---|
This section describes all user configurable options available on DataFrame/Series creation. |
On DataFrame/Series creation, a config object can be passed along to configure some internal properties of the created object. The following list shows what options are available and what they do.
Parameter | Description |
---|---|
tableDisplayConfig | Object, General table display options. Because we use the table package under the hood to display a table in the console, all table display configurations are supported. |
tableMaxRow | Number, the total number of rows to display in the console when the print function is called. Defaults to 10 |
dtypeTestLim | Number, the total number of values to test when inferring data type. Defaults to 20 |
lowMemoryMode | Boolean, whether to use minimal memory space or not. Defaults to false. |
See an example of creating DataFrame in low memory mode
const data = {
"Name": ["Apples", "Mango", "Banana", "Pear"],
"Count": [21, 5, 30, 10],
"Price": [200, 300, 40, 250]
};
const df = new DataFrame(data, {
config: {
tableDisplayConfig: {
header: {
alignment: 'center',
content: 'THE HEADER\nThis is the table about something',
},
},
}
});
df.print()
╔════════════════════════════════════════════════════════════════════════╗
║ THE HEADER ║
║ This is the table about something ║
╟────────────┬───────────────────┬───────────────────┬───────────────────╢
║ │ Name │ Count │ Price ║
╟────────────┼───────────────────┼───────────────────┼───────────────────╢
║ 0 │ Apples │ 21 │ 200 ║
╟────────────┼───────────────────┼───────────────────┼───────────────────╢
║ 1 │ Mango │ 5 │ 300 ║
╟────────────┼───────────────────┼───────────────────┼───────────────────╢
║ 2 │ Banana │ 30 │ 40 ║
╟────────────┼───────────────────┼───────────────────┼───────────────────╢
║ 3 │ Pear │ 10 │ 250 ║
╚════════════╧═══════════════════╧═══════════════════╧═══════════════════╝
const data = {
"Name": ["Apples", "Mango", "Banana", "Pear"],
"Count": [21, 5, 30, 10],
"Price": [200, 300, 40, 250]
};
const df = new DataFrame(data, {
config: {
tableDisplayConfig: {
header: {
alignment: 'center',
content: 'THE HEADER\nThis is the table about something',
},
columns: [
{ alignment: 'left' },
{ alignment: 'center', width: 20 },
{ alignment: 'right' },
{ alignment: 'justify' }
],
},
}
});
df.print()
╔══════════════════════════════════════════╗
║ THE HEADER ║
║ This is the table about something ║
╟───┬──────────────────────┬───────┬───────╢
║ │ Name │ Count │ Price ║
╟───┼──────────────────────┼───────┼───────╢
║ 0 │ Apples │ 21 │ 200 ║
╟───┼──────────────────────┼───────┼───────╢
║ 1 │ Mango │ 5 │ 300 ║
╟───┼──────────────────────┼───────┼───────╢
║ 2 │ Banana │ 30 │ 40 ║
╟───┼──────────────────────┼───────┼───────╢
║ 3 │ Pear │ 10 │ 250 ║
╚═══╧══════════════════════╧═══════╧═══════╝
const data = {
"Name": ["Apples", "Mango", "Banana", "Pear"],
"Count": [21, 5, 30, 10],
"Price": [200, 300, 40, 250],
};
const df = new DataFrame(data, {
config: {
tableMaxColInConsole: 6,
tableMaxRow: 1
}
});
df.print()
╔════════════╤═══════════════════╤═══════════════════╤═══════════════════╗
║ │ Name │ Count │ Price ║
╟────────────┼───────────────────┼───────────────────┼───────────────────╢
║ 0 │ Apples │ 21 │ 200 ║
╚════════════╧═══════════════════╧═══════════════════╧═══════════════════╝