| 41 | * @param options.config General configuration object for extending or setting Series behavior. |
| 42 | */ |
| 43 | export default class Series extends BaseSeries implements ExtendedSeriesInterface { |
| 44 | [key: string]: any |
| 45 | constructor(data?: any, options: BaseDataOptionType = {}) { |
| 46 | super(data, options) |
| 47 | } |
| 48 | |
| 49 | /** |
| 50 | * Converts a Series to CSV. |
| 51 | * @param options Configuration object. Supports the following options: |
| 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 | * - `fileName`: Name of the CSV file. Defaults to `data.csv`. Option is only available in Browser. |
| 54 | * - `download`: If true, the CSV will be downloaded. Defaults to false. Option is only available in Browser. |
| 55 | * - `header`: Boolean indicating whether to include a header row in the CSV file. |
| 56 | * - `sep`: Character to be used as a separator in the CSV file. |
| 57 | * |
| 58 | * @example |
| 59 | * ``` |
| 60 | * const df = new Series([1, 2, 3, 4]) |
| 61 | * const csv = df.toCSV() |
| 62 | * ``` |
| 63 | * |
| 64 | * @example |
| 65 | * ``` |
| 66 | * const df = new Series([1, 2, 3, 4]) |
| 67 | * const csv = df.toCSV({ header: false }) |
| 68 | * ``` |
| 69 | * |
| 70 | * @example |
| 71 | * ``` |
| 72 | * const df = new Series([1, 2, 3, 4]) |
| 73 | * const csv = df.toCSV({ sep: ';' }) |
| 74 | * ``` |
| 75 | * |
| 76 | * @example |
| 77 | * ``` |
| 78 | * const df = new Series([1, 2, 3, 4]) |
| 79 | * df.toCSV({ filePath: './data.csv' }) //write to local file in NodeJS |
| 80 | * ``` |
| 81 | */ |
| 82 | toCSV(options?: CsvOutputOptionsNode): string |
| 83 | toCSV(options?: CsvOutputOptionsNode): string | void { |
| 84 | return toCSVNode(this, options as CsvOutputOptionsNode) |
| 85 | |
| 86 | } |
| 87 | |
| 88 | /** |
| 89 | * Converts a Series to JSON. |
| 90 | * @param options Configuration object. Supported options: |
| 91 | * - `filePath`: The file path to write the JSON to. If not specified, the JSON object is returned. Option is only available in NodeJS. |
| 92 | * - `fileName`: The name of the JSON file. Defaults to `data.json`. Option is only available in Browser. |
| 93 | * - `download`: If true, the JSON will be downloaded. Defaults to false. Option is only available in Browser. |
| 94 | * - `format`: The format of the JSON. Supported values are `'column'` and `'row'`. Defaults to `'column'`. |
| 95 | * |
| 96 | * @example |
| 97 | * ``` |
| 98 | * const df = new Series([1, 2, 3, 4]) |
| 99 | * const json = df.toJSON() |
| 100 | * ``` |
nothing calls this directly
no outgoing calls
no test coverage detected