Change Log¶
Version 0.8.1¶
2023-07-18
Fixed¶
The
limit()method onSelectionnow accepts a range of integers or percentages.The
sampleandlimit()methods onSelectionnow correctly validate their inputs.
Version 0.8.0¶
2021-05-26
Changed (backwards-incompatible)¶
The
to_df()method onCubeno longer returns Unclassified and Totals rows by default (can be included by using newunclassifiedandtotalsparameters).
Changed¶
The
typeattribute onVariableobjects is now a PythonEnum, though this is implemented in a way that is backwards-compatible with strings.
Added¶
Added
day,month,quarterandyearattributes toDateVariableandDateTimeVariableobjects, which bands them to the corresponding time period for use as cube dimensions.Added
unclassified,totalsandno_transparameters to theto_df()method onCubeto control whether these rows are returned.Added
convert_indexparameter to theto_df()method onCubeto control whether to automatically convert dimensions to their ‘natural’ index type.Added
before()andafter()methods toTextVariablefor querying it according to whether it occurs alphabetically before or after a given value. They have parameterallow_equal(default False) to also include records equal to the given value.Added support for using
<>operators withTextVariables, corresponding to thebefore()andafter()methods.
Fixed¶
TextVariable.between()method now ignores case, and checks thatstartcomes beforeend.
Version 0.7.1¶
2021-01-27
Fixed¶
Creating a session with a new system no longer produces an error on the first attempt. Fixed by requiring
apteco-apiv0.2.1, in which the last_login parameter on SessionDetails object is now optional.
Version 0.7.0¶
2021-01-26
Added¶
Added
LimitClause,TopNClause,NPerVariableClause,NPerTableClauseclasses for creating selections with limits.Added
sample()andlimit()methods to selections for applying limits to them.Added cube variable statistics in new
apteco.statisticsmodule:SumMeanPopulatedMinMaxMedianModeVarianceStdDevLowerQuartileUpperQuartileInterQuartileRangeCountDistinctCountMode
Added
missing()method toNumericVariablefor selecting records with missing values.
Changed¶
Cubes can now have multiple measures rather than just the single default count.
For cubes with just a single dimension,
Cube.to_df()now returns a DataFrame with a normalIndex(rather than aMultiIndex).
Deprecated¶
NumericVariable.max→ useNumericVariable.max_valueNumericVariable.min→ useNumericVariable.min_value
Fixed¶
Process that validates cube dimensions and measures has been improved to catch some invalid combinations that were previously allowed, and allow some valid combinations that were previously prevented.
Version 0.6.0¶
2020-10-22
Added¶
Added ability to pick variables by description.
Added
table_nameproperty toVariableclasses (alias oftable.name).Added
is_related()method toTable.Added
allow_samekeyword tois_ancestor(),is_descendant()&is_related()methods onTable.Added
<=and>=operators toTablecorresponding to theseis_ancestor(allow_same=True)andis_descendant(allow_same=True).Added methods to
TextVariableto enable querying text variables with different text match types:equals()contains()startswith()endswith()between()matches()
Added
datagrid()andcube()methods to tables and selections to enable building Data Grids and Cubes directly from these.Added
AptecoDeprecationWarningfor warning about deprecated features.
Changed¶
Simplified some
Tableattribute names (the old names still work but issue anAptecoDeprecationWarning):singular_display_name->singularplural_display_name->pluralis_default_table->is_defaultis_people_table->is_peoplechild_relationship_name->child_relationshipparent_relationship_name->parent_relationshiphas_child_tables->has_children
Session.tablesis now aTablesAccessorobject instead ofdict:can pick tables by name using
[](as before)can use
for ... into loop over tablescan use
len()to get the number of tables
Session.variablesandTable.variablesis now aVariablesAccessorobject instead ofdict:can pick variables by name or description using
[](as before for names; support for descriptions is new)can use
for ... into loop over variablescan use
len()to get the number of variables (in the system or on the table)has
namesattribute for picking by name-only (using[]) and looping over variable names (usingfor ... in)has
descsattribute for picking by description-only (using[]) and looping over variable descriptions (usingfor ... in)has
descriptionsattribute, which is alias ofdescs
The columns on the
DataFramereturned byDataGrid.to_df()now have the data type that matches the FastStats variable for that column.Variables from ancestor tables can now be used as columns on a
DataGrid.Variables from related tables can now be used as dimensions on a
Cube.
Removed¶
Removed
isin()andcontains()method fromVariablebase class completely (had been previously deprecated to raiseNotImplementedError).contains()has been implemented onTextVariableand it is planned to implement these methods for applicable variable types in future.
Fixed¶
During variables initialisation process, variables with unrecognised type now log a warning rather than raising exception (this means program execution can continue rather than stopping completely).
It is now possible to change the table of a selection to a table that is not a direct ancestor or descendant (this previously raised an
OperationError).
Version 0.5.0¶
2020-06-03
Added¶
Added
DataGridclass for creating Data Grids (export of FastStats data).Added
Cubeclass for creating Cubes (summary of FastStats data).Added
to_df()method toDataGridandCubeclasses for converting these objects to a PandasDataFrame.
Changed¶
You can now import
login,login_with_passwordandSession, along with the newDataGridandCube, directly from theaptecopackage.
Removed¶
Removed
select()method fromTableandClauseclasses andselect()function from query module, as this was not publicly documented and the directcount()method is preferred overselect().count. It was wanted to reserve theselectname for other potential future functionality.
Version 0.4.0¶
2020-04-07
Added¶
Added the ability to build selections using the
==,!=,<,>,<=,>=comparison operators with Selector, Numeric, Text, Array, FlagArray, Date, DateTime variables, and value(s) of the matching object type, e.g.DateVariablewith a Pythondatetime.dateobject. (Note: not all FastStats variable types support all comparison operators.)Added
DateRangeClause,TimeRangeClause,DateTimeRangeClauseclasses for creating selection clauses.Added
is_ancestor(),is_descendant(),is_same()methods toTableclass for checking table relationships.Added
count()method toTableclass to enable direct counting of empty query comprising just a table.Added
system_infoattribute toSessionclass which returns FastStats system metadata as anamedtuple.Added installation guide, tutorial, and reference guides for
SessionandVariableobjects.Added keywords and classifiers to project (for PyPI).
Added continuous integration using Azure Pipelines so tests now run automatically during development process. This includes measuring test coverage.
Changed¶
login()andlogin_with_password()functions now returnSessionobject directly, instead of an intermediaryCredentialsobject.The variables dictionaries on
SessionandTableobjects now have variable names as keys, instead of descriptions.Variableclasses now havetableattribute which returns theTableobject for the table they belong to.CriteriaClauseclasses no longer havetableparameter in signature; theirtableattribute is derived fromvariable.The comparison operators on tables are now reversed so that
[ancestor table] < [descendant table]is true. This is to fit with the idea of the master table as the ‘root’ table and ancestor tables as having greater precedence to child and descendant tables.The
userattribute onSessionis now anamedtuplerather than its ownUserclass.If the master table can’t be found during session initialization, it now gives more specific error messages about what went wrong.
If table relations aren’t initialized correctly, it now tells you about all the cases that fail, not just the first one it finds.
Removed¶
Removed
CombinedCategoriesVariableclass, as its implementation didn’t cover all types of Combined Categories variables. Variables of this type have reverted to the more generalSelectorVariable. It is planned to re-implement Combined Categories variable support in future.Removed
isin()method on variables, as it’s not applicable to all variable types. It is planned to re-implement this method for relevant variables in future.
Fixed¶
Session initialization process now loads all system tables, not just the first 10.
Using generators to return selector codes for building selections (with
==operator) now works.
Version 0.3.0¶
2019-10-01
Added¶
Added
DateListClausefor creating selections with list of dates.Added
select()method toTablesclass to enable counting empty queries.
Changed¶
Each variable type now has a specific class with only the attributes pertinent to it.
Version 0.2.0¶
2019-08-23
Added¶
Added
serialize()anddeserialize()methods to theSessionclass.Added documentation (Getting Started guide and Change Log).
Version 0.1.2¶
2019-08-05
Fixed¶
Fixed not being able to connect to a different API host after first connection during any single Python session.
Version 0.1.0¶
2019-07-05
Added¶
Added
login()andlogin_with_password()functions to log in to the API.Added
Sessionclass for creating an API session.Added
Tableclass representing FastStats system tables.Added support for accessing variables on a table using the
[]operator with the variable description.Added support for testing equality of tables using the
==operator.Added support for testing if a table is an ancestor or descendant of another using the
>and<operators (respectively).Added
SelectorClause,CombinedCategoriesClause,NumericClause,TextClause,ArrayClause,FlagArrayClauseclasses for creating selection clauses.Added support for creating selection clauses using the
==operator on variables withstrliterals to set values.Added
isin()method on variables to select values using an iterable.Added
BooleanClauseclass to apply boolean logic to clauses (AND,OR,NOT).Added support for applying boolean logic using the
&,|,~operators on clauses.Added
TableClauseclass for changing resolve table level of clauses (ANY,THE).Added support for using the
*operator with a clause and a table to change the resolve table of the clause.Added
SubSelectionClauseclass for using a subselection in a selection.Added
Selectionclass for creating a selection from a query, withget_count()andset_table()methods.Added
select()method on clauses to create aSelectionfrom the clause.Added
select()function for creating a selection using a clause.