Skip to content

DataFrameStatements

Methods

select

Return a Select object

php
public select(string[] $selections): \MammothPHP\WoollyM\Statements\Select\Select

Parameters:

ParameterTypeDescription
$selectionsstring[]column(s) name(s) to select

selectAll

Return a fixed selectAll object

php
public selectAll(): \MammothPHP\WoollyM\Statements\Select\SelectAll

col

Return a ColumnRepresentation object, extending Select object.

php
public col(string $columnName): \MammothPHP\WoollyM\Statements\Select\ColumnRepresentation

Parameters:

ParameterTypeDescription
$columnNamestring

Throws:


column

Alias for col() method.

php
public column(string $columnName): \MammothPHP\WoollyM\Statements\Select\ColumnRepresentation

Parameters:

ParameterTypeDescription
$columnNamestring

Inherited methods

insert

php
public insert(): \MammothPHP\WoollyM\Statements\Insert\Insert
  • This method is abstract.

__construct

php
public __construct(array<int,array> $data = [], mixed $dataDriver = null): mixed

Parameters:

ParameterTypeDescription
$dataarray<int,array>Array data to ingest
$dataDrivermixed- Class of custom driver to use. if null, the PhpArray (in-memory) driver will used.

Throws:


__clone

php
public __clone(): mixed

addColumn

Adds a new column to the DataFrame. If column already exist, then nothing will happen.

php
public addColumn(string $columnName): static

Parameters:

ParameterTypeDescription
$columnNamestring

addColumns

Adds multiple columns to the DataFrame.

php
public addColumns(string[] $columnNames): static

Parameters:

ParameterTypeDescription
$columnNamesstring[]

removeColumn

Removes a column (and all associated data) from the DataFrame.

php
public removeColumn(string $columnName): static

Parameters:

ParameterTypeDescription
$columnNamestring

hasColumn

Returns a boolean of whether the specified column exists.

php
public hasColumn(\MammothPHP\WoollyM\Statements\Select\ColumnRepresentation|string $column): bool

Parameters:

ParameterTypeDescription
$column\MammothPHP\WoollyM\Statements\Select\ColumnRepresentation|string

countColumns

Count unique columns already known

php
public countColumns(): int

columns

Return ColumnRepresentation Object extending Select object

php
public columns(): array&lt;int,\MammothPHP\WoollyM\Statements\Select\ColumnRepresentation&gt;

columnsNames

Get unique columns already known

php
public columnsNames(): array&lt;int,string&gt;

mustHaveColumn

Assertion that the DataFrame must have the column specified. If not then an exception is thrown.

php
public mustHaveColumn(string $columnName): static

Parameters:

ParameterTypeDescription
$columnNamestring

Throws:


getColumnKey

php
protected getColumnKey(string $columnName): int

Parameters:

ParameterTypeDescription
$columnNamestring

createColumnRepresentation

php
protected createColumnRepresentation(\MammothPHP\WoollyM\ColumnIndex $columnIndex): void

Parameters:

ParameterTypeDescription
$columnIndex\MammothPHP\WoollyM\ColumnIndex

addRecord

Add a record, providing an array indexed by column => value

php
public addRecord(array&lt;string,mixed&gt; $recordArray): static

Parameters:

ParameterTypeDescription
$recordArrayarray<string,mixed>

updateRecord

Update a record by record key. If key does not exist, record will be created.

php
public updateRecord(int $key, array $recordArray): static

Parameters:

ParameterTypeDescription
$keyint
$recordArrayarray

updateCell

php
public updateCell(int $recordKey, string $column, mixed $newValue): static

Parameters:

ParameterTypeDescription
$recordKeyint
$columnstring
$newValuemixed

removeRecord

Remove a record by key

php
public removeRecord(int $key): static

Parameters:

ParameterTypeDescription
$keyint

Throws:


getRecord

Get a record by key

php
public getRecord(int $key): array&lt;string,array&gt;

Parameters:

ParameterTypeDescription
$keyint

getRecordAsArray

Get a record by key and return an array

php
public getRecordAsArray(int $key): array&lt;string,array&gt;

Parameters:

ParameterTypeDescription
$keyint

recordKeyExist

Check if a record key exist

php
public recordKeyExist(int $recordKey): bool

Parameters:

ParameterTypeDescription
$recordKeyint

convertRecordToAbstract

php
protected convertRecordToAbstract(array $recordArray): array

Parameters:

ParameterTypeDescription
$recordArrayarray

convertAbstractToRecordObject

php
protected convertAbstractToRecordObject(array $abstractRecord): \MammothPHP\WoollyM\Record

Parameters:

ParameterTypeDescription
$abstractRecordarray

toArray

Outputs a DataFrame as a two-dimensional associative array.

php
public toArray(bool $fillInNonExistentCol = false): array

Parameters:

ParameterTypeDescription
$fillInNonExistentColbool

initDriverIterator

php
protected initDriverIterator(): void

getRecordsAsArrayIterator

php
public getRecordsAsArrayIterator(bool $fillAllColumn = false): \Iterator

Parameters:

ParameterTypeDescription
$fillAllColumnbool


Automatically generated on 2024-07-03

Released under the BSD 3-Clause License.