BoxFrame Static Methods
BoxFrame is a static namespace - it contains only static methods for creating DataFrames, Series, and performing data operations. You never instantiate BoxFrame. Instead, use it as a factory and utility namespace.
DataFrame Creation
BoxFrame.DataFrame(data: DataFrameInput, options?)- Create DataFrameBoxFrame.fromRecord(data: Record<string, ColumnData>, options?)- Create from recordBoxFrame.fromObjects(objects: RowData[], options?)- Create from array of objects
Series Creation
BoxFrame.Series(data: DataValue[], options?)- Create SeriesBoxFrame.fromArray(data: DataValue[], options?)- Create Series from array
Data I/O
BoxFrame provides methods for reading data from various sources. For exporting data, use the DataFrame instance methods toCsv() and toJSON(), then write to files using standard file I/O.
Note: Direct file writing methods (e.g., writeCsv(), writeJson()) are under consideration for future releases. For now, use the export methods combined with standard file I/O libraries.
Reading Data
BoxFrame.readCsv(pathOrUrl: string, options?)- Read CSV file or URLBoxFrame.parseCsv(content: string, options?)- Parse CSV stringBoxFrame.readJson(pathOrUrl: string, options?)- Read JSON fileBoxFrame.readGoogleSheet(spreadsheetId: string, sheetName?, options?)- Read Google SheetsBoxFrame.readGoogleSheetFromUrl(url: string, sheetName?, options?)- Read Google Sheets from URL
Exporting Data
Use DataFrame instance methods:
df.toCsv(options?)- Convert to CSV string (see DataFrame API)df.toJSON()- Convert to JSON object (see DataFrame API)
Example:
// Read data
const df = await BoxFrame.readCsv("data.csv");
// Export to CSV string
const csv = df.toCsv();
await Deno.writeTextFile("output.csv", csv);
// Export to JSON
const json = df.toJSON();
await Deno.writeTextFile("output.json", JSON.stringify(json, null, 2));
Data Manipulation
BoxFrame.concat(dataFrames: DataFrame[], axis?, options?)- Concatenate DataFramesBoxFrame.merge(left: DataFrame, right: DataFrame, options?)- SQL-style joinsBoxFrame.toNumeric(data: Series | DataValue[])- Convert to numericBoxFrame.toDatetime(data: Series | DataValue[])- Convert to datetimeBoxFrame.cut(data: Series, bins: number | number[], labels?)- Cut into binsBoxFrame.dateRange(options?)- Generate date range
See Merging & Joins for detailed documentation on concat() and merge() operations.