Assistant is a data science library for Lua 5.1+
Assistant aspires to provide the tools required for real-world data management, because Lua also deserves a nice data science and data analysis library.
I'm currently the only maintainer of this project, but I would love your contributions and I'm currently looking for help.
- Label naming, be it strings, numbers, or a combination of both
- Column sorting by labels
- Printing your dataframe in the form of a spreadsheet within your console
- Smart indexing functions
- Metamethods to make the code as simple as possible
- Data analysis functions
- Plotting and visualization
- Memoize for faster indexing
- Importing and exporting data to different file formats
- Integration with Torch and Torchnet for machine learning
I would love if you contributed to Assistant, and I wouldn't like to un-inspire you from contributing, but to make the code easier to maintain in the long term, there's a conventions.txt file
These conventions are not very restricting, as long as it works there's no need to use a special method for it
-- sheet.print() is a very versatile function-- Assistant has intelligent column/row naming that allows things like this examplelocalsheet=require('assistant').sheet-- You can opt for using an array or hash table (or both)-- ['year'] = {2010, 2011, 2012, ...-- However, the array part wont be mixed with the hash partdata= {
{ 2010, 2011, 2012,
2010, 2011, 2012,
2010, 2011, 2012
} ,
{
'FCBarcelona', 'FCBarcelona',
'FCBarcelona', 'RMadrid',
'RMadrid', 'RMadrid',
'ValenciaCF', 'ValenciaCF',
'ValenciaCF'
} ,
['wins'] = {30, 28, 32, 29, 32, 26, 21, 17, 19},
['draws'] = {6, 7, 4, 5, 4, 7, 8, 10, 8},
['losses'] = {2, 3, 2, 4, 2, 5, 9, 11, 11}
}
football=sheet:new(
{data=data},
{
columns= { 'year', 'team', 'wins', 'draws', 'losses' }, -- Order columns like thisrows= {'FC1', 'FC2', 'FC3', 'RM1', 'RM2', 'RM3', 'CF1', 'CF2', 'CF3'} -- Give rows a label
}
)
--Append a new column that holds the index for every rownewRow= {
name='index',
content= {}
}
fori=1, #football.rowsdotable.insert(newRow.content, i)
endfootball:append(
newRow.name,
newRow.content, 1-- Append at position 1, that is, the first column
)
-- Print the datafootball(-1, -1, -1, {
{'index', 'year', 'team', 'wins', 'draws', 'losses'} -- Print only these columns and in this order
}) -- football() is syntactic sugar for football:print()-- You can play with this example-- sheet size is 5x9 (6x9 after appending column)Displayingallcharactersfor6columnsand9rows#indexyearteamwinsdrawslossesFC112010FCBarcelona3062FC222011FCBarcelona2873FC332012FCBarcelona3242RM142010RMadrid2954RM252011RMadrid3242RM362012RMadrid2675CF172010ValenciaCF2189CF282011ValenciaCF171011CF392012ValenciaCF19811Sheetsize: 6x9 (colxrow)