Skip to content

Latest commit

 

History

History
107 lines (57 loc) · 3.74 KB

index.md

File metadata and controls

107 lines (57 loc) · 3.74 KB
PHEXT > DataKit > API Reference

API Reference

Importer

The Importer class allows easy importing of both small and large CSV files.

SMA

The SMA class is used to compute Simple Moving Averages. It is used by alternating between adding new values to the array and calculating the current average.

EMA

The EMA class is used to compute Exponential Moving Averages. It is used by alternating between adding new values to the array and calculating the current average.

DOMScraper

The DOMScraper is a barebones web scraper that works by quickly traversing a series of nested elements in a DOMDocument and delivering the final set of elements to a callback for processing.

Vector

Vector is an object orientated wrapper for native PHP arrays. It exposes most of the native built-in methods as well as adding additional functions useful for both basic statistical calculations and bulk operations.

DataFrame

The DataFrame is a class inspired by, and loosely based off of, a class by the same name from the Pandas library in Python. It specialises in working with 2 dimensional arrays (rows and columns) that may originate from data sources such as CSV files or data fetched from a relational database.

GroupedDataFrame

The GroupedDataFrame is a special class that manages a group of normal DataFrame objects. Normal actions on the DataFrame can be called and actioned against all objects within the set.

PackedSequence

PackedArray

Both PackedSequence and PackedArray are array structures designed for working in tight memory situations.

  • Use a PackSequence for working with a uniform set of elements of the same type and byte size (e.g. all Ints or all floats).
  • Use a PackedArray when your dataset has elements that vary in size and/or type.

These classes should not be considered a blanket replacement for native arrays, instead the key is to identify when they are a better fit for any particular problem.

In general native arrays offer flexibility and speed over memory consumption, where as packed arrays/sequences prioritise memory usage for a little less flexibility. They are built to address situations where working with large data sets that challenge the available RAM on the running machine can not be practically solved by other means.

CSVExporter

The CSV class can be used for producing CSV documents. It abstracts the mechanics of producing the file format, allowing your code to focus on its own logic.

CSVImporter

The CSVImporter is designed to efficiently load or parse CSV documents. It is the underlying engine used by the static methods in the Importer class.

math

A broad collection of general mathematical functions. This class acts as a support class of statistical calculations for the DataFrame and Vector classes.


Global Methods

vector
function vector(...$items)

Create a new Vector.

This method takes a variable set of parameters, with each being added as a seperate element within the array.

If only one element is passed in and it is an array then the array will be transformed into the vector.


dataframe
function dataframe(?array $data = null, array $headers = null)

Create a new DataFrame with the supplied rows & columns.

See DataFrame::__construct for a proper description.


Constants

define('ASCENDING', true);
define('DESCENDING', false);
define('OOB_ALL', 2);
define('OOB_UPPER', 1);
define('OOB_LOWER', 0);
define('LAST_ROW', '__LASTROW__');
define('FIRST_ROW', '__FIRSTROW__');