@@ -47,7 +47,7 @@ export default class Series extends BaseSeries implements ExtendedSeriesInterfac
47
47
}
48
48
49
49
/**
50
- * Converts a DataFrame to CSV.
50
+ * Converts a Series to CSV.
51
51
* @param options Configuration object. Supports the following options:
52
52
* - `filePath`: Local file path to write the CSV file. If not specified, the CSV will be returned as a string. Option is only available in NodeJS.
53
53
* - `fileName`: Name of the CSV file. Defaults to `data.csv`. Option is only available in Browser.
@@ -57,48 +57,27 @@ export default class Series extends BaseSeries implements ExtendedSeriesInterfac
57
57
*
58
58
* @example
59
59
* ```
60
- * const df = new DataFrame([[ 1, 2], [ 3, 4]], { columns: ['A', 'B']} )
60
+ * const df = new Series([ 1, 2, 3, 4])
61
61
* const csv = df.toCSV()
62
- * console.log(csv)
63
- * //output
64
- * "A","B"
65
- * 1,2
66
- * 3,4
67
62
* ```
68
63
*
69
64
* @example
70
65
* ```
71
- * const df = new DataFrame([[ 1, 2], [ 3, 4]], { columns: ['A', 'B']} )
66
+ * const df = new Series([ 1, 2, 3, 4])
72
67
* const csv = df.toCSV({ header: false })
73
- * console.log(csv)
74
- * //output
75
- * 1,2
76
- * 3,4
77
68
* ```
78
69
*
79
70
* @example
80
71
* ```
81
- * const df = new DataFrame([[ 1, 2], [ 3, 4]], { columns: ['A', 'B']} )
72
+ * const df = new Series([ 1, 2, 3, 4])
82
73
* const csv = df.toCSV({ sep: ';' })
83
- * console.log(csv)
84
- * //output
85
- * "A";"B"
86
- * 1;2
87
- * 3;4
88
74
* ```
89
75
*
90
76
* @example
91
77
* ```
92
- * const df = new DataFrame([[ 1, 2], [ 3, 4]], { columns: ['A', 'B']} )
78
+ * const df = new Series([ 1, 2, 3, 4])
93
79
* df.toCSV({ filePath: './data.csv' }) //write to local file in NodeJS
94
80
* ```
95
- *
96
- * @example
97
- * ```
98
- * const df = new DataFrame([[1, 2], [3, 4]], { columns: ['A', 'B']})
99
- * df.toCSV({ fileName: 'data.csv', download: true }) //Downloads file in Browser
100
- * ```
101
- *
102
81
*/
103
82
toCSV ( options ?: CsvOutputOptionsNode ) : string
104
83
toCSV ( options ?: CsvOutputOptionsNode ) : string | void {
@@ -107,7 +86,7 @@ export default class Series extends BaseSeries implements ExtendedSeriesInterfac
107
86
}
108
87
109
88
/**
110
- * Converts a DataFrame to JSON.
89
+ * Converts a Series to JSON.
111
90
* @param options Configuration object. Supported options:
112
91
* - `filePath`: The file path to write the JSON to. If not specified, the JSON object is returned. Option is only available in NodeJS.
113
92
* - `fileName`: The name of the JSON file. Defaults to `data.json`. Option is only available in Browser.
@@ -116,39 +95,27 @@ export default class Series extends BaseSeries implements ExtendedSeriesInterfac
116
95
*
117
96
* @example
118
97
* ```
119
- * const df = new DataFrame([[ 1, 2], [ 3, 4]], { columns: ['A', 'B']} )
98
+ * const df = new Series([ 1, 2, 3, 4])
120
99
* const json = df.toJSON()
121
100
* ```
122
101
*
123
102
* @example
124
103
* ```
125
- * const df = new DataFrame([[ 1, 2], [ 3, 4]], { columns: ['A', 'B']} )
104
+ * const df = new Series([ 1, 2, 3, 4])
126
105
* const json = df.toJSON({ format: 'row' })
127
- * console.log(json)
128
- * //output
129
- * [{"A":1,"B":2},{"A":3,"B":4}]
130
106
* ```
131
107
*
132
108
* @example
133
109
* ```
134
- * const df = new DataFrame([[ 1, 2], [ 3, 4]], { columns: ['A', 'B']} )
110
+ * const df = new Series([ 1, 2, 3, 4])
135
111
* const json = df.toJSON({ format: "column" })
136
- * console.log(json)
137
- * //output
138
- * {"A":[1,3],"B":[2,4]}
139
112
* ```
140
113
*
141
114
* @example
142
115
* ```
143
- * const df = new DataFrame([[ 1, 2], [ 3, 4]], { columns: ['A', 'B']} )
116
+ * const df = new Series([ 1, 2, 3, 4])
144
117
* df.toJSON({ filePath: './data.json' }) // downloads to local file system as data.json in NodeJS
145
118
* ```
146
- *
147
- * @example
148
- * ```
149
- * const df = new DataFrame([[1, 2], [3, 4]], { columns: ['A', 'B']})
150
- * df.toJSON({ fileName: 'data.json', download: true }) // downloads file browser
151
- * ```
152
119
*/
153
120
toJSON ( options ?: JsonOutputOptionsNode ) : object
154
121
toJSON ( options ?: JsonOutputOptionsNode ) : object | void {
@@ -157,27 +124,21 @@ export default class Series extends BaseSeries implements ExtendedSeriesInterfac
157
124
158
125
159
126
/**
160
- * Converts a DataFrame to Excel file format.
127
+ * Converts a Series to Excel file format.
161
128
* @param options Configuration object. Supported options:
162
129
* - `sheetName`: The sheet name to be written to. Defaults to `'Sheet1'`.
163
130
* - `filePath`: The filePath to be written to. Defaults to `'./output.xlsx'`. Option is only available in NodeJs
164
131
* - `fileName`: The fileName to be written to. Defaults to `'output.xlsx'`. Option is only available in Browser
165
132
*
166
133
* @example
167
134
* ```
168
- * const df = new DataFrame([[ 1, 2], [ 3, 4]], { columns: ['A', 'B']} )
135
+ * const df = new Series([ 1, 2, 3, 4])
169
136
* df.toExcel({ filePath: './output.xlsx' }) // writes to local file system as output.xlsx in NodeJS
170
137
* ```
171
138
*
172
139
* @example
173
140
* ```
174
- * const df = new DataFrame([[1, 2], [3, 4]], { columns: ['A', 'B']})
175
- * df.toExcel({ fileName: 'output.xlsx', download: true }) // downloads file browser
176
- * ```
177
- *
178
- * @example
179
- * ```
180
- * const df = new DataFrame([[1, 2], [3, 4]], { columns: ['A', 'B']})
141
+ * const df = new Series([1, 2, 3, 4])
181
142
* df.toExcel({ sheetName: 'Sheet2' }) // writes to Sheet2 in Excel
182
143
* ```
183
144
*
0 commit comments