Documentation ¶
Index ¶
- Constants
- Variables
- type Col
- type DataFrame
- type DataTable
- func Read(filePath string, opts ...Options) (*DataTable, error)
- func ReadCsv(filePath string, opts ...Options) (*DataTable, error)
- func ReadDat(filePath string, opts ...Options) (dt *DataTable, err error)
- func ReadTxt(filePath string, opts ...Options) (dt *DataTable, err error)
- func ReadXls(filePath string, opts ...Options) (*DataTable, error)
- func ReadXlsx(filePath string, opts ...Options) (*DataTable, error)
- func (dt *DataTable) Contains(str string, sheets ...string) (list []*DataFrame)
- func (dt *DataTable) First(str string, sheets ...string) *DataFrame
- func (dt *DataTable) Foreach(fn dfFunc, sheets ...string)
- func (dt *DataTable) ForeachRow(fn rowFunc, sheets ...string)
- func (dt *DataTable) Get(str string, sheets ...string) (list []*DataFrame)
- func (dt *DataTable) GetCell(row, col int, sheets ...string) *DataFrame
- func (dt *DataTable) GetCellByVal(row, col string, sheets ...string) *DataFrame
- func (dt *DataTable) GetCol(col int, sheets ...string) (c *Col)
- func (dt *DataTable) GetRow(row int, sheets ...string) (r *Row)
- func (dt *DataTable) GetSheetByIndex(idx int) string
- func (dt *DataTable) GetSheets() []string
- func (dt *DataTable) Last(str string, sheets ...string) *DataFrame
- func (dt *DataTable) MaxRow(sheets ...string) (total int)
- func (dt *DataTable) Rows(sheets ...string) (list []*Row)
- type Options
- type Row
Constants ¶
const ( Xlsx = ".xlsx" Xls = ".xls" Csv = ".csv" Txt = ".txt" Dat = ".dat" )
Variables ¶
var (
ErrNotSupportFileType = errors.New("file type not supported")
)
Functions ¶
This section is empty.
Types ¶
type DataTable ¶
type DataTable struct { Ext string // contains filtered or unexported fields }
func (*DataTable) Contains ¶
Contains Get contains str df default sheet[0] Example: ----------------- A1 B1 C1 A2 aa bb A3 aa bb ----------------- Contains("A") // return: [A1, A2, A3] Contains("A", "Sheet1") // return: [A1, A2, A3]
func (*DataTable) First ¶
First get df, str eq df.value default sheet[0] Example: ----------------- A1 B1 C1 A2 aa bb A3 aa bb ----------------- First("aa") // return: {Sheet:Sheet1,Row:2,Col:2,Value:aa,RawValue:aa} First("aa", "Sheet1")
func (*DataTable) ForeachRow ¶ added in v0.0.10
ForeachRow for range all row default sheet[0]
func (*DataTable) Get ¶
Get Get df.Value eq str default sheet[0] Example: ----------------- A1 B1 C1 A2 aa bb A3 aa bb ----------------- Get("A1") // return: [A1] Get("A1", "Sheet1") // return: [A1]
func (*DataTable) GetCell ¶
GetCell get cell by row, col default sheet[0] Example: ----------------- A1 B1 C1 A2 aaa bb A3 aaa bb A4 aaa bb ----------------- GetCell(1, 1) // return: A1 GetCell(1, 3, "Sheet1") // return: B1
func (*DataTable) GetCellByVal ¶ added in v0.0.10
GetCellByVal get cell by row str, col str default sheet[0] Example: ----------------- A1 B1 C1 A2 aaa bb A3 aaa bb A4 aaa bb ----------------- GetCellByVal("A4", "C1") // return: bb GetCellByVal("A4", "B1", "Sheet1") // return: aaa
func (*DataTable) GetCol ¶ added in v0.0.7
GetCol get col default sheet[0] Example: ----------------- A1 B1 C1 A2 aa bb A3 aa bb ----------------- GetCol(1) // return: A1, A2, A3 GetCol(2, "Sheet1") // return: B1, aa, aa
func (*DataTable) GetRow ¶ added in v0.0.7
GetRow get row default sheet[0] Example: ----------------- A1 B1 C1 A2 aa bb A3 aa bb ----------------- GetRow(1) // return: A1, B1, C1 GetRow(2, "Sheet1") // return: A2, aa, bb
func (*DataTable) GetSheetByIndex ¶ added in v0.0.7
GetSheetByIndex Get sheet name by index Example: GetSheetByIndex(1) // return: Sheet1
func (*DataTable) Last ¶
Last get df, str eq df.value default sheet[0] Example: ----------------- A1 B1 C1 A2 aa bb A3 aa bb ----------------- Last("aa") // return: {Sheet:Sheet1,Row:3,Col:2,Value:aa,RawValue:aa} Last("aa", "Sheet1")