Next: Introduction, Previous: (dir), Up: (dir) [Contents][Index]
This is the teddy Reference Manual, generated automatically by Declt version 3.0 "Montgomery Scott" on Tue Dec 22 15:11:10 2020 GMT+0.
• Introduction | What teddy is all about | |
• Systems | The systems documentation | |
• Files | The files documentation | |
• Packages | The packages documentation | |
• Definitions | The symbols documentation | |
• Indexes | Concepts, functions, variables and data types |
I want you to meet Teddy. Teddy wanna be like pandas. Pandas are cool. Teddy want be cool too!
This library provides some Common Lisp facitilies to work with data frames.
Common Lisp already has numcl to operate on arrays, and now we need a more abstract tool to work with data like data sheets.
Teddy make it possible to define a dataframe full of data, to slice it in different ways, to join data frames and see some statistics about the data.
This is a proof of the concept and API will be changed. Check the ChangeLog.md to learn about new abilities and refactoring details.
Here is how we can create a simple data-frame:
POFTHEDAY> (teddy/data-frame:make-data-frame
'("Idx" "Integers" "Uniform floats" "Gaussian")
:rows
(loop repeat 10
for idx upfrom 0
collect (list idx
(random 100)
(random 1.0)
(statistics:random-normal
:mean 5.0
:sd 0.2))))
+-----+----------+----------------+----------+
| Idx | Integers | Uniform floats | Gaussian |
+-----+----------+----------------+----------+
| 0 | 41 | 0.27 | 4.89d0 |
| 1 | 98 | 0.08 | 4.93d0 |
| 2 | 8 | 0.45 | 5.15d0 |
| 3 | 56 | 0.63 | 4.87d0 |
| 4 | 79 | 0.42 | 4.72d0 |
| 5 | 19 | 0.04 | 4.73d0 |
| 6 | 1 | 0.34 | 4.93d0 |
| 7 | 79 | 0.60 | 5.25d0 |
| 8 | 42 | 0.08 | 5.10d0 |
| 9 | 7 | 0.86 | 5.31d0 |
+-----+----------+----------------+----------+
Now we can slice it by columns, rows or both:
POFTHEDAY> (teddy/data-frame:head *d* 2)
+-----+----------+----------------+----------+
| Idx | Integers | Uniform floats | Gaussian |
+-----+----------+----------------+----------+
| 0 | 41 | 0.27 | 4.89d0 |
| 1 | 98 | 0.08 | 4.93d0 |
+-----+----------+----------------+----------+
POFTHEDAY> (teddy/data-frame:tail *d* 2)
+-----+----------+----------------+----------+
| Idx | Integers | Uniform floats | Gaussian |
+-----+----------+----------------+----------+
| 8 | 42 | 0.08 | 5.10d0 |
| 9 | 7 | 0.86 | 5.31d0 |
+-----+----------+----------------+----------+
POFTHEDAY> (teddy/data-frame:slice
*d*
:columns '("idx" "gaussian"))
+-----+----------+
| Idx | Gaussian |
+-----+----------+
| 0 | 4.89d0 |
| 1 | 4.93d0 |
| 2 | 5.15d0 |
| 3 | 4.87d0 |
| 4 | 4.72d0 |
| 5 | 4.73d0 |
| 6 | 4.93d0 |
| 7 | 5.25d0 |
| 8 | 5.10d0 |
| 9 | 5.31d0 |
+-----+----------+
POFTHEDAY> (teddy/data-frame:slice *d*
:columns '("idx" "gaussian")
:from 4
:to 6)
+-----+----------+
| Idx | Gaussian |
+-----+----------+
| 4 | 4.72d0 |
| 5 | 4.73d0 |
+-----+----------+
Also, we might want to see some descriptive statistical data about our data frame. This is pretty easy with Teddy:
POFTHEDAY> (teddy/stats:stats *d*)
+----------------+--------+--------+--------+--------+--------+-------+-------+---------+
| Column | Min | p25 | p50 | p75 | Max | Mean | SD | Sum |
+----------------+--------+--------+--------+--------+--------+-------+-------+---------+
| Idx | 0 | 2 | 4.50 | 7 | 9 | 4.50 | 3.03 | 45 |
| Integers | 1 | 8 | 41.50 | 79 | 98 | 43.00 | 34.40 | 430 |
| Uniform floats | 0.04 | 0.08 | 0.38 | 0.60 | 0.86 | 0.38 | 0.27 | 3.75 |
| Gaussian | 4.72d0 | 4.87d0 | 4.93d0 | 5.15d0 | 5.31d0 | 4.99 | 0.20 | 49.88d0 |
+----------------+--------+--------+--------+--------+--------+-------+-------+---------+
Probably, we can make some extandable protocol to calculate other properties.
Data frame stores data as columns. Each column is a vector of particular type. If you want to process a row, you can create an iterator and use it to go through rows like that:
POFTHEDAY> (loop with iterator = (teddy/data-frame:make-iterator *d*)
for row = (funcall iterator)
while row
do (format t "Row: ~S~%"
row))
Row: (0 41 0.26806116 4.887522971759381d0)
Row: (1 98 0.081421256 4.928584134866222d0)
Row: (2 8 0.45165908 5.147222819038834d0)
Row: (3 56 0.62647486 4.874349648519968d0)
Row: (4 79 0.41671002 4.7239718274963485d0)
Row: (5 19 0.04152584 4.727268395019779d0)
Row: (6 1 0.3369373 4.93339303609316d0)
Row: (7 79 0.59791017 5.2466443304900965d0)
Row: (8 42 0.076958776 5.103448455243024d0)
Row: (9 7 0.85732913 5.310498824093041d0)
Plotting facilities as rudimentary. All functions related to plotting
are in the teddy/plot
package. Right now GNUPlot
is used via
eazy-gnuplot library.
Here is how we can plot our data from all columns:
POFTHEDAY> (teddy/plot:plot *d*
"docs/media/0099/simple-plot.png")
If we want to plot only gaussian, then it will be wrong, because we need histogram type of plot. This it "to be done":
POFTHEDAY> (teddy/plot:plot
(teddy/data-frame:slice *d*
:columns '("Idx" "Gaussian"))
"docs/media/0099/gaussian.png")
Another type of plots Teddy
is able to render right now is a
"timeseries":
POFTHEDAY> (defparameter *moscow-population*
(teddy/data-frame:make-data-frame
'("Date" "Population")
:rows '(("1350-01-01" 30000)
("1840-01-01" 349000)
("1907-01-01" 1345700)
("1967-01-01" 6422000)
("1994-01-01" 9066000)
("2010-01-01" 11500000)
("2020-01-01" 12680000))))
*MOSCOW-POPULATION*
POFTHEDAY> (teddy/plot:plot-timeseries
*moscow-population* "docs/media/0099/moscow2.png"
:title "Moscow population")
"docs/media/0099/moscow.png"
Join the effort to make Teddy really useful for data analysis!
Right now, Teddy installable only from Ultralisp, because it is the best place to host unstable fast changing Common Lisp libraries.
Next: Files, Previous: Introduction, Up: Top [Contents][Index]
The main system appears first, followed by any subsystem dependency.
• The teddy system | ||
• The teddy/index system | ||
• The teddy/stats system | ||
• The teddy/print system | ||
• The teddy/plot system | ||
• The teddy/data-frame system | ||
• The teddy/utils system |
Next: The teddy/index system, Previous: Systems, Up: Systems [Contents][Index]
Alexander Artemenko <svetlyak.40wt@gmail.com>
UNLICENSE
A data framework for Common Lisp, wanna be like Pandas for Python.
asdf-finalizers
teddy.asd (file)
Next: The teddy/stats system, Previous: The teddy system, Up: Systems [Contents][Index]
Alexander Artemenko <svetlyak.40wt@gmail.com>
UNLICENSE
teddy.asd (file)
lisp.lisp (file)
Next: The teddy/print system, Previous: The teddy/index system, Up: Systems [Contents][Index]
Alexander Artemenko <svetlyak.40wt@gmail.com>
UNLICENSE
teddy.asd (file)
lisp.lisp (file)
Next: The teddy/plot system, Previous: The teddy/stats system, Up: Systems [Contents][Index]
Alexander Artemenko <svetlyak.40wt@gmail.com>
UNLICENSE
teddy.asd (file)
lisp.lisp (file)
Next: The teddy/data-frame system, Previous: The teddy/print system, Up: Systems [Contents][Index]
Alexander Artemenko <svetlyak.40wt@gmail.com>
UNLICENSE
teddy.asd (file)
lisp.lisp (file)
Next: The teddy/utils system, Previous: The teddy/plot system, Up: Systems [Contents][Index]
Alexander Artemenko <svetlyak.40wt@gmail.com>
UNLICENSE
teddy.asd (file)
lisp.lisp (file)
Previous: The teddy/data-frame system, Up: Systems [Contents][Index]
Alexander Artemenko <svetlyak.40wt@gmail.com>
UNLICENSE
teddy.asd (file)
lisp.lisp (file)
Files are sorted by type and then listed depth-first from the systems components trees.
• Lisp files |
Next: The teddy/index/lisp․lisp file, Previous: Lisp files, Up: Lisp files [Contents][Index]
/home/quickref/quicklisp/dists/quicklisp/software/teddy-20200715-git/teddy.asd
Next: The teddy/stats/lisp․lisp file, Previous: The teddy․asd file, Up: Lisp files [Contents][Index]
teddy/index (system)
index.lisp
Next: The teddy/print/lisp․lisp file, Previous: The teddy/index/lisp․lisp file, Up: Lisp files [Contents][Index]
teddy/stats (system)
stats.lisp
stats (function)
Next: The teddy/plot/lisp․lisp file, Previous: The teddy/stats/lisp․lisp file, Up: Lisp files [Contents][Index]
teddy/print (system)
print.lisp
set-num-digits-after-point (function)
make-value-formatter (function)
Next: The teddy/data-frame/lisp․lisp file, Previous: The teddy/print/lisp․lisp file, Up: Lisp files [Contents][Index]
teddy/plot (system)
plot.lisp
filename->terminal (function)
Next: The teddy/utils/lisp․lisp file, Previous: The teddy/plot/lisp․lisp file, Up: Lisp files [Contents][Index]
teddy/data-frame (system)
data-frame.lisp
Previous: The teddy/data-frame/lisp․lisp file, Up: Lisp files [Contents][Index]
teddy/utils (system)
utils.lisp
Next: Definitions, Previous: Files, Up: Top [Contents][Index]
Packages are listed by definition order.
• The teddy/index package | ||
• The teddy/stats package | ||
• The teddy/data-frame package | ||
• The teddy/plot package | ||
• The teddy/utils package |
Next: The teddy/stats package, Previous: Packages, Up: Packages [Contents][Index]
lisp.lisp (file)
common-lisp
Next: The teddy/data-frame package, Previous: The teddy/index package, Up: Packages [Contents][Index]
Next: The teddy/plot package, Previous: The teddy/stats package, Up: Packages [Contents][Index]
lisp.lisp (file)
common-lisp
set-num-digits-after-point (function)
Next: The teddy/utils package, Previous: The teddy/data-frame package, Up: Packages [Contents][Index]
lisp.lisp (file)
common-lisp
filename->terminal (function)
Previous: The teddy/plot package, Up: Packages [Contents][Index]
lisp.lisp (file)
common-lisp
Definitions are sorted by export status, category, package, and then by lexicographic order.
• Exported definitions | ||
• Internal definitions |
Next: Internal definitions, Previous: Definitions, Up: Definitions [Contents][Index]
• Exported functions | ||
• Exported generic functions |
Next: Exported generic functions, Previous: Exported definitions, Up: Exported definitions [Contents][Index]
lisp.lisp (file)
lisp.lisp (file)
Plots a timeseries where axis x has a timestamp values.
If column for axis y is not given, then second column will be used.
lisp.lisp (file)
lisp.lisp (file)
Returns a new dataframe where each column holds different stats on corresponding columns from original data-frame.
lisp.lisp (file)
Previous: Exported functions, Up: Exported definitions [Contents][Index]
Returns a cell content corresponding to the value and column-name.
lisp.lisp (file)
Previous: Exported definitions, Up: Definitions [Contents][Index]
• Internal functions | ||
• Internal generic functions | ||
• Internal classes |
Next: Internal generic functions, Previous: Internal definitions, Up: Internal definitions [Contents][Index]
Returns a number of the column
lisp.lisp (file)
lisp.lisp (file)
Transforms string or pathname into a list suitable for passing as :terminal value to eazy-gnuplot:gp-setup.
lisp.lisp (file)
Returns column by name
lisp.lisp (file)
lisp.lisp (file)
lisp.lisp (file)
lisp.lisp (file)
Returns a function from zero arguments which will return
a next row on each call. When all rows will be returned,
iterator will return nil.
Rows are returned as lists.
lisp.lisp (file)
lisp.lisp (file)
lisp.lisp (file)
lisp.lisp (file)
Internal function to getting the row index by the value.
lisp.lisp (file)
lisp.lisp (file)
lisp.lisp (file)
lisp.lisp (file)
Next: Internal classes, Previous: Internal functions, Up: Internal definitions [Contents][Index]
Column names
lisp.lisp (file)
A vector of column vectors
lisp.lisp (file)
A list of columns
lisp.lisp (file)
automatically generated reader method
lisp.lisp (file)
automatically generated reader method
lisp.lisp (file)
automatically generated reader method
lisp.lisp (file)
Returns a cell content corresponding to the row-idx and column-name.
lisp.lisp (file)
Returns a cell content corresponding to the row-idx and column-name.
Previous: Internal generic functions, Up: Internal definitions [Contents][Index]
lisp.lisp (file)
standard-object (class)
Column names
(simple-array string (*))
:names
get-column-names (generic function)
A list of columns
simple-vector
:types
get-types (generic function)
A vector of column vectors
(simple-array simple-vector (*))
:columns
get-columns (generic function)
lisp.lisp (file)
standard-object (class)
teddy/data-frame::data-frame
:data-frame
index-data-frame (generic function)
:column
index-column (generic function)
hash-table
(make-hash-table :test (quote equal))
index-positions (generic function)
Previous: Definitions, Up: Top [Contents][Index]
• Concept index | ||
• Function index | ||
• Variable index | ||
• Data type index |
Next: Function index, Previous: Indexes, Up: Indexes [Contents][Index]
Jump to: | F L T |
---|
Jump to: | F L T |
---|
Next: Variable index, Previous: Concept index, Up: Indexes [Contents][Index]
Jump to: | C E F G H I M N P R S T V |
---|
Jump to: | C E F G H I M N P R S T V |
---|
Next: Data type index, Previous: Function index, Up: Indexes [Contents][Index]
Jump to: | C D N P S T |
---|
Jump to: | C D N P S T |
---|
Previous: Variable index, Up: Indexes [Contents][Index]
Jump to: | C D I P S T |
---|
Jump to: | C D I P S T |
---|