Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
lesson_8 [2019/08/13 13:49]
argemiro ↷ Page name changed from lesson_9 to lesson_8
lesson_8 [2019/08/30 23:40]
argemiro
Line 1: Line 1:
 {{ :​logo_logo.png?​400 |}} {{ :​logo_logo.png?​400 |}}
 \\ \\
-=====MODULE III: Working with tables on Dinamica EGO===== +
-\\ +
-Work with tables is critical in data manipulation and most of these operations can be performed on Dinamica EGO. +
 \\ \\
-=====LESSON 8: Inserting a specific value, creating a new column and retrieving ​data column=====  ​+=====LESSON 8: Inserting ​and getting ​a specific value into table=====  ​
 \\ \\
 ==This lesson is focused on helping you to get and insert a specific value into a table on Dinamica.== ==This lesson is focused on helping you to get and insert a specific value into a table on Dinamica.==
Line 100: Line 98:
  
 {{ :​imagem42.png?​600 |}} {{ :​imagem42.png?​600 |}}
-  
-**In the first step of this lesson**, your model is loading “IBGE_crop_information.csv” file and then getting and inserting a specific value into a table. The new table will be saved with a crop 1 on year 2001 been divided by 1000. 
- 
-**Now, Go ahead** to create a new column in the given table 
-\\ 
-\\ 
-We must open all the files that will be used. Click on the Input/​output tab from the library window and grab three “Load Lookup Table” Functors and one “Load Table” and place it on the sketch. Open the Load Lookup Table functors and load the files 1999_production_value.csv,​ 1999_harvested_area.csv and 1999_production.csv from folder “Tables”. Next, Open the Load Table functor and load the file IBGE_crop_information_uptated.csv. 
-{{ :​imagem43.png?​200 |}} 
-\\ 
-\\ 
-Now, can create a new column merge with 1999_harvested_area.csv and 1999_production.csv files. Click on the Input/​output tab from the library window and grab a Add Table Column and place it on the sketch. Connect the Load Lookup Table which contains the file 1999_harvested_area.csv to Add Table Column. On the Functor Editor window, write a name for the created column (it can be “production_value”). ​ 
-\\ 
-\\ 
-<note important>​**IMPORTANT:​** The position where the new column is inserted determines whether the new column is a key or data column.</​note>​ 
-\\ 
-\\ 
-{{ :​imagem44.png?​500 |}} 
-\\ 
-\\ 
-Connect the Load Lookup Table which contains the file 1999_production.csv to Add Table Column. Finally, connect the Load Lookup Table which contains the file IBGE_crop_information_uptated.csv to Set Table by Key. 
-Now you need to save the result to a file. For this, open Save Map functor and browse to the Dinamica EGO\Guidebook Dinamica_4\Models\Set_2\basics\ to determine where the file will be saved and write the name file (Suggestion:​ “IBGE_crop_information_complete.csv”).\\ \\ 
-Mark the eye button at the top of “Save Table” to viewer the results hereafter. \\ \\ 
-Click on the layout tool Left to Right and your final model will look like the one below: \\ \\ 
-{{ :​imagem45.png?​500 |}} 
-\\ 
-\\ 
-Save and run the model! \\ 
-Now, click on eye button of “Save Table” to see the result. This functor output is table that looks like this: 
-\\ 
-\\ 
-{{ :​imagem46.png?​500 |}} 
-\\ 
-\\ 
-Now, using the table generated previously, we would like to demonstrate how to retrieves a data column from the specified table. 
-\\ 
-\\ 
-First, grab a “Load Table” and place it on the sketch. Double click the Load Table Functor and open the IBGE_crop_information_complete.csv file. 
-\\ 
-\\ 
- {{ :​imagem47.png?​500 |}} 
-\\ 
-\\ 
- 
-Now, we can retrieve data column table corresponding to harvested area. For this, grab a “Get Table Column functor” and place it on the sketch. Connect the Load Table to Get Table Column. In the tab “Column Index or Name”, insert the index of the column to be retrieved (“3” or “harvested area”). 
-  ​ 
-\\ 
-\\ 
-{{ :​imagem48.png?​500 |}} 
-\\ 
-\\ 
-Now, we can retrieve the harvested area per crop corresponding to 2004 year.  For this, grab a “Get Table from key” and place it on the sketch. Connect the Get Table Column to Get Table from Key. In the tab “Keys”, insert the year you want to retrieve the harvested area per crop (In this example, “2004”). 
-\\ 
-\\ 
-{{ :​imagem49.png?​500 |}} 
-\\ 
-\\ 
- 
-Now, grab a “Save Table” and place it on the sketch. Connect the functor Get Table from Key and Save Table. The final model will look like this:  
-\\ 
-\\ 
-{{ :​imagem50.png?​500 |}} 
-\\ 
-\\ 
-  
-Now you need to save the result to a file. Open Save Map, browse to the Documents\GuideBook Dinamica\Guidebook Dinamica_4\Models\Set_2\basics\ Get_Table_from_Key and write the name file (it can be IBGE_crop_information_update.csv). 
-\\ 
-\\ 
-{{ :​imagem51.png?​500 |}} 
-\\ 
-\\ 
-  
-Mark the eye button at the top of “Save Table” to viewer the results hereafter. ​ 
-Click on the layout tool Left to Right and your final model will look like the one below: ​ 
  \\  \\
 \\ \\
-{{ :​imagem52.png?​500 |}} +Congratulations,​ you have successfully completed this lesson! Now let’s move to the **next lesson:** [[lesson_9|LESSON 9Working with maps and tables iteratively]]
-\\ +
-\\ +
- +
-Save and run the model! +
-Now, click on eye button of “Save Table” ​to see the result. This functor output is table that looks like this: +
-\\ +
-\\ +
-{{ :imagem53.png?​300 |}} +
-\\ +
-\\ +
- +
- +