DataFrameStatements
- Full name:
\MammothPHP\WoollyM\DataFrameStatements
- Parent class:
\MammothPHP\WoollyM\DataFrameAccessors
- This class is an Abstract class
Methods
select
Return a Select object
public select(string[] $selections): \MammothPHP\WoollyM\Statements\Select\Select
Parameters:
Parameter | Type | Description |
---|---|---|
$selections | string[] | column(s) name(s) to select |
selectAll
Return a fixed selectAll object
public selectAll(): \MammothPHP\WoollyM\Statements\Select\SelectAll
col
Return a ColumnRepresentation object, extending Select object.
public col(string $columnName): \MammothPHP\WoollyM\Statements\Select\ColumnRepresentation
Parameters:
Parameter | Type | Description |
---|---|---|
$columnName | string |
Throws:
column
Alias for col() method.
public column(string $columnName): \MammothPHP\WoollyM\Statements\Select\ColumnRepresentation
Parameters:
Parameter | Type | Description |
---|---|---|
$columnName | string |
Inherited methods
insert
public insert(): \MammothPHP\WoollyM\Statements\Insert\Insert
- This method is abstract.
__construct
public __construct(array<int,array> $data = [], mixed $dataDriver = null): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$data | array<int,array> | Array data to ingest |
$dataDriver | mixed | - Class of custom driver to use. if null, the PhpArray (in-memory) driver will used. |
Throws:
__clone
public __clone(): mixed
addColumn
Adds a new column to the DataFrame. If column already exist, then nothing will happen.
public addColumn(string $columnName): static
Parameters:
Parameter | Type | Description |
---|---|---|
$columnName | string |
addColumns
Adds multiple columns to the DataFrame.
public addColumns(string[] $columnNames): static
Parameters:
Parameter | Type | Description |
---|---|---|
$columnNames | string[] |
removeColumn
Removes a column (and all associated data) from the DataFrame.
public removeColumn(string $columnName): static
Parameters:
Parameter | Type | Description |
---|---|---|
$columnName | string |
hasColumn
Returns a boolean of whether the specified column exists.
public hasColumn(\MammothPHP\WoollyM\Statements\Select\ColumnRepresentation|string $column): bool
Parameters:
Parameter | Type | Description |
---|---|---|
$column | \MammothPHP\WoollyM\Statements\Select\ColumnRepresentation|string |
countColumns
Count unique columns already known
public countColumns(): int
columns
Return ColumnRepresentation Object extending Select object
public columns(): array<int,\MammothPHP\WoollyM\Statements\Select\ColumnRepresentation>
columnsNames
Get unique columns already known
public columnsNames(): array<int,string>
mustHaveColumn
Assertion that the DataFrame must have the column specified. If not then an exception is thrown.
public mustHaveColumn(string $columnName): static
Parameters:
Parameter | Type | Description |
---|---|---|
$columnName | string |
Throws:
getColumnKey
protected getColumnKey(string $columnName): int
Parameters:
Parameter | Type | Description |
---|---|---|
$columnName | string |
createColumnRepresentation
protected createColumnRepresentation(\MammothPHP\WoollyM\ColumnIndex $columnIndex): void
Parameters:
Parameter | Type | Description |
---|---|---|
$columnIndex | \MammothPHP\WoollyM\ColumnIndex |
addRecord
Add a record, providing an array indexed by column => value
public addRecord(array<string,mixed> $recordArray): static
Parameters:
Parameter | Type | Description |
---|---|---|
$recordArray | array<string,mixed> |
updateRecord
Update a record by record key. If key does not exist, record will be created.
public updateRecord(int $key, array $recordArray): static
Parameters:
Parameter | Type | Description |
---|---|---|
$key | int | |
$recordArray | array |
updateCell
public updateCell(int $recordKey, string $column, mixed $newValue): static
Parameters:
Parameter | Type | Description |
---|---|---|
$recordKey | int | |
$column | string | |
$newValue | mixed |
removeRecord
Remove a record by key
public removeRecord(int $key): static
Parameters:
Parameter | Type | Description |
---|---|---|
$key | int |
Throws:
getRecord
Get a record by key
public getRecord(int $key): array<string,array>
Parameters:
Parameter | Type | Description |
---|---|---|
$key | int |
getRecordAsArray
Get a record by key and return an array
public getRecordAsArray(int $key): array<string,array>
Parameters:
Parameter | Type | Description |
---|---|---|
$key | int |
recordKeyExist
Check if a record key exist
public recordKeyExist(int $recordKey): bool
Parameters:
Parameter | Type | Description |
---|---|---|
$recordKey | int |
convertRecordToAbstract
protected convertRecordToAbstract(array $recordArray): array
Parameters:
Parameter | Type | Description |
---|---|---|
$recordArray | array |
convertAbstractToRecordObject
protected convertAbstractToRecordObject(array $abstractRecord): \MammothPHP\WoollyM\Record
Parameters:
Parameter | Type | Description |
---|---|---|
$abstractRecord | array |
toArray
Outputs a DataFrame as a two-dimensional associative array.
public toArray(bool $fillInNonExistentCol = false): array
Parameters:
Parameter | Type | Description |
---|---|---|
$fillInNonExistentCol | bool |
initDriverIterator
protected initDriverIterator(): void
getRecordsAsArrayIterator
public getRecordsAsArrayIterator(bool $fillAllColumn = false): \Iterator
Parameters:
Parameter | Type | Description |
---|---|---|
$fillAllColumn | bool |
Automatically generated on 2024-07-03