Configuration Options
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 10
lowMemoryMode
Boolean, whether to use minimal memory or not. Defaults to false. Note: There's a slight decrease in speed when low memory mode is set to true.
See an example of creating DataFrame in low memory mode

Examples of setting configs

Add a DataFrame header

1
const data = {
2
"Name": ["Apples", "Mango", "Banana", "Pear"],
3
"Count": [21, 5, 30, 10],
4
"Price": [200, 300, 40, 250]
5
};
6
const df = new DataFrame(data, {
7
config: {
8
tableDisplayConfig: {
9
header: {
10
alignment: 'center',
11
content: 'THE HEADER\nThis is the table about something',
12
},
13
},
14
}
15
});
16
df.print()
Copied!
1
╔════════════════════════════════════════════════════════════════════════╗
2
THE HEADER
3
║ This is the table about something ║
4
╟────────────┬───────────────────┬───────────────────┬───────────────────╢
5
║ │ Name │ Count │ Price ║
6
╟────────────┼───────────────────┼───────────────────┼───────────────────╢
7
0 │ Apples │ 21200
8
╟────────────┼───────────────────┼───────────────────┼───────────────────╢
9
1 │ Mango │ 5300
10
╟────────────┼───────────────────┼───────────────────┼───────────────────╢
11
2 │ Banana │ 3040
12
╟────────────┼───────────────────┼───────────────────┼───────────────────╢
13
3 │ Pear │ 10250
14
╚════════════╧═══════════════════╧═══════════════════╧═══════════════════╝
Copied!

Configure column size and display format of DataFrame

1
const data = {
2
"Name": ["Apples", "Mango", "Banana", "Pear"],
3
"Count": [21, 5, 30, 10],
4
"Price": [200, 300, 40, 250]
5
};
6
const df = new DataFrame(data, {
7
config: {
8
tableDisplayConfig: {
9
header: {
10
alignment: 'center',
11
content: 'THE HEADER\nThis is the table about something',
12
},
13
columns: [
14
{ alignment: 'left' },
15
{ alignment: 'center', width: 20 },
16
{ alignment: 'right' },
17
{ alignment: 'justify' }
18
],
19
},
20
}
21
});
22
df.print()
Copied!
1
╔══════════════════════════════════════════╗
2
THE HEADER
3
║ This is the table about something ║
4
╟───┬──────────────────────┬───────┬───────╢
5
║ │ Name │ Count │ Price ║
6
╟───┼──────────────────────┼───────┼───────╢
7
0 │ Apples │ 21200
8
╟───┼──────────────────────┼───────┼───────╢
9
1 │ Mango │ 5300
10
╟───┼──────────────────────┼───────┼───────╢
11
2 │ Banana │ 3040
12
╟───┼──────────────────────┼───────┼───────╢
13
3 │ Pear │ 10250
14
╚═══╧══════════════════════╧═══════╧═══════╝
Copied!

Configure the number of rows displayed when print is called

1
const data = {
2
"Name": ["Apples", "Mango", "Banana", "Pear"],
3
"Count": [21, 5, 30, 10],
4
"Price": [200, 300, 40, 250],
5
6
};
7
const df = new DataFrame(data, {
8
config: {
9
tableMaxColInConsole: 6,
10
tableMaxRow: 1
11
}
12
});
13
df.print()
Copied!
1
╔════════════╤═══════════════════╤═══════════════════╤═══════════════════╗
2
║ │ Name │ Count │ Price ║
3
╟────────────┼───────────────────┼───────────────────┼───────────────────╢
4
║ 0 │ Apples │ 21 │ 200 ║
5
╚════════════╧═══════════════════╧═══════════════════╧═══════════════════╝
Copied!
Last modified 24d ago