MCPcopy Create free account
hub / github.com/cogentcore/core / OpenCSV

Method OpenCSV

tensor/table/io.go:110–117  ·  view source on GitHub ↗

OpenCSV reads a table from a comma-separated-values (CSV) file (where comma = any delimiter, specified in the delim arg), using the Go standard encoding/csv reader conforming to the official CSV standard. If the table does not currently have any columns, the first row of the file is assumed to be he

(filename core.Filename, delim Delims)

Source from the content-addressed store, hash-verified

108// If the table DOES have existing columns, then those are used robustly
109// for whatever information fits from each row of the file.
110func (dt *Table) OpenCSV(filename core.Filename, delim Delims) error { //types:add
111 fp, err := os.Open(string(filename))
112 if err != nil {
113 return errors.Log(err)
114 }
115 defer fp.Close()
116 return dt.ReadCSV(bufio.NewReader(fp), delim)
117}
118
119// OpenFS is the version of [Table.OpenCSV] that uses an [fs.FS] filesystem.
120func (dt *Table) OpenFS(fsys fs.FS, filename string, delim Delims) error {

Callers 8

TestTablePlotEditorFunction · 0.95
AvgCatFunction · 0.95
AvgByColumnFunction · 0.95
TestSimMatFunction · 0.95
TestClustFunction · 0.95
TestPCAIrisFunction · 0.95
TestSVDIrisFunction · 0.95
OpenCSVMethod · 0.45

Implementers 1

_cogentcore_org_core_plot_plots_Tableyaegicore/symbols/cogentcore_org-core-

Calls 4

ReadCSVMethod · 0.95
LogFunction · 0.92
OpenMethod · 0.65
CloseMethod · 0.65

Tested by 5

TestTablePlotEditorFunction · 0.76
TestSimMatFunction · 0.76
TestClustFunction · 0.76
TestPCAIrisFunction · 0.76
TestSVDIrisFunction · 0.76