io

package
v0.9.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 8, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadCSV

func LoadCSV(filename string, options CSVOptions) (types.Matrix, []string, error)

LoadCSV reads a CSV file into a Matrix

func ReadCSV

func ReadCSV(r io.Reader, options CSVOptions) (types.Matrix, []string, error)

ReadCSV reads CSV data from an io.Reader

func SaveCSV

func SaveCSV(filename string, data types.Matrix, headers []string, options CSVOptions) error

SaveCSV writes a Matrix to a CSV file

func WriteCSV

func WriteCSV(w io.Writer, data types.Matrix, headers []string, options CSVOptions) error

WriteCSV writes Matrix data to an io.Writer

Types

type CSVOptions

type CSVOptions struct {
	Delimiter     rune
	HasHeader     bool
	SkipRows      int
	MaxRows       int      // 0 for unlimited
	Columns       []int    // Specific columns to read, empty for all
	NullValues    []string // Strings to treat as NaN
	StreamingMode bool     // For large files
}

CSVOptions contains configuration for CSV reading/writing

func DefaultCSVOptions

func DefaultCSVOptions() CSVOptions

DefaultCSVOptions returns default CSV options

type DataInfo

type DataInfo struct {
	Rows         int
	Columns      int
	Headers      []string
	HasMissing   bool
	MissingCount int
	DataTypes    []string // inferred types per column
}

DataInfo provides information about a dataset

func InspectCSV

func InspectCSV(filename string, options CSVOptions) (*DataInfo, error)

InspectCSV provides information about a CSV file without loading all data

type StreamingReader

type StreamingReader struct {
	// contains filtered or unexported fields
}

StreamingReader provides memory-efficient reading of large CSV files

func NewStreamingReader

func NewStreamingReader(filename string, options CSVOptions) (*StreamingReader, error)

NewStreamingReader creates a new streaming CSV reader

func (*StreamingReader) Close

func (sr *StreamingReader) Close() error

Close closes the underlying file

func (*StreamingReader) Headers

func (sr *StreamingReader) Headers() []string

Headers returns the column headers if available

func (*StreamingReader) Next

func (sr *StreamingReader) Next() ([]float64, error)

Next reads the next row from the CSV file

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL