Introduction
The Series and DataFrame objects rely on index to determine the order of their data.
The main type of index in gambas is the IndexData type, defined as per below:
type IndexData struct {
index []Index
names []string
}
indexholds the index values, which are of typeIndex.namesare the names of each index column. For single index,namesonly has one element. For multiindex,nameswill have as many elements as necessary.
You can access the private fields with these accessors:
func (id IndexData) Index() []Index {
return id.index
}
func (id IndexData) Names() []string {
return id.names
}
This is the definition of the Index type.
type Index struct {
id int
value []interface{}
}
idis the ID of an index item.valueis the value of an index item. For single index,valueonly has one element. For multiindex,valuewill have as many elements as necessary.
You can access the private fields with these accessors:
func (i Index) Id() int {
return i.id
}
func (i Index) Value() []interface{} {
return i.value
}