numcsv: github.com/btracey/numcsv Index | Files | Directories

package numcsv

import "github.com/btracey/numcsv"

Index

Package Files

numcsv.go

Variables

var (
    ErrTrailingComma = errors.New("extra delimeter at end of line")
    ErrFieldCount    = errors.New("wrong number of fields in line")
)

type Reader Uses

type Reader struct {
    Comma        string // field delimiter (set to ',' by NewReader)
    HeadingComma string // delimiter for the headings. If "", set to the same value as Comma
    // AllowEndingComma bool   // Allows there to be a single comma at the end of the field
    Comment         string // comment character for start of line
    FieldsPerRecord int    // If preset, the number of expected fields. Set otherwise
    NoHeading       bool
    // contains filtered or unexported fields
}

func NewReader Uses

func NewReader(r io.Reader) *Reader

func (*Reader) Read Uses

func (r *Reader) Read() ([]float64, error)

Read reads a single record from the CSV. ReadHeading must be called first if there are headings. Returns nil if EOF reached.

func (*Reader) ReadAll Uses

func (r *Reader) ReadAll() (*mat64.Dense, error)

ReadAll reads all of the numeric records from the CSV. ReadHeading must be called first if there are headings

func (*Reader) ReadHeading Uses

func (r *Reader) ReadHeading() (headings []string, err error)

ReadHeading reads the string fields at the start, ignoring quotations if they are there

type Writer Uses

type Writer struct {
    Comma        string
    UseCRLF      bool
    QuoteHeading bool // Put quotes around heading strings
    FloatFmt     byte
    // contains filtered or unexported fields
}

func NewWriter Uses

func NewWriter(w io.Writer) *Writer

func (*Writer) Write Uses

func (w *Writer) Write(record []float64) error

func (*Writer) WriteAll Uses

func (w *Writer) WriteAll(headings []string, data *mat64.Dense) error

func (*Writer) WriteHeading Uses

func (w *Writer) WriteHeading(heading []string) (err error)

Directories

PathSynopsis
gonumcsv

Package numcsv imports 6 packages (graph) and is imported by 4 packages. Updated 2016-07-30. Refresh now. Tools for package owners.