README-work

Raku Data::TypeSystems

This Raku package provides a type system for different data structures that are coercible to full arrays. Its code was originally developed in "Data::Reshapers", [AAp1].

Installation

From Zef ecosystem:

zef install Data::TypeSystem

From GitHub:

zef install https://github.com/antononcube/Raku-Data-TypeSystem.git

Usage examples

The type system conventions follow those of Mathematica's Dataset -- see the presentation "Dataset improvements".

Here we get the Titanic dataset, change the "passengerAge" column values to be numeric, and show dataset's dimensions:

use Data::ExampleDatasets;
my $url = 'https://raw.githubusercontent.com/antononcube/Raku-Data-Reshapers/main/resources/dfTitanic.csv';
my @dsTitanic = example-dataset($url, headers => 'auto');
@dsTitanic = @dsTitanic.map({$_<passengerAge> = $_<passengerAge>.Numeric; $_}).Array;
@dsTitanic.elems

Here is a sample of dataset's records:

.say for @dsTitanic.pick(5)

Here is the type of a single record:

use Data::TypeSystem;
deduce-type(@dsTitanic[12])

Here is the type of single record's values:

deduce-type(@dsTitanic[12].values.List)

Here is the type of the whole dataset:

deduce-type(@dsTitanic)

Here is the type of "values only" records:

my @valArr = @dsTitanic>>.values>>.Array;
deduce-type(@valArr)

Here is the type of the string values only records:

my @valArr = @dsTitanic.map({ $_.grep({ $_.value ~~ Str }).Hash })>>.values>>.Array;
.say for @valArr.pick(4);
deduce-type(@valArr);

References

[AAp1] Anton Antonov, Data::Reshapers Raku package, (2021), GitHub/antononcube.

Data::TypeSystem v0.1.0

Data type system for different data structures (arrays, lists of hashes, etc.)

Authors

  • Anton Antonov

License

Artistic-2.0

Dependencies

Test Dependencies

Provides

  • Data::TypeSystem
  • Data::TypeSystem::Examiner
  • Data::TypeSystem::Predicates

The Camelia image is copyright 2009 by Larry Wall. "Raku" is trademark of the Yet Another Society. All rights reserved.