 Timestamp:
 05/02/19 01:10:47 (3 months ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

wiki/eggref/5/dataframe
r37571 r37572 8 8 == Documentation 9 9 10 The <code>dataframe</code>library provides an interface for10 The {{dataframe}} library provides an interface for 11 11 representing numerical data in tables with rows and columns. It is 12 12 inspired by the various dataframe implementations found in R, Python 13 13 and Racket. 14 14 15 The <code>dataframe</code>library also provides functions for loading15 The {{dataframe}} library also provides functions for loading 16 16 and saving data from data frames as well as routines for descriptive 17 17 statistics and linear regression. … … 24 24 on columns. 25 25 26 <procedure> 27 (column? obj) 28 </procedure> 26 <procedure>(column? obj)</procedure> 29 27 Returns true if the given object is a column. 30 28 31 <procedure> 32 (getcolumnproperties column) 33 </procedure> 29 <procedure>(getcolumnproperties column)</procedure> 34 30 Returns an associative list with column properties. 35 31 36 <procedure> 37 (getcolumnkey column) 38 </procedure> 32 <procedure>(getcolumnkey column)</procedure> 39 33 Returns the key of the column. 40 34 41 <procedure> 42 (getcolumncollection column) 43 </procedure> 35 <procedure>(getcolumncollection column)</procedure> 44 36 Returns the data collection of the column. 45 37 46 <procedure> 47 (columndeserialize column port) 48 </procedure> 38 <procedure>(columndeserialize column port)</procedure> 49 39 Loads the data collection of a column from the given port. 50 40 51 <procedure> 52 (columnserialize column port) 53 </procedure> 41 <procedure>(columnserialize column port)</procedure> 54 42 Stores the data collection of a column to the given port in an sexpression format. 55 43 56 44 === Creating data frames 57 45 58 <procedure> 59 (makedataframe [columnkeycompare: comparesymbol]) 60 </procedure> 46 <procedure>(makedataframe [columnkeycompare: comparesymbol])</procedure> 61 47 Creates a new dataframe, with optional argument a procedure that specifies how to compare column keys. Default is comparison on symbols. Returns the new dataframe. 62 48 63 <procedure> 64 (dfinsertcolumn df key collection properties) 65 </procedure> 49 <procedure>(dfinsertcolumn df key collection properties)</procedure> 66 50 Inserts a new column with the given key, data collection, and properties. Returns a new dataframe with the inserted column. 67 51 68 <procedure> 69 (dfinsertderived df parentkey key proc properties) 70 </procedure> 52 <procedure>(dfinsertderived df parentkey key proc properties)</procedure> 71 53 Inserts a derived column, that is a column whose data elements are obtained by mapping a procedure onto the elements of an existing (parent) column. Returns a new dataframe with the inserted column. 72 54 73 <procedure> 74 (dfinsertcolumns df lseq) 75 </procedure> 55 <procedure>(dfinsertcolumns df lseq)</procedure> 76 56 Inserts the columns contained in the given lseq of column objects. 77 57 78 58 === Accessing data frames 79 59 80 <procedure> 81 (show df) 82 </procedure> 60 <procedure>(show df)</procedure> 83 61 Displays a subset of the rows and columns contained in the dataframe. 84 62 85 <procedure> 86 (rowcount df) 87 </procedure> 63 <procedure>(rowcount df)</procedure> 88 64 Returns the number of rows in the dataframe. 89 65 90 <procedure> 91 (dfcolumn df key) 92 </procedure> 66 <procedure>(dfcolumn df key)</procedure> 93 67 Returns the column indicated by the given key. 94 68 95 <procedure> 96 (dfcolumns df) 97 </procedure> 69 <procedure>(dfcolumns df)</procedure> 98 70 Returns a lazy sequence containing the columns of the dataframe. 99 71 100 <procedure> 101 (dffiltercolumns df proc) 102 </procedure> 72 <procedure>(dffiltercolumns df proc)</procedure> 103 73 Returns a filtered lseq of the columns of the dataframe according to the given filter predicate procedure. 104 74 105 <procedure> 106 (dfselectcolumns df keys) 107 </procedure> 75 <procedure>(dfselectcolumns df keys)</procedure> 108 76 Returns an lseq of the columns of the dataframe that have the keys enumerated in the given list of keys. 109 77 110 <procedure> 111 (dfkeys df) 112 </procedure> 78 <procedure>(dfkeys df)</procedure> 113 79 Returns the keys of all columns in the dataframe. 114 80 115 <procedure> 116 (dfitems df) 117 </procedure> 81 <procedure>(dfitems df)</procedure> 118 82 Returns an lseq of the keycolumn pairs contained in the dataframe. 119 83 120 <procedure> 121 (applycollections proc df key ...) 122 </procedure> 84 <procedure>(applycollections proc df key ...)</procedure> 123 85 Applies the given procedure to the data collections of the named columns of the dataframe and returns the result as a list. 124 86 125 <procedure> 126 (applycolumns proc df key ...) 127 </procedure> 87 <procedure>(applycolumns proc df key ...)</procedure> 128 88 Applies the given procedure to the named columns of the dataframe and returns the result as a list. 129 89 130 <procedure> 131 (mapcollections proc df key ...) 132 </procedure> 90 <procedure>(mapcollections proc df key ...)</procedure> 133 91 Applies the given procedure to the data collections of the named columns of the dataframe and returns the result as a dataframe. 134 92 135 <procedure> 136 (mapcolumns proc df key ...) 137 </procedure> 93 <procedure>(mapcolumns proc df key ...)</procedure> 138 94 Applies the given procedure to the named columns of the dataframe and returns the result as a dataframe. 139 95 140 <procedure> 141 (reducecollections proc df seed key ...) 142 </procedure> 96 <procedure>(reducecollections proc df seed key ...)</procedure> 143 97 Fold over the data collections of the named columns. 144 98 145 99 === Iterators 146 100 147 <procedure> 148 (dfforeachcolumn df proc) 149 </procedure> 101 <procedure>(dfforeachcolumn df proc)</procedure> 150 102 Applies proc to each column. 151 103 152 <procedure> 153 (dfforeachcollection df proc) 154 </procedure> 104 <procedure>(dfforeachcollection df proc)</procedure> 155 105 Applies proc to the data collection of each column. 156 106 157 <procedure> 158 (dfgenrows df) 159 </procedure> 107 <procedure>(dfgenrows df)</procedure> 160 108 Returns a generator procedure that returns the dataframe rows in succession. 161 109 162 <procedure> 163 (dfgencolumns df) 164 </procedure> 110 <procedure>(dfgencolumns df)</procedure> 165 111 Returns a generator procedure the returns the dataframe columns in succession. 166 112 167 113 === Descriptive statistics 168 114 169 <procedure> 170 (describe df port) 171 </procedure> 115 <procedure>(describe df port)</procedure> 172 116 Displays a table with the min/max/mean/sdev of each column in the dataframe. 173 117 174 <procedure> 175 (cmin df) 176 </procedure> 118 <procedure>(cmin df)</procedure> 177 119 Computes the minimum value of each column. 178 120 179 <procedure> 180 (cmax df) 181 </procedure> 121 <procedure>(cmax df)</procedure> 182 122 Computes the maximum value of each column. 183 123 184 <procedure> 185 (mean df) 186 </procedure> 124 <procedure>(mean df)</procedure> 187 125 Computes the mean value of each column. 188 126 189 <procedure> 190 (median df) 191 </procedure> 127 <procedure>(median df)</procedure> 192 128 Computes the median value of each column. 193 129 194 <procedure> 195 (mode df) 196 </procedure> 130 <procedure>(mode df)</procedure> 197 131 Computes the mode value of each column. 198 132 199 <procedure> 200 (range df) 201 </procedure> 133 <procedure>(range df)</procedure> 202 134 Computes the difference between maximum and minimum value of each column. 203 135 204 <procedure> 205 (percentile df) 206 </procedure> 136 <procedure>(percentile df)</procedure> 207 137 Computes the percentile values of each column. 208 138 209 <procedure> 210 (variance df) 211 </procedure> 139 <procedure>(variance df)</procedure> 212 140 Computes the variance of each column. 213 141 214 <procedure> 215 (standarddeviation df) 216 </procedure> 142 <procedure>(standarddeviation df)</procedure> 217 143 Computes the standard deviation of each column. 218 144 219 <procedure> 220 (coefficientofvariation df) 221 </procedure> 145 <procedure>(coefficientofvariation df)</procedure> 222 146 Computes the coefficient of variation of each column. 223 147 224 148 === Regression and correlation 225 149 226 <procedure> 227 (linearregression df x y) 228 </procedure> 150 <procedure>(linearregression df x y)</procedure> 229 151 Linear regression between columns x and y. 230 152 231 <procedure> 232 (correlationcoefficient df x y) 233 </procedure> 153 <procedure>(correlationcoefficient df x y)</procedure> 234 154 Correlation coefficient between columns x and y. 235 155 236 156 === I/O 237 157 238 <procedure> 239 (dfserialize df port) 240 </procedure> 158 <procedure>(dfserialize df port)</procedure> 241 159 Stores the dataframe in an sexpression format to the given port. 242 160 243 <procedure> 244 (dfdeserialize df port) 245 </procedure> 161 <procedure>(dfdeserialize df port)</procedure> 246 162 Loads the data collections of the dataframe columns from the given port. 247 163
Note: See TracChangeset
for help on using the changeset viewer.