h$U"M      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFA sparse dataframe(c) Marco Zocca (2018-2019) BSD-styleocramz fripost org experimentalGHCNone -567>1GheidiA G is a non-empty list of rows.HheidiTake the first row of a G$head (fromList [row0, row1]) == row0TrueIheidiTake the first n rows of a FrameJheidiDrop the first n rows of a FrameKheidi0Construct a table given a non-empty list of rows/(head <$> fromNEList [row0, row1]) == Just row0True fromNEList []NothingLheidiConstruct a table given a list of rows. Crashes if the input list is emptyMheidi,Zip two frames with a row combining functionNheidi Filters a G according to a predicate. Returns Nothing only if the resulting table is empty (i.e. if no rows satisfy the predicate).OheidiLeft-associative scanPheidiRight-associative scanQheidiQ takes row comparison function and a list and returns a list of lists such that the concatenation of the result is equal to the argument. Moreover, each sublist in the result contains only elements that satisfy the comparison. RheidiO(n)& Count the number of rows in the table numRows t04Sheidi Produce a Vector of rowsTheidiProduce a Frame from a Vector of rowsGHIJKLMNOPQRSTList-based dataframe(c) Marco Zocca (2018-2019) BSD-styleocramz fripost org experimentalGHCNone -567> heidiA  is a list of rows.heidi Retain n rowsheidi Drop n rowsheidi This generalizes the list-based  function. heidiLeft-associative scan heidiRight-associative scan heidi  takes row comparison function and a list and returns a list of lists such that the concatenation of the result is equal to the argument. Moreover, each sublist in the result contains only elements that satisfy the comparison. heidi Produce a Vector of rows heidiProduce a Frame from a Vector of rows &Core.Data.Row internal bits and pieces(c) Marco Zocca (2018-2019) BSD-styleocramz fripost org experimentalGHCNone 3567 UheidiKey exceptions UVW Trustworthy /9>?-XheidiTrieKey operations on Generic representations used to provide the default implementations of tries.Yheidi=Mapping of generic representation of keys to trie structures.Zheidi The default implementation of a [ is Y wrapped in a \. This wrapping is due to the Y being a non-empty trie allowing all the of the "emptiness" to be represented at the top level for any given generically implemented key.]heidiTries indexed by ]$ will be represented as an ordinary ^- and the keys will be compared based on the _ instance for k.`heidi!Show the representation of a trieaheidiA map from keys of type k, to values of type a.bheidi'Types that may be used as the key of a a.For data declarations, the instance can be automatically derived from a c instance.[heidi1Type of the representation of tries for this key.dheidiConstruct an empty trieeheidiTest for an empty triefheidiLookup element from triegheidiInsert element into triehheidiDelete element from trieiheidi'Construct a trie holding a single valuejheidi/Apply a function to all values stored in a triekheidi$Traverse the values stored in a trielheidi$Apply a function to the values of a a5 and keep the elements of the trie that result in a m value.nheidi2Fold a trie with a function of both key and value.oheidi6Traverse a trie with a function of both key and value.pheidiTraverse a trie with a function of both key and value, and keep the elements of the trie that result in a m value.qheidiGeneric implementation of r%. This is the default implementation.sheidiGeneric implementation of e%. This is the default implementation.theidiGeneric implementation of  singleton%. This is the default implementation.uheidiGeneric implementation of empty%. This is the default implementation.vheidiGeneric implementation of insert%. This is the default implementation.wheidiGeneric implementation of delete%. This is the default implementation.xheidiGeneric implementation of j%. This is the default implementation.yheidiGeneric implementation of k%. This is the default implementation.zheidiGeneric implementation of `%. This is the default implementation.{heidiGeneric implementation of mapMaybe%. This is the default implementation.|heidiGeneric implementation of  foldWithKey%. This is the default implementation.}heidiGeneric implementation of traverseWithKey%. This is the default implementation.~heidiGeneric implementation of traverseMaybeWithKey%. This is the default implementation.heidiTries of types without constructors are represented by an empty type.heidiTries of constructors without fields are represented by a single value.heidi:Generic sums are represented by up to a pair of sub-tries.heidi3Generic products are represented by tries of tries.heidiGeneric metadata is skipped in trie representation and operations.heidi:Generic fields are represented by tries of the field type.heidi] tries are implemented with ^, this is intended for cases where it is better for some reason to force the use of a ^0 than to use the generically derived structure.heidi tries are implemented with .heidi tries are implemented with .heidi tries are implemented with ^.heidi tries are implemented with ^.heidi tries are implemented with .8XYZ]`ab[defghijklnopqstuvwxyz{|}~Safe #!heidi/Construct a trie from a list of key-value pairsheidiConstruct a trie from a list of key-value pairs. The given function is used to combine values at the same key.heidi Version of : which is strict in the result of the combining function.heidiConstruct an empty trieheidiTest for an empty trieheidiLookup an element from a trieheidi!Lens for the value at a given keyheidiInsert an element into a trieheidiDelete an element from a trieheidi'Construct a trie holding a single valueheidiApply a function to the values of a trie and keep the elements of the trie that result in a m value.heidiPerform an action for each value in a trie and keep the elements of the trie that result in a m value.heidi5Filter the values of a trie with the given predicate.heidi Version of ' where the predicate also gets the key.heidi(Fold a trie with a function of the valueheidi1Fold a trie with a function of both key and valueheidi5Traverse a trie with a function of both key and valueheidiAlter the value at the given key location. The parameter function takes the value stored at the given key, if one exists, and should return a value to insert at that location, or  to delete from that location.heidiInsert a value at the given key. The combining function is used when a value is already stored at that key. The new value is the first argument to the combining function.heidi Version of 9 that is strict in the result of combining two elements.heidiReturns  when the a% has a value stored at the given key.heidiReturns  when the a% has a value stored at the given key.heidi(Transform a trie to an association list.heidiLeft-biased union of two triesheidiUnion of two tries with function used to merge overlapping elementsheidiUnion of two tries with function used to merge overlapping elements along with keyheidi%Left-biased intersection of two triesheidiIntersection of two tries parameterized by a combining function of the values at overlapping keysheidiIntersection of two tries parameterized by a combining function of the key and the values at overlapping keysheidi4Remove the keys of the right trie from the left trieheidiParameterized ( using a custom merge function. Return m. to change the value stored in left trie, or  to remove from the left trie.heidi* where function also has access to the keyheidiMap a function over a trie filtering out elements where function returns ']ab+Generic 1-hot encoding of enumeration types(c) Marco Zocca (2019-2020)MITocramz fripost org experimentalGHCNone 8?&Uheidi1-hot encoded vector.This representation is used to encode categorical variables as points in a vector space.heidi Construct a 5 encoding from generic datatype and value information2mkOH (gdatatypeInfo (Proxy :: Proxy C)) (gfrom C2)OH {ohDim = 3, ohIx = 1}heidi/Embedding dimension of the 1-hot encoded vectorheidiActive (hot#) index of the 1-hot encoded vectorheidiCreate a one-hot vector None 8(EheidiPrimitive typesNB : this is just a convenience for unityping the dataframe contents, but it should not be exposed to the library users heidiheidiheidiheidiheidiheidiheidiheidiheidiheidiheidiheidiheidiheidiheidiheidiheidiheidi1-hot encoding of an enum value& 'Generic encoding of algebraic datatypes(c) Marco Zocca (2019)MITocramz fripost org experimentalGHCNone '(356789:>?-heidi Type errorsheidi Single interface to the library.This typeclass provides all the machinery for encoding Haskell values into dataframes.,NOTE: Your datatypes only need to possess a c> instance, to which you just need to add an empty instance of .example: {-# language DeriveGenerics, DeriveAnyClass #-} data A = A Int Char deriving (c, ) heidisumsheidiproductsheidiprimitive typesheidi.Internal representation of encoded ADTs valuesThe first String parameter contains the type name at the given level, the second contains the type constructor nameheidi recursionheidi1-hot encoding of an enumheidiprimitive typesheidiA (type, constructor) name pairheidiFlatten a value into a 1-layer hashmap, via the value's generic encodingheidiFlatten a value into a a", via the value's generic encodingheidi Type nameheidiType constructorheidi:Create a fake TC with the given string as type constructorheidi3Create a fake TC with the given string as type name ,A sparse dataframe row, based on GenericTrie(c) Marco Zocca (2018-2019) BSD-styleocramz fripost org experimentalGHCNone 567@.heidiA  type is internally a Trie:Fast random accessFast set operationsSupports missing elementsheidiFocus on a given columnNB : setting a  value removes the entryheidi : a Lens' that takes a key prefix and relates a row having lists as keys and the subset of columns corresponding to keys having that prefixheidi4Focus on all elements that share a common key prefixe.g.  >>> :t k ->   (eachPrefixed k . vpBool) (GT.TrieKey k, Eq k) => [k] -> Row [k] VP -> [Bool] heidiExtract all elements that share a common key prefix into a monoidal value (e.g. a list)heidiHelper for filtering Framese.g.#:t \k -> keep (text k) (== "hello")* :: GT.TrieKey k => k -> Row k VP -> Boolheidi(Lookup a real number at the given index.Matches , ,  and  values.heidi)Look up a text string at the given index.Matches  and  values.heidi Decode a  from the given column indexheidi Decode a  from the given column index heidi Decode a  from the given column index!heidi Decode a  from the given column index"heidi Decode a  from the given column index#heidi Decode a  from the given column index$heidi Decode a  from the given column index%heidi Decode a  from the given column index&heidi Decode a  from the given column index'heidi Construct a " from a list of key-element pairs.(lookup 3 (rowFromList [(3,'a'),(4,'b')])Just 'a'(lookup 6 (rowFromList [(3,'a'),(4,'b')])Nothingheidi Construct a  from a trie (unsafe).heidi An empty row(heidi,Access the key-value pairs contained in the )heidi/Lookup the value stored at a given key in a row lookup 0 row0Just 'a' lookup 1 row0Nothing*heidiCompares for ordering two rows by the values indexed at a specific key.8Returns Nothing if the key is not present in either row.+heidi:Compares two rows by the values indexed at a specific key.8Returns Nothing if the key is not present in either row.,heidi9Compares two rows by the values indexed at a set of keys.6Returns Nothing if a key in either row is not present.-heidi0Returns an empty row if the argument is Nothing..heidiList the keys of a given row keys row0[0,3]/heidi+Takes the union of a Foldable container of s and discards the values0heidiReturns a new ) that doesn't have a given key-value pair1heidiProduce a new 5 such that its keys do _not_ belong to a certain set.2heidiMap over all elements with a function of both the key and the value3heidiFilter a row by applying a predicate to its keys and corresponding elements.NB : filtering _retains_ the elements that satisfy the predicate.4heidiRetains the entries for which the given list is a prefix of the indexing key5heidi Partition a  into two new ones, such as the elements that satisfy the predicate will end up in the _left_ row.6heidiUses 5 internally7heidiRetains the entries for which the given item appears at any position in the indexing keyheidi=Insert a key-value pair into a row and return the updated onekeys $ insert 2 'y' row0[0,2,3]heidiInsert a key-value pair into a row and return the updated one, or updates the value by using the combination function.8heidi5Fold over a row with a function of both key and value9heidi Traverse a 2 using a function of both the key and the element.:heidiSet union of two rowskeys $ union row0 row1 [0,1,3,666];heidiSet union of two rows, using a combining function for equal keys<heidiSet intersection of two rows=heidiSet intersections of two rows, using a combining function for equal keys>heidiLooks up a key from a row and applies a predicate to its value (if this is found). If no value is found at that key the function returns False.7This function is meant to be used as first argument to .elemSatisfies (== 'a') 0 row0TrueelemSatisfies (== 'a') 42 row0False?heidiInline synonym for > heidi column indexheidi%key prefix of the columns of interestheidi%key prefix of the columns of interestheidi%key prefix of the columns of interestheidie.g. a predicate0heidi Key to remove4heidi key prefix5heidi predicate6heidi key prefix/ !"#$%&'()*+,-./0123456789:;<=>?&GenericTrie-based dataframe algorithms(c) Marco Zocca (2018-2019) BSD-styleocramz fripost org experimentalGHCNone G@heidi7Merge two frames by taking the set union of the columnsAheidiA moves column names into a "key" column, gathering the column values into a single "value" columnBheidiB moves the unique values of a key column into the column names, spreading the values of a value column across the new columns.CheidiGROUP BY : given a key and a table that uses it, split the table in multiple tables, one per value taken by the key.1numRows <$> (HM.lookup "129" $ groupBy "id.0" t0)Just 2DheidiLEFT (OUTER) JOIN : given two dataframes and one key from each, compute the left outer join using the keys as relations.EheidiINNER JOIN : given two dataframes and one key from each, compute the inner join using the keys as relations.head t0,[("id.0","129"),("qty","1"),("item","book")]head t1 [("id.1","129"),("price","100")]$head $ innerJoin "id.0" "id.1" t0 t1[("id.1","129"),("id.0","129"),("qty","5"),("item","book"),("price","100")]@heidiElement combination functionAheidiset of keys to gatherheidi "key" keyheidi "value" keyheidiinput dataframeBheidi "key" keyheidi "value" keyheidiinput dataframeCheidiKey to group byheidi'A 'Frame (GTR.Row k v) can be used hereEheidiKey into the first tableheidiKey into the second tableheidiFirst dataframeheidiSecond dataframe@ABCDE@BACEDNone GG1Populate dataframes with generically-encoded data(c) Marco Zocca (2019)MITocramz fripost org experimentalGHCNone 8L@Fheidi Populate a Frame* with the generic encoding of the row dataFor example, a list of records having two fields each will produce a dataframe with two columns, having the record field names as column labels. *data P1 = P1 Int Char deriving (Eq, Show,  ) instance  P1 data P2 = P2 { p2i :: Int, p2c :: Char } deriving (Eq, Show, Generic) instance Heidi P2 data Q = Q (Maybe Int) (Either Double Char) deriving (Eq, Show, Generic) instance Heidi Q encode [P1 42 'z']Frame {tableRows = [([TC "P1" "_0"],VPInt 42),([TC "P1" "_1"],VPChar 'z')] :| []}encode [P2 42 'z']Frame {tableRows = [([TC "P2" "p2c"],VPChar 'z'),([TC "P2" "p2i"],VPInt 42)] :| []} Test using \ and  record fields :6encode [Q (Just 42) (Left 1.2), Q Nothing (Right 'b')]Frame {tableRows = [([TC "Q" "_0",TC "Maybe" "Just"],VPInt 42),([TC "Q" "_1",TC "Either" "Left"],VPDouble 1.2)] :| [[([TC "Q" "_1",TC "Either" "Right"],VPChar 'b')]]},NB: as the last example above demonstrates,  values are not inserted in the rows, which can be used to encode missing data features.Ftidy data in Haskell(c) Marco Zocca (2018-2020) BSD-styleocramz fripost org experimentalGHCNone L  !"#$%&'()*+,-./0123456789:;<=>?ABCDEFF  BACED '(.0347156)?>-+,*:;<=28/9 !"#$%&None '(-/56789:>?Mheidirender the frame header >>> printBox $ headerBox $ header (Proxy @R) ! "  # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F G H I J K L M N O P QRSTUVWXYZ [\]^_`abcdefghijklmnbopqrstuvwxbcyz{|}b~;ifibieZ;)BEJKbcii:LMNO  b b b b  b b b b i i i   b                                                     #                      b~ b"heidi-0.3.0-9M5jxZVOe4V4ra6vG8q0ckHeidi'Heidi.Data.Frame.Algorithms.GenericTrieCore.Data.FrameCore.Data.Frame.ListCore.Data.Row.InternalData.GenericTrie.InternalData.GenericTrieData.Generics.Encode.OneHot"Data.Generics.Encode.Internal.PrimData.Generics.Encode.InternalHeidi.Data.Row.GenericTrie Lens.MicrotoListOf/Heidi.Data.Frame.Algorithms.GenericTrie.GenericCore.Data.Frame.GenericGGenericCore.Data.Frame.PrettyPrintFrameheadtakedropzipWith frameFromListnumRowsfilterfilterAscanlscanr groupWithtoVector fromVectorOneHotVPTCtcTyNtcTyConmkTyConmkTyNRowatatPrefix eachPrefixed foldPrefixedkeeprealtxtboolintfloatdoublecharstringtext scientificoneHot rowFromListtoListlookupcompareByLookup eqByLookup eqByLookups maybeEmptykeyskeysOnlydelete deleteMany mapWithKey filterWithKeyfilterWithKeyPrefixpartitionWithKeypartitionWithKeyPrefixfilterWithKeyAny foldWithKeytraverseWithKeyunion unionWith intersectionintersectionWith elemSatisfies!: unionColsWith gatherWith spreadWithgroupBy leftOuterJoin innerJoinencode fromNEListfromListKeyErrorAlreadyPresentKeyErrorMissingKeyErrorGTrieKeyGTrieTrieRepDefaultTrieRepbase GHC.MaybeMaybeOrdKeycontainers-0.6.2.1Data.Map.InternalMapghc-prim GHC.ClassesOrd trieShowsPrecTrieTrieKey GHC.Generics trieEmptytrieNull trieLookup trieInsert trieDelete trieSingletontrieMap trieTraversetrieMapMaybeWithKeyJusttrieFoldWithKeytrieTraverseWithKeytrieTraverseMaybeWithKey genericLookupGHC.ListgenericTrieNullgenericSingleton genericEmpty genericInsert genericDeletegenericTrieMapgenericTrieTraversegenericTrieShowsPrecgenericMapMaybeWithKeygenericFoldWithKeygenericTraverseWithKeygenericTraverseMaybeWithKey $fGTrieKeyV1 $fGTrieKeyU1 $fGTrieKey:+: $fGTrieKey:*: $fGTrieKeyM1 $fGTrieKeyK1$fTrieKeyOrdKey $fTrieKeyChar GHC.TypesCharData.IntMap.InternalIntMap $fTrieKeyWordWord$fTrieKeyNatural GHC.NaturalNatural$fTrieKeyIntegerinteger-wired-inGHC.Integer.TypeInteger $fTrieKeyIntInt gtrieLookupgtrieSingleton gtrieInsert gtrieDeletegtrieMap gtrieTraversegmapMaybeWithKey gfoldWithKeygtraverseWithKeygtraverseMaybeWithKey gmergeWithKeyMTrieSTrieLSTrieRSTrieBPTrieKTrieUTrie getOrdKey ShowTrieKeyMkTrietrieMergeWithKey fromListWith fromListWith'emptynullinsert singletonmapMaybeWithKeytraverseMaybeWithKeyfoldalterNothing insertWith insertWith'memberTrue notMemberFalse unionWithKeyintersectionWithKey differencedifferenceWithdifferenceWithKeymapMaybemkOH onehotDimonehotIxoneHotVVPIntVPInt8GHC.IntInt8VPInt16Int16VPInt32Int32VPInt64Int64VPWordVPWord8GHC.WordWord8VPWord16Word16VPWord32Word32VPWord64Word64VPBoolBoolVPFloatFloatVPDoubleDouble VPScientific)scientific-0.3.7.0-IjvAzRFEzKW4AZZ4kLP1wfData.Scientific ScientificVPCharVPStringGHC.BaseStringVPText text-1.2.3.2Data.Text.InternalTextVPOHVPUnit_vpInt_vpBool_vpFloat _vpDouble _vpScientific_vpChar _vpString_vpText _vpOneHotvpBoolvpCharvpDoublevpFloatvpIntvpOneHot vpScientificvpStringvpText TypeErrorHSumHProdHLeafValVRecVEnumVPrim gflattenHM gflattenGTIntCastE Int8CastE Int16CastE Int32CastE Int64CastE WordCastE Word8CastE Word16CastE Word32CastE Word64CastE BoolCastE FloatCastE DoubleCastEScientificCastE CharCastE StringCastE TextCastE OneHotCastEtoValheaderHeadergetIntMgetInt8M getInt16M getInt32M getInt64MgetWordM getWord8M getWord16M getWord32M getWord64MgetBoolM getFloatM getDoubleMgetScientificMgetCharM getStringMgetTextM getOneHotMmkRow insertMany keyToValue valueToKey Data.EitherEither headerBoxvalues dashesWithdasheshSepListseph/|/