To be able to work with data in a ML Project, they first need to be loaded. Data can be loaded from a CSV file, XLS file, database, data set or a temporary table. There two ways how to read data in BellaDati ML Studio - row by row or as an stream.
Reading CSV File
Function readCSVFile() is used for loading data from a CSV file. The funcionis defined like this:
readCSVFile(String file, String separator, String escape, int limit, Closure<Object> closure)
Parameters file and separator are mandatory, parameters escape, limit and closure are optional.
Example usage
def rows = 0 readCSVFile('file.csv', ',', '', 10) { rows++ println index println values[1] } println rows
This code will print the row index and value of second column for first 10 rows of the file to the console. After finishing the loop it will display the total number of iterations, in this case 10.
aplikovatelné na DB, Dataset, file
readtable - načtení dočasné tabulky - plátná v rámci session
row by row
- cyklus - pro každá řádek se vykoná obsah cyklu
- v každém cyklu se nastaví řádek, hodnoty, názvy sloupů a indexy
stream
-neiteruje se
- použití např s python skripty