series
Series ¶
Series(
data,
index=None,
filters=None,
order_by_columns=None,
name="Series",
saola_connector=None,
)
Bases: ImmutableObject
One dimensional PQL Series.
Parameters:
-
data
(ColumnLike
) –Data to be used. Can be either PQL query string, PQLColumn, or PQLOperator.
-
index
(Optional[BaseIndex]
, default:None
) –Index to be used. Default is RangeIndex.
-
filters
(Optional[FiltersLike]
, default:None
) –Filters to be used. Default is none.
-
order_by_columns
(Optional[List[OrderByColumn]]
, default:None
) –OrderByColumns to be used to sort series. Default is none.
-
name
(str
, default:'Series'
) –Name of series.
-
saola_connector
(Optional[SaolaConnector]
, default:None
) –Saola connector used to export data.
object_str
staticmethod
¶
Returns string representation of object with given class name and properties.
Parameters:
-
class_name
(str
) –Name of object class.
-
properties
(OrderedDict[str, Any]
) –Properties to include.
Returns:
-
str
–String representation.
shorten_string
staticmethod
¶
Shortens string to have maximum of max_length
characters.
head ¶
Returns the first n rows based on position as pandas Series.
Parameters:
-
n
(int
, default:5
) –Number of rows to return.
Returns:
-
Series
–First n rows as pandas Series.
to_pandas ¶
Exports data of given query using saola connector.
pu ¶
Return pull up aggregation methods object containing all pull-up methods.
Parameters:
-
target_table
(str
) –The table to which the aggregation result should be pulled.
Returns:
-
PullUpAggregationMethods
–PullUpAggregationMethods object.
add ¶
Return addition of series and other.
Applies ADD operator to column.
Parameters:
-
other
(Union[Series, NumericValue]
) –Series or numeric scalar to be added.
Returns:
-
Series
–The result of the operation.
sub ¶
Return subtraction of series and other.
Applies SUB operator to column.
Parameters:
-
other
(Union[Series, NumericValue]
) –Series or numeric scalar to be subtracted.
Returns:
-
Series
–The result of the operation.
mul ¶
Return multiplication of series and other.
Applies MULT operator to column.
Parameters:
-
other
(Union[Series, NumericValue]
) –Series or numeric scalar to be multiplied.
Returns:
-
Series
–The result of the operation.
div ¶
Return division of series and other.
Applies DIV operator to column.
Parameters:
-
other
(Union[Series, NumericValue]
) –Series or numeric scalar to be divided.
Returns:
-
Series
–The result of the operation.
floordiv ¶
Return floor division of series and other.
Applies FLOOR operator and DIV operator to column.
Parameters:
-
other
(Union[Series, NumericValue]
) –Series or numeric scalar to be floor divided.
Returns:
-
Series
–The result of the operation.
mod ¶
Return modulo of series and other.
Applies MODULO operator to column.
Parameters:
-
other
(Union[Series, NumericValue]
) –Series or numeric scalar to be modulo'd.
Returns:
-
Series
–The result of the operation.
pow ¶
Return the series raised to the power of the other.
Applies POWER operator to column.
Parameters:
-
other
(Union[Series, NumericValue]
) –Series or numeric scalar to be the exponent.
Returns:
-
Series
–The result of the operation.
abs ¶
Return the series with the absolute value of its elements.
Applies ABS operator to column.
round ¶
Round series to given number of decimals.
Applies ROUND operator to column.
lt ¶
Return a Series of booleans indicating whether each element is less than the other.
Applies LOWER_THAN operator to column.
Parameters:
-
other
(Union[Series, ScalarValue]
) –Series or scalar to be compared.
Returns:
-
Series
–The result of the operation.
le ¶
Return a Series of booleans indicating whether each element is less than or equal to the other.
Applies LOWER_EQUALS operator to column.
Parameters:
-
other
(Union[Series, ScalarValue]
) –Series or scalar to be compared.
Returns:
-
Series
–The result of the operation.
eq ¶
Return a Series of booleans indicating whether each element is equal to the other.
Applies EQUALS operator to column.
Parameters:
-
other
(Union[Series, ScalarValue]
) –Series or scalar to be compared.
Returns:
-
Series
–The result of the operation.
ne ¶
Return a Series of booleans indicating whether each element is not equal to the other.
Applies NOT_EQUALS operator to column.
Parameters:
-
other
(Union[Series, ScalarValue]
) –Series or scalar to be compared.
Returns:
-
Series
–The result of the operation.
ge ¶
Return a Series of booleans indicating whether each element is greater than or equal to the other.
Applies GREATER_EQUALS operator to column.
Parameters:
-
other
(Union[Series, ScalarValue]
) –Series or scalar to be compared.
Returns:
-
Series
–The result of the operation.
gt ¶
Return a Series of booleans indicating whether each element is greater than the other.
Applies GREATER_THAN operator to column.
Parameters:
-
other
(Union[Series, ScalarValue]
) –Series or scalar to be compared.
Returns:
-
Series
–The result of the operation.
isnull ¶
Return a boolean same-sized Series indicating if the values are null.
Applies IS NULL operator to column.
Returns:
-
Series
–A Series of masked bool values for each element that indicates whether an element is a null value.
isin ¶
Returns whether elements of series are in values.
Applies IN operator to column.
Parameters:
-
values
(List[Union[Series, ScalarValue]]
) –List of values to test.
Returns:
-
Series
–The result of the operation.
between ¶
Return boolean Series equivalent to left <= series <= right.
Applies BETWEEN operator to column.
Parameters:
-
left
(ScalarValue
) –Left boundary.
-
right
(ScalarValue
) –Right boundary.
Returns:
-
Series
–The result of the operation.
mean ¶
Return the mean of the values.
Applies AVG operator to column.
Returns:
-
ScalarValue
–Mean of series values.
median ¶
Return the median of the values.
Applies MEDIAN operator to column.
Returns:
-
ScalarValue
–Median of series values.
quantile ¶
Return the quantile of the values.
Applies QUANTILE operator to column.
Parameters:
-
q
(float
, default:0.5
) –Quantile to compute. 0 <= q <= 1.
Returns:
-
ScalarValue
–Quantile of series values.
mode ¶
Return a series containing a single mode of the values.
Applies MODE operator to column. For multi-modal input, i.e. there are several result candidates, the element with the smallest value is chosen. For elements of type STRING, the smallest value is determined by its lexicographical order
Returns:
-
Series
–Mode of series values.
max ¶
Return the max of the values.
Applies MAX operator to column.
Returns:
-
ScalarValue
–Max of series values.
min ¶
Return the min of the values.
Applies MIN operator to column.
Returns:
-
ScalarValue
–Min of series values.
sum ¶
Return the sum of the values.
Applies SUM operator to column.
Returns:
-
ScalarValue
–Sum of series values.
product ¶
Return the product of the non-null values. Null values are skipped.
Applies PRODUCT operator to column. In case of an overflow the result will be null.
Returns:
-
ScalarValue
–Product of series values.
count ¶
Return the number of non-null values.
Applies COUNT operator to column.
Returns:
-
ScalarValue
–Number of non-null values.
var ¶
Return the variance of the given series using the n-1 method. Null values are ignored.
Applies VAR operator to column.
Returns:
-
ScalarValue
–Variance of series.
std ¶
Return the standard deviation of the given series using the n-1 method. Null values are ignored.
Applies STDEV operator to column.
Returns:
-
ScalarValue
–Standard deviation of series.
to_string ¶
Converts given series to string.
Applies TO_STRING operator to column.
Parameters:
-
format_
(Optional[str]
, default:None
) –Optional, defines how dates are converted to string.
Returns:
-
Series
–Series converted to string.
to_date ¶
Converts given series to date.
Applies TO_DATE operator to column.
Parameters:
-
format_
(str
) –Defines how strings are converted to date.
Returns:
-
Series
–Series converted to date.
astype ¶
dropna ¶
Return Series with filter for null values.
Returns:
-
Series
–A Series with null values filtered out.
nunique ¶
Returns number of unique elements in series.
Parameters:
-
dropna
(bool
, default:True
) –Whether none values are counted or not.
Returns:
-
int
–Number of unique elements in series.
value_counts ¶
Return a Series containing counts of unique values.
Parameters:
-
normalize
(bool
, default:False
) –If True the relative frequencies of the unique values will be returned.
-
sort
(bool
, default:True
) –Sort by frequencies.
-
ascending
(bool
, default:False
) –Sort in ascending order.
-
dropna
(bool
, default:True
) –Don't include counts of Null.
Returns:
-
Series
–A Series of counts of unique values.
sort_values ¶
Sorts series.
Parameters:
-
ascending
(bool
, default:True
) –Sort ascending or descending.
Returns:
-
Series
–Series with OrderByColumns set.
apply_unary_operator ¶
Applies given unary operator to series.
Parameters:
-
operator
(Type[UnaryPQLOperator]
) –Operator to apply.
Returns:
-
Series
–Series with operator applied.
apply_binary_operator ¶
Applies given binary operator to series.
Parameters:
-
other
(Union[Series, ScalarValue]
) –Other operand to apply binary operator on.
-
operator
(Type[BinaryPQLOperator]
) –Operator to apply.
-
reverse
(bool
, default:False
) –If true order of operands is reversed.
Returns:
-
Series
–Series with operator applied.
apply_binary_operator_dunder ¶
Combines series with the other for dunder methods.
apply_aggregation_operator ¶
Applies given aggregation operator to series and exports result.
Parameters:
-
operator
(Type[UnaryPQLOperator]
) –Operator to apply.
Returns:
-
ScalarValue
–Result of aggregation.
copy ¶
copy(
data=None,
index=None,
filters=None,
order_by_columns=None,
name=None,
saola_connector=None,
)
Copies given series and overrides properties given as parameters.