Fer-geo commited on
Commit
2c7b8b6
·
1 Parent(s): 29b611d
requirements.txt CHANGED
@@ -1,3 +1,5 @@
1
  langchain==0.0.227
2
  openai==0.27.8
3
- duckduckgo-search
 
 
 
1
  langchain==0.0.227
2
  openai==0.27.8
3
+ duckduckgo-search
4
+ chat2plot
5
+ nbformat
streamlit_agent/Custom_tool.ipynb ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": 2,
6
+ "metadata": {},
7
+ "outputs": [],
8
+ "source": [
9
+ "# Import things that are needed generically\n",
10
+ "from langchain import LLMMathChain, SerpAPIWrapper\n",
11
+ "from langchain.agents import AgentType, initialize_agent\n",
12
+ "from langchain.chat_models import ChatOpenAI\n",
13
+ "from langchain.tools import BaseTool, StructuredTool, Tool, tool"
14
+ ]
15
+ },
16
+ {
17
+ "cell_type": "code",
18
+ "execution_count": 3,
19
+ "metadata": {},
20
+ "outputs": [],
21
+ "source": [
22
+ "llm = ChatOpenAI(temperature=0)"
23
+ ]
24
+ },
25
+ {
26
+ "cell_type": "code",
27
+ "execution_count": null,
28
+ "metadata": {},
29
+ "outputs": [],
30
+ "source": [
31
+ "# Load the tool configs that are needed.\n",
32
+ "search = SerpAPIWrapper()\n",
33
+ "llm_math_chain = LLMMathChain(llm=llm, verbose=True)\n",
34
+ "tools = [\n",
35
+ " Tool.from_function(\n",
36
+ " func=search.run,\n",
37
+ " name=\"Search\",\n",
38
+ " description=\"useful for when you need to answer questions about current events\"\n",
39
+ " # coroutine= ... <- you can specify an async method if desired as well\n",
40
+ " ),\n",
41
+ "]"
42
+ ]
43
+ },
44
+ {
45
+ "cell_type": "code",
46
+ "execution_count": null,
47
+ "metadata": {},
48
+ "outputs": [],
49
+ "source": [
50
+ "from pydantic import BaseModel, Field\n",
51
+ "\n",
52
+ "\n",
53
+ "class CalculatorInput(BaseModel):\n",
54
+ " question: str = Field()\n",
55
+ "\n",
56
+ "\n",
57
+ "tools.append(\n",
58
+ " Tool.from_function(\n",
59
+ " func=llm_math_chain.run,\n",
60
+ " name=\"Calculator\",\n",
61
+ " description=\"useful for when you need to answer questions about math\",\n",
62
+ " args_schema=CalculatorInput\n",
63
+ " # coroutine= ... <- you can specify an async method if desired as well\n",
64
+ " )\n",
65
+ ")\n",
66
+ "\n"
67
+ ]
68
+ }
69
+ ],
70
+ "metadata": {
71
+ "kernelspec": {
72
+ "display_name": "Python 3",
73
+ "language": "python",
74
+ "name": "python3"
75
+ },
76
+ "language_info": {
77
+ "codemirror_mode": {
78
+ "name": "ipython",
79
+ "version": 3
80
+ },
81
+ "file_extension": ".py",
82
+ "mimetype": "text/x-python",
83
+ "name": "python",
84
+ "nbconvert_exporter": "python",
85
+ "pygments_lexer": "ipython3",
86
+ "version": "3.11.4"
87
+ },
88
+ "orig_nbformat": 4
89
+ },
90
+ "nbformat": 4,
91
+ "nbformat_minor": 2
92
+ }
streamlit_agent/Untitled-1.ipynb CHANGED
@@ -6,26 +6,287 @@
6
  "metadata": {},
7
  "outputs": [
8
  {
9
- "ename": "OperationalError",
10
- "evalue": "unable to open database file",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  "output_type": "error",
12
  "traceback": [
13
  "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
14
- "\u001b[1;31mOperationalError\u001b[0m Traceback (most recent call last)",
15
- "Cell \u001b[1;32mIn[2], line 4\u001b[0m\n\u001b[0;32m 1\u001b[0m \u001b[39mimport\u001b[39;00m \u001b[39mpandas\u001b[39;00m \u001b[39mas\u001b[39;00m \u001b[39mpd\u001b[39;00m\n\u001b[0;32m 2\u001b[0m \u001b[39mimport\u001b[39;00m \u001b[39msqlite3\u001b[39;00m\n\u001b[1;32m----> 4\u001b[0m conn \u001b[39m=\u001b[39m sqlite3\u001b[39m.\u001b[39;49mconnect(\u001b[39m'\u001b[39;49m\u001b[39mstreamlit_agent\u001b[39;49m\u001b[39m\\\u001b[39;49m\u001b[39msitios2.sqlite\u001b[39;49m\u001b[39m'\u001b[39;49m)\n\u001b[0;32m 5\u001b[0m df \u001b[39m=\u001b[39m pd\u001b[39m.\u001b[39mread_sql_query(\u001b[39m\"\u001b[39m\u001b[39mSELECT * FROM sitiospilotojson\u001b[39m\u001b[39m\"\u001b[39m, conn)\n\u001b[0;32m 6\u001b[0m conn\u001b[39m.\u001b[39mclose()\n",
16
- "\u001b[1;31mOperationalError\u001b[0m: unable to open database file"
17
  ]
18
  }
19
  ],
20
  "source": [
 
21
  "import pandas as pd\n",
22
- "import sqlite3\n",
23
  "\n",
24
- "conn = sqlite3.connect('streamlit_agent\\sitios2.sqlite')\n",
25
- "df = pd.read_sql_query(\"SELECT * FROM sitiospilotojson\", conn)\n",
26
- "conn.close()\n",
27
  "\n",
28
- "df"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
  ]
30
  }
31
  ],
 
6
  "metadata": {},
7
  "outputs": [
8
  {
9
+ "data": {
10
+ "text/html": [
11
+ "<div>\n",
12
+ "<style scoped>\n",
13
+ " .dataframe tbody tr th:only-of-type {\n",
14
+ " vertical-align: middle;\n",
15
+ " }\n",
16
+ "\n",
17
+ " .dataframe tbody tr th {\n",
18
+ " vertical-align: top;\n",
19
+ " }\n",
20
+ "\n",
21
+ " .dataframe thead th {\n",
22
+ " text-align: right;\n",
23
+ " }\n",
24
+ "</style>\n",
25
+ "<table border=\"1\" class=\"dataframe\">\n",
26
+ " <thead>\n",
27
+ " <tr style=\"text-align: right;\">\n",
28
+ " <th></th>\n",
29
+ " <th>spoat</th>\n",
30
+ " <th>ecorregion</th>\n",
31
+ " <th>sag</th>\n",
32
+ " <th>provincia</th>\n",
33
+ " <th>supha</th>\n",
34
+ " <th>area</th>\n",
35
+ " <th>departamento</th>\n",
36
+ " </tr>\n",
37
+ " </thead>\n",
38
+ " <tbody>\n",
39
+ " <tr>\n",
40
+ " <th>0</th>\n",
41
+ " <td>Monte ribereno, talares orientales y bahia de ...</td>\n",
42
+ " <td>Pampa</td>\n",
43
+ " <td>ARBA - Gerencia de Servicios Catastrales</td>\n",
44
+ " <td>BUENOS AIRES</td>\n",
45
+ " <td>977451.943</td>\n",
46
+ " <td>977452</td>\n",
47
+ " <td>Magdalena</td>\n",
48
+ " </tr>\n",
49
+ " <tr>\n",
50
+ " <th>1</th>\n",
51
+ " <td>Sudoeste de Buenos Aires</td>\n",
52
+ " <td>Espinal</td>\n",
53
+ " <td>ARBA - Gerencia de Servicios Catastrales</td>\n",
54
+ " <td>BUENOS AIRES</td>\n",
55
+ " <td>2357878.315</td>\n",
56
+ " <td>2357877</td>\n",
57
+ " <td>Patagones</td>\n",
58
+ " </tr>\n",
59
+ " <tr>\n",
60
+ " <th>2</th>\n",
61
+ " <td>Delta del rio Parana</td>\n",
62
+ " <td>Delta e islas del rio Parana</td>\n",
63
+ " <td>ARBA - Gerencia de Servicios Catastrales</td>\n",
64
+ " <td>BUENOS AIRES</td>\n",
65
+ " <td>202074.295</td>\n",
66
+ " <td>202074</td>\n",
67
+ " <td>Campana</td>\n",
68
+ " </tr>\n",
69
+ " <tr>\n",
70
+ " <th>3</th>\n",
71
+ " <td>Hornocal - Valle Grande</td>\n",
72
+ " <td>Puna/Selva de las Yungas</td>\n",
73
+ " <td>Direc. Grl. de Inmuebles</td>\n",
74
+ " <td>JUJUY</td>\n",
75
+ " <td>287358.817</td>\n",
76
+ " <td>287359</td>\n",
77
+ " <td>Valle Gran</td>\n",
78
+ " </tr>\n",
79
+ " <tr>\n",
80
+ " <th>4</th>\n",
81
+ " <td>Susques - Jama - Catua - Olaroz</td>\n",
82
+ " <td>Puna/Altos Andes</td>\n",
83
+ " <td>Direc. Grl. de Inmuebles</td>\n",
84
+ " <td>JUJUY</td>\n",
85
+ " <td>268648.734</td>\n",
86
+ " <td>268649</td>\n",
87
+ " <td>Susques</td>\n",
88
+ " </tr>\n",
89
+ " <tr>\n",
90
+ " <th>5</th>\n",
91
+ " <td>Piedemonte Andino del Area Metropolitana de Me...</td>\n",
92
+ " <td>Altos Andes/Monte de Llanuras y Mesetas/Monte ...</td>\n",
93
+ " <td>IDE Mendoza</td>\n",
94
+ " <td>MENDOZA</td>\n",
95
+ " <td>31905.735</td>\n",
96
+ " <td>31906</td>\n",
97
+ " <td>Capital</td>\n",
98
+ " </tr>\n",
99
+ " <tr>\n",
100
+ " <th>6</th>\n",
101
+ " <td>Piedemonte del Valle de Uco</td>\n",
102
+ " <td>Altos Andes/Monte de Llanuras y Mesetas/Estepa...</td>\n",
103
+ " <td>IDE Mendoza</td>\n",
104
+ " <td>MENDOZA</td>\n",
105
+ " <td>48565.495</td>\n",
106
+ " <td>48565</td>\n",
107
+ " <td>Tupungato</td>\n",
108
+ " </tr>\n",
109
+ " <tr>\n",
110
+ " <th>7</th>\n",
111
+ " <td>Oasis Norte - Cinturon Verde</td>\n",
112
+ " <td>Monte de Llanuras y Mesetas</td>\n",
113
+ " <td>IDE Mendoza</td>\n",
114
+ " <td>MENDOZA</td>\n",
115
+ " <td>71719.634</td>\n",
116
+ " <td>71720</td>\n",
117
+ " <td>GuaymallÃ</td>\n",
118
+ " </tr>\n",
119
+ " <tr>\n",
120
+ " <th>8</th>\n",
121
+ " <td>Laguna Llancanelo - Cuenca del Rio Malargue</td>\n",
122
+ " <td>Altos Andes/Estepa Patagonica</td>\n",
123
+ " <td>IDE Mendoza</td>\n",
124
+ " <td>MENDOZA</td>\n",
125
+ " <td>54999.000</td>\n",
126
+ " <td>54999</td>\n",
127
+ " <td>Malargï</td>\n",
128
+ " </tr>\n",
129
+ " </tbody>\n",
130
+ "</table>\n",
131
+ "</div>"
132
+ ],
133
+ "text/plain": [
134
+ " spoat \\\n",
135
+ "0 Monte ribereno, talares orientales y bahia de ... \n",
136
+ "1 Sudoeste de Buenos Aires \n",
137
+ "2 Delta del rio Parana \n",
138
+ "3 Hornocal - Valle Grande \n",
139
+ "4 Susques - Jama - Catua - Olaroz \n",
140
+ "5 Piedemonte Andino del Area Metropolitana de Me... \n",
141
+ "6 Piedemonte del Valle de Uco \n",
142
+ "7 Oasis Norte - Cinturon Verde \n",
143
+ "8 Laguna Llancanelo - Cuenca del Rio Malargue \n",
144
+ "\n",
145
+ " ecorregion \\\n",
146
+ "0 Pampa \n",
147
+ "1 Espinal \n",
148
+ "2 Delta e islas del rio Parana \n",
149
+ "3 Puna/Selva de las Yungas \n",
150
+ "4 Puna/Altos Andes \n",
151
+ "5 Altos Andes/Monte de Llanuras y Mesetas/Monte ... \n",
152
+ "6 Altos Andes/Monte de Llanuras y Mesetas/Estepa... \n",
153
+ "7 Monte de Llanuras y Mesetas \n",
154
+ "8 Altos Andes/Estepa Patagonica \n",
155
+ "\n",
156
+ " sag provincia supha \\\n",
157
+ "0 ARBA - Gerencia de Servicios Catastrales BUENOS AIRES 977451.943 \n",
158
+ "1 ARBA - Gerencia de Servicios Catastrales BUENOS AIRES 2357878.315 \n",
159
+ "2 ARBA - Gerencia de Servicios Catastrales BUENOS AIRES 202074.295 \n",
160
+ "3 Direc. Grl. de Inmuebles JUJUY 287358.817 \n",
161
+ "4 Direc. Grl. de Inmuebles JUJUY 268648.734 \n",
162
+ "5 IDE Mendoza MENDOZA 31905.735 \n",
163
+ "6 IDE Mendoza MENDOZA 48565.495 \n",
164
+ "7 IDE Mendoza MENDOZA 71719.634 \n",
165
+ "8 IDE Mendoza MENDOZA 54999.000 \n",
166
+ "\n",
167
+ " area departamento \n",
168
+ "0 977452 Magdalena \n",
169
+ "1 2357877 Patagones \n",
170
+ "2 202074 Campana \n",
171
+ "3 287359 Valle Gran \n",
172
+ "4 268649 Susques \n",
173
+ "5 31906 Capital \n",
174
+ "6 48565 Tupungato \n",
175
+ "7 71720 Guaymallà \n",
176
+ "8 54999 Malargï "
177
+ ]
178
+ },
179
+ "execution_count": 2,
180
+ "metadata": {},
181
+ "output_type": "execute_result"
182
+ }
183
+ ],
184
+ "source": [
185
+ "import pandas as pd\n",
186
+ "import sqlite3\n",
187
+ "\n",
188
+ "conn = sqlite3.connect('sitios2.sqlite')\n",
189
+ "df = pd.read_sql_query(\"SELECT spoat, ecorregion, sag, provincia, supha, area, departamento FROM sitiospilotojson\", conn)\n",
190
+ "conn.close()\n",
191
+ "\n",
192
+ "df"
193
+ ]
194
+ },
195
+ {
196
+ "cell_type": "code",
197
+ "execution_count": 2,
198
+ "metadata": {},
199
+ "outputs": [
200
+ {
201
+ "ename": "ValueError",
202
+ "evalue": "dictionary update sequence element #0 has length 4; 2 is required",
203
  "output_type": "error",
204
  "traceback": [
205
  "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
206
+ "\u001b[1;31mValueError\u001b[0m Traceback (most recent call last)",
207
+ "Cell \u001b[1;32mIn[2], line 8\u001b[0m\n\u001b[0;32m 4\u001b[0m file_to_read \u001b[39m=\u001b[39m \u001b[39mopen\u001b[39m(\u001b[39m\"\u001b[39m\u001b[39mD:/hugging/Agent/streamlit_agent/runs/alanis.pickle\u001b[39m\u001b[39m\"\u001b[39m, \u001b[39m\"\u001b[39m\u001b[39mrb\u001b[39m\u001b[39m\"\u001b[39m)\n\u001b[0;32m 6\u001b[0m loaded_dictionary \u001b[39m=\u001b[39m pickle\u001b[39m.\u001b[39mload(file_to_read)\n\u001b[1;32m----> 8\u001b[0m \u001b[39mprint\u001b[39m(\u001b[39mdict\u001b[39;49m(loaded_dictionary))\n\u001b[0;32m 9\u001b[0m \u001b[39m# person1 = {\"name\": \"Marcus King\", \"Age\": \"22\", \"Profession\" : \"Author\"}\u001b[39;00m\n\u001b[0;32m 10\u001b[0m \n\u001b[0;32m 11\u001b[0m \u001b[39m# pickle.dump(person1, open(\"person1.p\", \"wb\"))\u001b[39;00m\n\u001b[1;32m (...)\u001b[0m\n\u001b[0;32m 15\u001b[0m \u001b[39m# # obj = pd.read_pickle(open(\"D:/hugging/Agent/streamlit_agent/runs/alanis.pickle\",\"rb\"))\u001b[39;00m\n\u001b[0;32m 16\u001b[0m \u001b[39m# print(obj)\u001b[39;00m\n",
208
+ "\u001b[1;31mValueError\u001b[0m: dictionary update sequence element #0 has length 4; 2 is required"
209
  ]
210
  }
211
  ],
212
  "source": [
213
+ "import pickle\n",
214
  "import pandas as pd\n",
 
215
  "\n",
216
+ "file_to_read = open(\"D:/hugging/Agent/streamlit_agent/runs/alanis.pickle\", \"rb\")\n",
 
 
217
  "\n",
218
+ "loaded_dictionary = pickle.load(file_to_read)\n",
219
+ "\n",
220
+ "print(dict(loaded_dictionary))\n",
221
+ "# person1 = {\"name\": \"Marcus King\", \"Age\": \"22\", \"Profession\" : \"Author\"}\n",
222
+ "\n",
223
+ "# pickle.dump(person1, open(\"person1.p\", \"wb\"))\n",
224
+ "# file = open(\"D:/hugging/Agent/streamlit_agent/runs/alanis.pickle\",\"rb\")\n",
225
+ "# obj = pickle.load(file, fix_imports = True, encoding = 'ASCII', errors = 'strict')\n",
226
+ "# # obj = pickle.load(open(\"D:/hugging/Agent/streamlit_agent/runs/alanis.pickle\",\"rb\"))\n",
227
+ "# # obj = pd.read_pickle(open(\"D:/hugging/Agent/streamlit_agent/runs/alanis.pickle\",\"rb\"))\n",
228
+ "# print(obj)"
229
+ ]
230
+ },
231
+ {
232
+ "cell_type": "code",
233
+ "execution_count": 4,
234
+ "metadata": {},
235
+ "outputs": [],
236
+ "source": [
237
+ "import shelve\n",
238
+ "filename = \"D:/hugging/Agent/streamlit_agent/runs/alanis\"\n",
239
+ "d = shelve.open(filename) # open -- file may get suffix added by low-level\n",
240
+ " # library\n",
241
+ " \n"
242
+ ]
243
+ },
244
+ {
245
+ "cell_type": "code",
246
+ "execution_count": 7,
247
+ "metadata": {},
248
+ "outputs": [
249
+ {
250
+ "name": "stdout",
251
+ "output_type": "stream",
252
+ "text": [
253
+ "<shelve.DbfilenameShelf object at 0x000001F51BA9F710> []\n"
254
+ ]
255
+ }
256
+ ],
257
+ "source": [
258
+ "print(d,list(d.values()))"
259
+ ]
260
+ },
261
+ {
262
+ "cell_type": "code",
263
+ "execution_count": null,
264
+ "metadata": {},
265
+ "outputs": [],
266
+ "source": [
267
+ "d[key] = data # store data at key (overwrites old data if\n",
268
+ " # using an existing key)\n",
269
+ "data = d[key] # retrieve a COPY of data at key (raise KeyError if no\n",
270
+ " # such key)\n",
271
+ "del d[key] # delete data stored at key (raises KeyError\n",
272
+ " # if no such key)\n",
273
+ "flag = key in d # true if the key exists\n",
274
+ "klist = list(d.keys()) # a list of all existing keys (slow!)\n",
275
+ "\n",
276
+ "# as d was opened WITHOUT writeback=True, beware:\n",
277
+ "d['xx'] = [0, 1, 2] # this works as expected, but...\n",
278
+ "d['xx'].append(3) # *this doesn't!* -- d['xx'] is STILL [0, 1, 2]!\n",
279
+ "\n",
280
+ "# having opened d without writeback=True, you need to code carefully:\n",
281
+ "temp = d['xx'] # extracts the copy\n",
282
+ "temp.append(5) # mutates the copy\n",
283
+ "d['xx'] = temp # stores the copy right back, to persist it\n",
284
+ "\n",
285
+ "# or, d=shelve.open(filename,writeback=True) would let you just code\n",
286
+ "# d['xx'].append(5) and have it work as expected, BUT it would also\n",
287
+ "# consume more memory and make the d.close() operation slower.\n",
288
+ "\n",
289
+ "d.close() # close it"
290
  ]
291
  }
292
  ],
streamlit_agent/chat2plot.ipynb ADDED
@@ -0,0 +1,1982 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": 3,
6
+ "metadata": {},
7
+ "outputs": [
8
+ {
9
+ "data": {
10
+ "text/html": [
11
+ "<div>\n",
12
+ "<style scoped>\n",
13
+ " .dataframe tbody tr th:only-of-type {\n",
14
+ " vertical-align: middle;\n",
15
+ " }\n",
16
+ "\n",
17
+ " .dataframe tbody tr th {\n",
18
+ " vertical-align: top;\n",
19
+ " }\n",
20
+ "\n",
21
+ " .dataframe thead th {\n",
22
+ " text-align: right;\n",
23
+ " }\n",
24
+ "</style>\n",
25
+ "<table border=\"1\" class=\"dataframe\">\n",
26
+ " <thead>\n",
27
+ " <tr style=\"text-align: right;\">\n",
28
+ " <th></th>\n",
29
+ " <th>spoat</th>\n",
30
+ " <th>ecorregion</th>\n",
31
+ " <th>sag</th>\n",
32
+ " <th>provincia</th>\n",
33
+ " <th>supha</th>\n",
34
+ " <th>area</th>\n",
35
+ " <th>departamento</th>\n",
36
+ " </tr>\n",
37
+ " </thead>\n",
38
+ " <tbody>\n",
39
+ " <tr>\n",
40
+ " <th>0</th>\n",
41
+ " <td>Monte ribereno, talares orientales y bahia de ...</td>\n",
42
+ " <td>Pampa</td>\n",
43
+ " <td>ARBA - Gerencia de Servicios Catastrales</td>\n",
44
+ " <td>BUENOS AIRES</td>\n",
45
+ " <td>977451.943</td>\n",
46
+ " <td>977452</td>\n",
47
+ " <td>Magdalena</td>\n",
48
+ " </tr>\n",
49
+ " <tr>\n",
50
+ " <th>1</th>\n",
51
+ " <td>Sudoeste de Buenos Aires</td>\n",
52
+ " <td>Espinal</td>\n",
53
+ " <td>ARBA - Gerencia de Servicios Catastrales</td>\n",
54
+ " <td>BUENOS AIRES</td>\n",
55
+ " <td>2357878.315</td>\n",
56
+ " <td>2357877</td>\n",
57
+ " <td>Patagones</td>\n",
58
+ " </tr>\n",
59
+ " <tr>\n",
60
+ " <th>2</th>\n",
61
+ " <td>Delta del rio Parana</td>\n",
62
+ " <td>Delta e islas del rio Parana</td>\n",
63
+ " <td>ARBA - Gerencia de Servicios Catastrales</td>\n",
64
+ " <td>BUENOS AIRES</td>\n",
65
+ " <td>202074.295</td>\n",
66
+ " <td>202074</td>\n",
67
+ " <td>Campana</td>\n",
68
+ " </tr>\n",
69
+ " <tr>\n",
70
+ " <th>3</th>\n",
71
+ " <td>Hornocal - Valle Grande</td>\n",
72
+ " <td>Puna/Selva de las Yungas</td>\n",
73
+ " <td>Direc. Grl. de Inmuebles</td>\n",
74
+ " <td>JUJUY</td>\n",
75
+ " <td>287358.817</td>\n",
76
+ " <td>287359</td>\n",
77
+ " <td>Valle Gran</td>\n",
78
+ " </tr>\n",
79
+ " <tr>\n",
80
+ " <th>4</th>\n",
81
+ " <td>Susques - Jama - Catua - Olaroz</td>\n",
82
+ " <td>Puna/Altos Andes</td>\n",
83
+ " <td>Direc. Grl. de Inmuebles</td>\n",
84
+ " <td>JUJUY</td>\n",
85
+ " <td>268648.734</td>\n",
86
+ " <td>268649</td>\n",
87
+ " <td>Susques</td>\n",
88
+ " </tr>\n",
89
+ " </tbody>\n",
90
+ "</table>\n",
91
+ "</div>"
92
+ ],
93
+ "text/plain": [
94
+ " spoat \\\n",
95
+ "0 Monte ribereno, talares orientales y bahia de ... \n",
96
+ "1 Sudoeste de Buenos Aires \n",
97
+ "2 Delta del rio Parana \n",
98
+ "3 Hornocal - Valle Grande \n",
99
+ "4 Susques - Jama - Catua - Olaroz \n",
100
+ "\n",
101
+ " ecorregion sag \\\n",
102
+ "0 Pampa ARBA - Gerencia de Servicios Catastrales \n",
103
+ "1 Espinal ARBA - Gerencia de Servicios Catastrales \n",
104
+ "2 Delta e islas del rio Parana ARBA - Gerencia de Servicios Catastrales \n",
105
+ "3 Puna/Selva de las Yungas Direc. Grl. de Inmuebles \n",
106
+ "4 Puna/Altos Andes Direc. Grl. de Inmuebles \n",
107
+ "\n",
108
+ " provincia supha area departamento \n",
109
+ "0 BUENOS AIRES 977451.943 977452 Magdalena \n",
110
+ "1 BUENOS AIRES 2357878.315 2357877 Patagones \n",
111
+ "2 BUENOS AIRES 202074.295 202074 Campana \n",
112
+ "3 JUJUY 287358.817 287359 Valle Gran \n",
113
+ "4 JUJUY 268648.734 268649 Susques "
114
+ ]
115
+ },
116
+ "metadata": {},
117
+ "output_type": "display_data"
118
+ },
119
+ {
120
+ "name": "stderr",
121
+ "output_type": "stream",
122
+ "text": [
123
+ "binning on column provincia has been skipped because it is not a numerical type\n",
124
+ "c:\\Users\\ferna\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\chat2plot\\render.py:121: UserWarning:\n",
125
+ "\n",
126
+ "Could not infer format, so each element will be parsed individually, falling back to `dateutil`. To ensure parsing is consistent and as-expected, please specify a format.\n",
127
+ "\n",
128
+ "c:\\Users\\ferna\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\chat2plot\\render.py:125: UserWarning:\n",
129
+ "\n",
130
+ "Could not infer format, so each element will be parsed individually, falling back to `dateutil`. To ensure parsing is consistent and as-expected, please specify a format.\n",
131
+ "\n"
132
+ ]
133
+ },
134
+ {
135
+ "data": {
136
+ "application/vnd.plotly.v1+json": {
137
+ "config": {
138
+ "plotlyServerURL": "https://plot.ly"
139
+ },
140
+ "data": [
141
+ {
142
+ "alignmentgroup": "True",
143
+ "hovertemplate": "Provincia=%{x}<br>Superficie=%{y}<extra></extra>",
144
+ "legendgroup": "",
145
+ "marker": {
146
+ "color": "#636efa",
147
+ "pattern": {
148
+ "shape": ""
149
+ }
150
+ },
151
+ "name": "",
152
+ "offsetgroup": "",
153
+ "orientation": "v",
154
+ "showlegend": false,
155
+ "textposition": "auto",
156
+ "type": "bar",
157
+ "x": [
158
+ "MENDOZA",
159
+ "JUJUY",
160
+ "BUENOS AIRES"
161
+ ],
162
+ "xaxis": "x",
163
+ "y": [
164
+ 207189.864,
165
+ 556007.551,
166
+ 3537404.553
167
+ ],
168
+ "yaxis": "y"
169
+ }
170
+ ],
171
+ "layout": {
172
+ "barmode": "relative",
173
+ "legend": {
174
+ "tracegroupgap": 0
175
+ },
176
+ "margin": {
177
+ "t": 60
178
+ },
179
+ "template": {
180
+ "data": {
181
+ "bar": [
182
+ {
183
+ "error_x": {
184
+ "color": "#2a3f5f"
185
+ },
186
+ "error_y": {
187
+ "color": "#2a3f5f"
188
+ },
189
+ "marker": {
190
+ "line": {
191
+ "color": "#E5ECF6",
192
+ "width": 0.5
193
+ },
194
+ "pattern": {
195
+ "fillmode": "overlay",
196
+ "size": 10,
197
+ "solidity": 0.2
198
+ }
199
+ },
200
+ "type": "bar"
201
+ }
202
+ ],
203
+ "barpolar": [
204
+ {
205
+ "marker": {
206
+ "line": {
207
+ "color": "#E5ECF6",
208
+ "width": 0.5
209
+ },
210
+ "pattern": {
211
+ "fillmode": "overlay",
212
+ "size": 10,
213
+ "solidity": 0.2
214
+ }
215
+ },
216
+ "type": "barpolar"
217
+ }
218
+ ],
219
+ "carpet": [
220
+ {
221
+ "aaxis": {
222
+ "endlinecolor": "#2a3f5f",
223
+ "gridcolor": "white",
224
+ "linecolor": "white",
225
+ "minorgridcolor": "white",
226
+ "startlinecolor": "#2a3f5f"
227
+ },
228
+ "baxis": {
229
+ "endlinecolor": "#2a3f5f",
230
+ "gridcolor": "white",
231
+ "linecolor": "white",
232
+ "minorgridcolor": "white",
233
+ "startlinecolor": "#2a3f5f"
234
+ },
235
+ "type": "carpet"
236
+ }
237
+ ],
238
+ "choropleth": [
239
+ {
240
+ "colorbar": {
241
+ "outlinewidth": 0,
242
+ "ticks": ""
243
+ },
244
+ "type": "choropleth"
245
+ }
246
+ ],
247
+ "contour": [
248
+ {
249
+ "colorbar": {
250
+ "outlinewidth": 0,
251
+ "ticks": ""
252
+ },
253
+ "colorscale": [
254
+ [
255
+ 0,
256
+ "#0d0887"
257
+ ],
258
+ [
259
+ 0.1111111111111111,
260
+ "#46039f"
261
+ ],
262
+ [
263
+ 0.2222222222222222,
264
+ "#7201a8"
265
+ ],
266
+ [
267
+ 0.3333333333333333,
268
+ "#9c179e"
269
+ ],
270
+ [
271
+ 0.4444444444444444,
272
+ "#bd3786"
273
+ ],
274
+ [
275
+ 0.5555555555555556,
276
+ "#d8576b"
277
+ ],
278
+ [
279
+ 0.6666666666666666,
280
+ "#ed7953"
281
+ ],
282
+ [
283
+ 0.7777777777777778,
284
+ "#fb9f3a"
285
+ ],
286
+ [
287
+ 0.8888888888888888,
288
+ "#fdca26"
289
+ ],
290
+ [
291
+ 1,
292
+ "#f0f921"
293
+ ]
294
+ ],
295
+ "type": "contour"
296
+ }
297
+ ],
298
+ "contourcarpet": [
299
+ {
300
+ "colorbar": {
301
+ "outlinewidth": 0,
302
+ "ticks": ""
303
+ },
304
+ "type": "contourcarpet"
305
+ }
306
+ ],
307
+ "heatmap": [
308
+ {
309
+ "colorbar": {
310
+ "outlinewidth": 0,
311
+ "ticks": ""
312
+ },
313
+ "colorscale": [
314
+ [
315
+ 0,
316
+ "#0d0887"
317
+ ],
318
+ [
319
+ 0.1111111111111111,
320
+ "#46039f"
321
+ ],
322
+ [
323
+ 0.2222222222222222,
324
+ "#7201a8"
325
+ ],
326
+ [
327
+ 0.3333333333333333,
328
+ "#9c179e"
329
+ ],
330
+ [
331
+ 0.4444444444444444,
332
+ "#bd3786"
333
+ ],
334
+ [
335
+ 0.5555555555555556,
336
+ "#d8576b"
337
+ ],
338
+ [
339
+ 0.6666666666666666,
340
+ "#ed7953"
341
+ ],
342
+ [
343
+ 0.7777777777777778,
344
+ "#fb9f3a"
345
+ ],
346
+ [
347
+ 0.8888888888888888,
348
+ "#fdca26"
349
+ ],
350
+ [
351
+ 1,
352
+ "#f0f921"
353
+ ]
354
+ ],
355
+ "type": "heatmap"
356
+ }
357
+ ],
358
+ "heatmapgl": [
359
+ {
360
+ "colorbar": {
361
+ "outlinewidth": 0,
362
+ "ticks": ""
363
+ },
364
+ "colorscale": [
365
+ [
366
+ 0,
367
+ "#0d0887"
368
+ ],
369
+ [
370
+ 0.1111111111111111,
371
+ "#46039f"
372
+ ],
373
+ [
374
+ 0.2222222222222222,
375
+ "#7201a8"
376
+ ],
377
+ [
378
+ 0.3333333333333333,
379
+ "#9c179e"
380
+ ],
381
+ [
382
+ 0.4444444444444444,
383
+ "#bd3786"
384
+ ],
385
+ [
386
+ 0.5555555555555556,
387
+ "#d8576b"
388
+ ],
389
+ [
390
+ 0.6666666666666666,
391
+ "#ed7953"
392
+ ],
393
+ [
394
+ 0.7777777777777778,
395
+ "#fb9f3a"
396
+ ],
397
+ [
398
+ 0.8888888888888888,
399
+ "#fdca26"
400
+ ],
401
+ [
402
+ 1,
403
+ "#f0f921"
404
+ ]
405
+ ],
406
+ "type": "heatmapgl"
407
+ }
408
+ ],
409
+ "histogram": [
410
+ {
411
+ "marker": {
412
+ "pattern": {
413
+ "fillmode": "overlay",
414
+ "size": 10,
415
+ "solidity": 0.2
416
+ }
417
+ },
418
+ "type": "histogram"
419
+ }
420
+ ],
421
+ "histogram2d": [
422
+ {
423
+ "colorbar": {
424
+ "outlinewidth": 0,
425
+ "ticks": ""
426
+ },
427
+ "colorscale": [
428
+ [
429
+ 0,
430
+ "#0d0887"
431
+ ],
432
+ [
433
+ 0.1111111111111111,
434
+ "#46039f"
435
+ ],
436
+ [
437
+ 0.2222222222222222,
438
+ "#7201a8"
439
+ ],
440
+ [
441
+ 0.3333333333333333,
442
+ "#9c179e"
443
+ ],
444
+ [
445
+ 0.4444444444444444,
446
+ "#bd3786"
447
+ ],
448
+ [
449
+ 0.5555555555555556,
450
+ "#d8576b"
451
+ ],
452
+ [
453
+ 0.6666666666666666,
454
+ "#ed7953"
455
+ ],
456
+ [
457
+ 0.7777777777777778,
458
+ "#fb9f3a"
459
+ ],
460
+ [
461
+ 0.8888888888888888,
462
+ "#fdca26"
463
+ ],
464
+ [
465
+ 1,
466
+ "#f0f921"
467
+ ]
468
+ ],
469
+ "type": "histogram2d"
470
+ }
471
+ ],
472
+ "histogram2dcontour": [
473
+ {
474
+ "colorbar": {
475
+ "outlinewidth": 0,
476
+ "ticks": ""
477
+ },
478
+ "colorscale": [
479
+ [
480
+ 0,
481
+ "#0d0887"
482
+ ],
483
+ [
484
+ 0.1111111111111111,
485
+ "#46039f"
486
+ ],
487
+ [
488
+ 0.2222222222222222,
489
+ "#7201a8"
490
+ ],
491
+ [
492
+ 0.3333333333333333,
493
+ "#9c179e"
494
+ ],
495
+ [
496
+ 0.4444444444444444,
497
+ "#bd3786"
498
+ ],
499
+ [
500
+ 0.5555555555555556,
501
+ "#d8576b"
502
+ ],
503
+ [
504
+ 0.6666666666666666,
505
+ "#ed7953"
506
+ ],
507
+ [
508
+ 0.7777777777777778,
509
+ "#fb9f3a"
510
+ ],
511
+ [
512
+ 0.8888888888888888,
513
+ "#fdca26"
514
+ ],
515
+ [
516
+ 1,
517
+ "#f0f921"
518
+ ]
519
+ ],
520
+ "type": "histogram2dcontour"
521
+ }
522
+ ],
523
+ "mesh3d": [
524
+ {
525
+ "colorbar": {
526
+ "outlinewidth": 0,
527
+ "ticks": ""
528
+ },
529
+ "type": "mesh3d"
530
+ }
531
+ ],
532
+ "parcoords": [
533
+ {
534
+ "line": {
535
+ "colorbar": {
536
+ "outlinewidth": 0,
537
+ "ticks": ""
538
+ }
539
+ },
540
+ "type": "parcoords"
541
+ }
542
+ ],
543
+ "pie": [
544
+ {
545
+ "automargin": true,
546
+ "type": "pie"
547
+ }
548
+ ],
549
+ "scatter": [
550
+ {
551
+ "fillpattern": {
552
+ "fillmode": "overlay",
553
+ "size": 10,
554
+ "solidity": 0.2
555
+ },
556
+ "type": "scatter"
557
+ }
558
+ ],
559
+ "scatter3d": [
560
+ {
561
+ "line": {
562
+ "colorbar": {
563
+ "outlinewidth": 0,
564
+ "ticks": ""
565
+ }
566
+ },
567
+ "marker": {
568
+ "colorbar": {
569
+ "outlinewidth": 0,
570
+ "ticks": ""
571
+ }
572
+ },
573
+ "type": "scatter3d"
574
+ }
575
+ ],
576
+ "scattercarpet": [
577
+ {
578
+ "marker": {
579
+ "colorbar": {
580
+ "outlinewidth": 0,
581
+ "ticks": ""
582
+ }
583
+ },
584
+ "type": "scattercarpet"
585
+ }
586
+ ],
587
+ "scattergeo": [
588
+ {
589
+ "marker": {
590
+ "colorbar": {
591
+ "outlinewidth": 0,
592
+ "ticks": ""
593
+ }
594
+ },
595
+ "type": "scattergeo"
596
+ }
597
+ ],
598
+ "scattergl": [
599
+ {
600
+ "marker": {
601
+ "colorbar": {
602
+ "outlinewidth": 0,
603
+ "ticks": ""
604
+ }
605
+ },
606
+ "type": "scattergl"
607
+ }
608
+ ],
609
+ "scattermapbox": [
610
+ {
611
+ "marker": {
612
+ "colorbar": {
613
+ "outlinewidth": 0,
614
+ "ticks": ""
615
+ }
616
+ },
617
+ "type": "scattermapbox"
618
+ }
619
+ ],
620
+ "scatterpolar": [
621
+ {
622
+ "marker": {
623
+ "colorbar": {
624
+ "outlinewidth": 0,
625
+ "ticks": ""
626
+ }
627
+ },
628
+ "type": "scatterpolar"
629
+ }
630
+ ],
631
+ "scatterpolargl": [
632
+ {
633
+ "marker": {
634
+ "colorbar": {
635
+ "outlinewidth": 0,
636
+ "ticks": ""
637
+ }
638
+ },
639
+ "type": "scatterpolargl"
640
+ }
641
+ ],
642
+ "scatterternary": [
643
+ {
644
+ "marker": {
645
+ "colorbar": {
646
+ "outlinewidth": 0,
647
+ "ticks": ""
648
+ }
649
+ },
650
+ "type": "scatterternary"
651
+ }
652
+ ],
653
+ "surface": [
654
+ {
655
+ "colorbar": {
656
+ "outlinewidth": 0,
657
+ "ticks": ""
658
+ },
659
+ "colorscale": [
660
+ [
661
+ 0,
662
+ "#0d0887"
663
+ ],
664
+ [
665
+ 0.1111111111111111,
666
+ "#46039f"
667
+ ],
668
+ [
669
+ 0.2222222222222222,
670
+ "#7201a8"
671
+ ],
672
+ [
673
+ 0.3333333333333333,
674
+ "#9c179e"
675
+ ],
676
+ [
677
+ 0.4444444444444444,
678
+ "#bd3786"
679
+ ],
680
+ [
681
+ 0.5555555555555556,
682
+ "#d8576b"
683
+ ],
684
+ [
685
+ 0.6666666666666666,
686
+ "#ed7953"
687
+ ],
688
+ [
689
+ 0.7777777777777778,
690
+ "#fb9f3a"
691
+ ],
692
+ [
693
+ 0.8888888888888888,
694
+ "#fdca26"
695
+ ],
696
+ [
697
+ 1,
698
+ "#f0f921"
699
+ ]
700
+ ],
701
+ "type": "surface"
702
+ }
703
+ ],
704
+ "table": [
705
+ {
706
+ "cells": {
707
+ "fill": {
708
+ "color": "#EBF0F8"
709
+ },
710
+ "line": {
711
+ "color": "white"
712
+ }
713
+ },
714
+ "header": {
715
+ "fill": {
716
+ "color": "#C8D4E3"
717
+ },
718
+ "line": {
719
+ "color": "white"
720
+ }
721
+ },
722
+ "type": "table"
723
+ }
724
+ ]
725
+ },
726
+ "layout": {
727
+ "annotationdefaults": {
728
+ "arrowcolor": "#2a3f5f",
729
+ "arrowhead": 0,
730
+ "arrowwidth": 1
731
+ },
732
+ "autotypenumbers": "strict",
733
+ "coloraxis": {
734
+ "colorbar": {
735
+ "outlinewidth": 0,
736
+ "ticks": ""
737
+ }
738
+ },
739
+ "colorscale": {
740
+ "diverging": [
741
+ [
742
+ 0,
743
+ "#8e0152"
744
+ ],
745
+ [
746
+ 0.1,
747
+ "#c51b7d"
748
+ ],
749
+ [
750
+ 0.2,
751
+ "#de77ae"
752
+ ],
753
+ [
754
+ 0.3,
755
+ "#f1b6da"
756
+ ],
757
+ [
758
+ 0.4,
759
+ "#fde0ef"
760
+ ],
761
+ [
762
+ 0.5,
763
+ "#f7f7f7"
764
+ ],
765
+ [
766
+ 0.6,
767
+ "#e6f5d0"
768
+ ],
769
+ [
770
+ 0.7,
771
+ "#b8e186"
772
+ ],
773
+ [
774
+ 0.8,
775
+ "#7fbc41"
776
+ ],
777
+ [
778
+ 0.9,
779
+ "#4d9221"
780
+ ],
781
+ [
782
+ 1,
783
+ "#276419"
784
+ ]
785
+ ],
786
+ "sequential": [
787
+ [
788
+ 0,
789
+ "#0d0887"
790
+ ],
791
+ [
792
+ 0.1111111111111111,
793
+ "#46039f"
794
+ ],
795
+ [
796
+ 0.2222222222222222,
797
+ "#7201a8"
798
+ ],
799
+ [
800
+ 0.3333333333333333,
801
+ "#9c179e"
802
+ ],
803
+ [
804
+ 0.4444444444444444,
805
+ "#bd3786"
806
+ ],
807
+ [
808
+ 0.5555555555555556,
809
+ "#d8576b"
810
+ ],
811
+ [
812
+ 0.6666666666666666,
813
+ "#ed7953"
814
+ ],
815
+ [
816
+ 0.7777777777777778,
817
+ "#fb9f3a"
818
+ ],
819
+ [
820
+ 0.8888888888888888,
821
+ "#fdca26"
822
+ ],
823
+ [
824
+ 1,
825
+ "#f0f921"
826
+ ]
827
+ ],
828
+ "sequentialminus": [
829
+ [
830
+ 0,
831
+ "#0d0887"
832
+ ],
833
+ [
834
+ 0.1111111111111111,
835
+ "#46039f"
836
+ ],
837
+ [
838
+ 0.2222222222222222,
839
+ "#7201a8"
840
+ ],
841
+ [
842
+ 0.3333333333333333,
843
+ "#9c179e"
844
+ ],
845
+ [
846
+ 0.4444444444444444,
847
+ "#bd3786"
848
+ ],
849
+ [
850
+ 0.5555555555555556,
851
+ "#d8576b"
852
+ ],
853
+ [
854
+ 0.6666666666666666,
855
+ "#ed7953"
856
+ ],
857
+ [
858
+ 0.7777777777777778,
859
+ "#fb9f3a"
860
+ ],
861
+ [
862
+ 0.8888888888888888,
863
+ "#fdca26"
864
+ ],
865
+ [
866
+ 1,
867
+ "#f0f921"
868
+ ]
869
+ ]
870
+ },
871
+ "colorway": [
872
+ "#636efa",
873
+ "#EF553B",
874
+ "#00cc96",
875
+ "#ab63fa",
876
+ "#FFA15A",
877
+ "#19d3f3",
878
+ "#FF6692",
879
+ "#B6E880",
880
+ "#FF97FF",
881
+ "#FECB52"
882
+ ],
883
+ "font": {
884
+ "color": "#2a3f5f"
885
+ },
886
+ "geo": {
887
+ "bgcolor": "white",
888
+ "lakecolor": "white",
889
+ "landcolor": "#E5ECF6",
890
+ "showlakes": true,
891
+ "showland": true,
892
+ "subunitcolor": "white"
893
+ },
894
+ "hoverlabel": {
895
+ "align": "left"
896
+ },
897
+ "hovermode": "closest",
898
+ "mapbox": {
899
+ "style": "light"
900
+ },
901
+ "paper_bgcolor": "white",
902
+ "plot_bgcolor": "#E5ECF6",
903
+ "polar": {
904
+ "angularaxis": {
905
+ "gridcolor": "white",
906
+ "linecolor": "white",
907
+ "ticks": ""
908
+ },
909
+ "bgcolor": "#E5ECF6",
910
+ "radialaxis": {
911
+ "gridcolor": "white",
912
+ "linecolor": "white",
913
+ "ticks": ""
914
+ }
915
+ },
916
+ "scene": {
917
+ "xaxis": {
918
+ "backgroundcolor": "#E5ECF6",
919
+ "gridcolor": "white",
920
+ "gridwidth": 2,
921
+ "linecolor": "white",
922
+ "showbackground": true,
923
+ "ticks": "",
924
+ "zerolinecolor": "white"
925
+ },
926
+ "yaxis": {
927
+ "backgroundcolor": "#E5ECF6",
928
+ "gridcolor": "white",
929
+ "gridwidth": 2,
930
+ "linecolor": "white",
931
+ "showbackground": true,
932
+ "ticks": "",
933
+ "zerolinecolor": "white"
934
+ },
935
+ "zaxis": {
936
+ "backgroundcolor": "#E5ECF6",
937
+ "gridcolor": "white",
938
+ "gridwidth": 2,
939
+ "linecolor": "white",
940
+ "showbackground": true,
941
+ "ticks": "",
942
+ "zerolinecolor": "white"
943
+ }
944
+ },
945
+ "shapedefaults": {
946
+ "line": {
947
+ "color": "#2a3f5f"
948
+ }
949
+ },
950
+ "ternary": {
951
+ "aaxis": {
952
+ "gridcolor": "white",
953
+ "linecolor": "white",
954
+ "ticks": ""
955
+ },
956
+ "baxis": {
957
+ "gridcolor": "white",
958
+ "linecolor": "white",
959
+ "ticks": ""
960
+ },
961
+ "bgcolor": "#E5ECF6",
962
+ "caxis": {
963
+ "gridcolor": "white",
964
+ "linecolor": "white",
965
+ "ticks": ""
966
+ }
967
+ },
968
+ "title": {
969
+ "x": 0.05
970
+ },
971
+ "xaxis": {
972
+ "automargin": true,
973
+ "gridcolor": "white",
974
+ "linecolor": "white",
975
+ "ticks": "",
976
+ "title": {
977
+ "standoff": 15
978
+ },
979
+ "zerolinecolor": "white",
980
+ "zerolinewidth": 2
981
+ },
982
+ "yaxis": {
983
+ "automargin": true,
984
+ "gridcolor": "white",
985
+ "linecolor": "white",
986
+ "ticks": "",
987
+ "title": {
988
+ "standoff": 15
989
+ },
990
+ "zerolinecolor": "white",
991
+ "zerolinewidth": 2
992
+ }
993
+ }
994
+ },
995
+ "xaxis": {
996
+ "anchor": "y",
997
+ "domain": [
998
+ 0,
999
+ 1
1000
+ ],
1001
+ "title": {
1002
+ "text": "Provincia"
1003
+ }
1004
+ },
1005
+ "yaxis": {
1006
+ "anchor": "x",
1007
+ "domain": [
1008
+ 0,
1009
+ 1
1010
+ ],
1011
+ "title": {
1012
+ "text": "Superficie"
1013
+ }
1014
+ }
1015
+ }
1016
+ }
1017
+ },
1018
+ "metadata": {},
1019
+ "output_type": "display_data"
1020
+ },
1021
+ {
1022
+ "name": "stdout",
1023
+ "output_type": "stream",
1024
+ "text": [
1025
+ "chart_type=<ChartType.BAR: 'bar'> filters=[] x=XAxis(column='provincia', bin_size=1, time_unit=None, min_value=0.0, max_value=0.0, label='Provincia') y=YAxis(column='supha', aggregation=<AggregationType.SUM: 'SUM'>, min_value=0.0, max_value=0.0, label='Superficie') color=None bar_mode=None sort_criteria=None sort_order=None horizontal=None limit=None\n",
1026
+ "El gráfico generado muestra la superficie por provincia. La variable \"superficie\" se representa en el eje y, mientras que la variable \"provincia\" se representa en el eje x. Se utiliza un gráfico de barras para mostrar la comparación de la superficie entre las diferentes provincias. La altura de cada barra representa la superficie total de cada provincia. Esto permite visualizar fácilmente las diferencias en la superficie entre las provincias.\n"
1027
+ ]
1028
+ },
1029
+ {
1030
+ "name": "stderr",
1031
+ "output_type": "stream",
1032
+ "text": [
1033
+ "binning on column provincia has been skipped because it is not a numerical type\n",
1034
+ "c:\\Users\\ferna\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\chat2plot\\render.py:121: UserWarning:\n",
1035
+ "\n",
1036
+ "Could not infer format, so each element will be parsed individually, falling back to `dateutil`. To ensure parsing is consistent and as-expected, please specify a format.\n",
1037
+ "\n",
1038
+ "c:\\Users\\ferna\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\chat2plot\\render.py:125: UserWarning:\n",
1039
+ "\n",
1040
+ "Could not infer format, so each element will be parsed individually, falling back to `dateutil`. To ensure parsing is consistent and as-expected, please specify a format.\n",
1041
+ "\n"
1042
+ ]
1043
+ },
1044
+ {
1045
+ "data": {
1046
+ "application/vnd.plotly.v1+json": {
1047
+ "config": {
1048
+ "plotlyServerURL": "https://plot.ly"
1049
+ },
1050
+ "data": [
1051
+ {
1052
+ "alignmentgroup": "True",
1053
+ "hovertemplate": "Provincia=%{x}<br>Superficie=%{y}<extra></extra>",
1054
+ "legendgroup": "",
1055
+ "marker": {
1056
+ "color": "#636efa",
1057
+ "pattern": {
1058
+ "shape": ""
1059
+ }
1060
+ },
1061
+ "name": "",
1062
+ "offsetgroup": "",
1063
+ "orientation": "h",
1064
+ "showlegend": false,
1065
+ "textposition": "auto",
1066
+ "type": "bar",
1067
+ "x": [
1068
+ 207189.864,
1069
+ 556007.551,
1070
+ 3537404.553
1071
+ ],
1072
+ "xaxis": "x",
1073
+ "y": [
1074
+ "MENDOZA",
1075
+ "JUJUY",
1076
+ "BUENOS AIRES"
1077
+ ],
1078
+ "yaxis": "y"
1079
+ }
1080
+ ],
1081
+ "layout": {
1082
+ "barmode": "relative",
1083
+ "legend": {
1084
+ "tracegroupgap": 0
1085
+ },
1086
+ "margin": {
1087
+ "t": 60
1088
+ },
1089
+ "template": {
1090
+ "data": {
1091
+ "bar": [
1092
+ {
1093
+ "error_x": {
1094
+ "color": "#2a3f5f"
1095
+ },
1096
+ "error_y": {
1097
+ "color": "#2a3f5f"
1098
+ },
1099
+ "marker": {
1100
+ "line": {
1101
+ "color": "#E5ECF6",
1102
+ "width": 0.5
1103
+ },
1104
+ "pattern": {
1105
+ "fillmode": "overlay",
1106
+ "size": 10,
1107
+ "solidity": 0.2
1108
+ }
1109
+ },
1110
+ "type": "bar"
1111
+ }
1112
+ ],
1113
+ "barpolar": [
1114
+ {
1115
+ "marker": {
1116
+ "line": {
1117
+ "color": "#E5ECF6",
1118
+ "width": 0.5
1119
+ },
1120
+ "pattern": {
1121
+ "fillmode": "overlay",
1122
+ "size": 10,
1123
+ "solidity": 0.2
1124
+ }
1125
+ },
1126
+ "type": "barpolar"
1127
+ }
1128
+ ],
1129
+ "carpet": [
1130
+ {
1131
+ "aaxis": {
1132
+ "endlinecolor": "#2a3f5f",
1133
+ "gridcolor": "white",
1134
+ "linecolor": "white",
1135
+ "minorgridcolor": "white",
1136
+ "startlinecolor": "#2a3f5f"
1137
+ },
1138
+ "baxis": {
1139
+ "endlinecolor": "#2a3f5f",
1140
+ "gridcolor": "white",
1141
+ "linecolor": "white",
1142
+ "minorgridcolor": "white",
1143
+ "startlinecolor": "#2a3f5f"
1144
+ },
1145
+ "type": "carpet"
1146
+ }
1147
+ ],
1148
+ "choropleth": [
1149
+ {
1150
+ "colorbar": {
1151
+ "outlinewidth": 0,
1152
+ "ticks": ""
1153
+ },
1154
+ "type": "choropleth"
1155
+ }
1156
+ ],
1157
+ "contour": [
1158
+ {
1159
+ "colorbar": {
1160
+ "outlinewidth": 0,
1161
+ "ticks": ""
1162
+ },
1163
+ "colorscale": [
1164
+ [
1165
+ 0,
1166
+ "#0d0887"
1167
+ ],
1168
+ [
1169
+ 0.1111111111111111,
1170
+ "#46039f"
1171
+ ],
1172
+ [
1173
+ 0.2222222222222222,
1174
+ "#7201a8"
1175
+ ],
1176
+ [
1177
+ 0.3333333333333333,
1178
+ "#9c179e"
1179
+ ],
1180
+ [
1181
+ 0.4444444444444444,
1182
+ "#bd3786"
1183
+ ],
1184
+ [
1185
+ 0.5555555555555556,
1186
+ "#d8576b"
1187
+ ],
1188
+ [
1189
+ 0.6666666666666666,
1190
+ "#ed7953"
1191
+ ],
1192
+ [
1193
+ 0.7777777777777778,
1194
+ "#fb9f3a"
1195
+ ],
1196
+ [
1197
+ 0.8888888888888888,
1198
+ "#fdca26"
1199
+ ],
1200
+ [
1201
+ 1,
1202
+ "#f0f921"
1203
+ ]
1204
+ ],
1205
+ "type": "contour"
1206
+ }
1207
+ ],
1208
+ "contourcarpet": [
1209
+ {
1210
+ "colorbar": {
1211
+ "outlinewidth": 0,
1212
+ "ticks": ""
1213
+ },
1214
+ "type": "contourcarpet"
1215
+ }
1216
+ ],
1217
+ "heatmap": [
1218
+ {
1219
+ "colorbar": {
1220
+ "outlinewidth": 0,
1221
+ "ticks": ""
1222
+ },
1223
+ "colorscale": [
1224
+ [
1225
+ 0,
1226
+ "#0d0887"
1227
+ ],
1228
+ [
1229
+ 0.1111111111111111,
1230
+ "#46039f"
1231
+ ],
1232
+ [
1233
+ 0.2222222222222222,
1234
+ "#7201a8"
1235
+ ],
1236
+ [
1237
+ 0.3333333333333333,
1238
+ "#9c179e"
1239
+ ],
1240
+ [
1241
+ 0.4444444444444444,
1242
+ "#bd3786"
1243
+ ],
1244
+ [
1245
+ 0.5555555555555556,
1246
+ "#d8576b"
1247
+ ],
1248
+ [
1249
+ 0.6666666666666666,
1250
+ "#ed7953"
1251
+ ],
1252
+ [
1253
+ 0.7777777777777778,
1254
+ "#fb9f3a"
1255
+ ],
1256
+ [
1257
+ 0.8888888888888888,
1258
+ "#fdca26"
1259
+ ],
1260
+ [
1261
+ 1,
1262
+ "#f0f921"
1263
+ ]
1264
+ ],
1265
+ "type": "heatmap"
1266
+ }
1267
+ ],
1268
+ "heatmapgl": [
1269
+ {
1270
+ "colorbar": {
1271
+ "outlinewidth": 0,
1272
+ "ticks": ""
1273
+ },
1274
+ "colorscale": [
1275
+ [
1276
+ 0,
1277
+ "#0d0887"
1278
+ ],
1279
+ [
1280
+ 0.1111111111111111,
1281
+ "#46039f"
1282
+ ],
1283
+ [
1284
+ 0.2222222222222222,
1285
+ "#7201a8"
1286
+ ],
1287
+ [
1288
+ 0.3333333333333333,
1289
+ "#9c179e"
1290
+ ],
1291
+ [
1292
+ 0.4444444444444444,
1293
+ "#bd3786"
1294
+ ],
1295
+ [
1296
+ 0.5555555555555556,
1297
+ "#d8576b"
1298
+ ],
1299
+ [
1300
+ 0.6666666666666666,
1301
+ "#ed7953"
1302
+ ],
1303
+ [
1304
+ 0.7777777777777778,
1305
+ "#fb9f3a"
1306
+ ],
1307
+ [
1308
+ 0.8888888888888888,
1309
+ "#fdca26"
1310
+ ],
1311
+ [
1312
+ 1,
1313
+ "#f0f921"
1314
+ ]
1315
+ ],
1316
+ "type": "heatmapgl"
1317
+ }
1318
+ ],
1319
+ "histogram": [
1320
+ {
1321
+ "marker": {
1322
+ "pattern": {
1323
+ "fillmode": "overlay",
1324
+ "size": 10,
1325
+ "solidity": 0.2
1326
+ }
1327
+ },
1328
+ "type": "histogram"
1329
+ }
1330
+ ],
1331
+ "histogram2d": [
1332
+ {
1333
+ "colorbar": {
1334
+ "outlinewidth": 0,
1335
+ "ticks": ""
1336
+ },
1337
+ "colorscale": [
1338
+ [
1339
+ 0,
1340
+ "#0d0887"
1341
+ ],
1342
+ [
1343
+ 0.1111111111111111,
1344
+ "#46039f"
1345
+ ],
1346
+ [
1347
+ 0.2222222222222222,
1348
+ "#7201a8"
1349
+ ],
1350
+ [
1351
+ 0.3333333333333333,
1352
+ "#9c179e"
1353
+ ],
1354
+ [
1355
+ 0.4444444444444444,
1356
+ "#bd3786"
1357
+ ],
1358
+ [
1359
+ 0.5555555555555556,
1360
+ "#d8576b"
1361
+ ],
1362
+ [
1363
+ 0.6666666666666666,
1364
+ "#ed7953"
1365
+ ],
1366
+ [
1367
+ 0.7777777777777778,
1368
+ "#fb9f3a"
1369
+ ],
1370
+ [
1371
+ 0.8888888888888888,
1372
+ "#fdca26"
1373
+ ],
1374
+ [
1375
+ 1,
1376
+ "#f0f921"
1377
+ ]
1378
+ ],
1379
+ "type": "histogram2d"
1380
+ }
1381
+ ],
1382
+ "histogram2dcontour": [
1383
+ {
1384
+ "colorbar": {
1385
+ "outlinewidth": 0,
1386
+ "ticks": ""
1387
+ },
1388
+ "colorscale": [
1389
+ [
1390
+ 0,
1391
+ "#0d0887"
1392
+ ],
1393
+ [
1394
+ 0.1111111111111111,
1395
+ "#46039f"
1396
+ ],
1397
+ [
1398
+ 0.2222222222222222,
1399
+ "#7201a8"
1400
+ ],
1401
+ [
1402
+ 0.3333333333333333,
1403
+ "#9c179e"
1404
+ ],
1405
+ [
1406
+ 0.4444444444444444,
1407
+ "#bd3786"
1408
+ ],
1409
+ [
1410
+ 0.5555555555555556,
1411
+ "#d8576b"
1412
+ ],
1413
+ [
1414
+ 0.6666666666666666,
1415
+ "#ed7953"
1416
+ ],
1417
+ [
1418
+ 0.7777777777777778,
1419
+ "#fb9f3a"
1420
+ ],
1421
+ [
1422
+ 0.8888888888888888,
1423
+ "#fdca26"
1424
+ ],
1425
+ [
1426
+ 1,
1427
+ "#f0f921"
1428
+ ]
1429
+ ],
1430
+ "type": "histogram2dcontour"
1431
+ }
1432
+ ],
1433
+ "mesh3d": [
1434
+ {
1435
+ "colorbar": {
1436
+ "outlinewidth": 0,
1437
+ "ticks": ""
1438
+ },
1439
+ "type": "mesh3d"
1440
+ }
1441
+ ],
1442
+ "parcoords": [
1443
+ {
1444
+ "line": {
1445
+ "colorbar": {
1446
+ "outlinewidth": 0,
1447
+ "ticks": ""
1448
+ }
1449
+ },
1450
+ "type": "parcoords"
1451
+ }
1452
+ ],
1453
+ "pie": [
1454
+ {
1455
+ "automargin": true,
1456
+ "type": "pie"
1457
+ }
1458
+ ],
1459
+ "scatter": [
1460
+ {
1461
+ "fillpattern": {
1462
+ "fillmode": "overlay",
1463
+ "size": 10,
1464
+ "solidity": 0.2
1465
+ },
1466
+ "type": "scatter"
1467
+ }
1468
+ ],
1469
+ "scatter3d": [
1470
+ {
1471
+ "line": {
1472
+ "colorbar": {
1473
+ "outlinewidth": 0,
1474
+ "ticks": ""
1475
+ }
1476
+ },
1477
+ "marker": {
1478
+ "colorbar": {
1479
+ "outlinewidth": 0,
1480
+ "ticks": ""
1481
+ }
1482
+ },
1483
+ "type": "scatter3d"
1484
+ }
1485
+ ],
1486
+ "scattercarpet": [
1487
+ {
1488
+ "marker": {
1489
+ "colorbar": {
1490
+ "outlinewidth": 0,
1491
+ "ticks": ""
1492
+ }
1493
+ },
1494
+ "type": "scattercarpet"
1495
+ }
1496
+ ],
1497
+ "scattergeo": [
1498
+ {
1499
+ "marker": {
1500
+ "colorbar": {
1501
+ "outlinewidth": 0,
1502
+ "ticks": ""
1503
+ }
1504
+ },
1505
+ "type": "scattergeo"
1506
+ }
1507
+ ],
1508
+ "scattergl": [
1509
+ {
1510
+ "marker": {
1511
+ "colorbar": {
1512
+ "outlinewidth": 0,
1513
+ "ticks": ""
1514
+ }
1515
+ },
1516
+ "type": "scattergl"
1517
+ }
1518
+ ],
1519
+ "scattermapbox": [
1520
+ {
1521
+ "marker": {
1522
+ "colorbar": {
1523
+ "outlinewidth": 0,
1524
+ "ticks": ""
1525
+ }
1526
+ },
1527
+ "type": "scattermapbox"
1528
+ }
1529
+ ],
1530
+ "scatterpolar": [
1531
+ {
1532
+ "marker": {
1533
+ "colorbar": {
1534
+ "outlinewidth": 0,
1535
+ "ticks": ""
1536
+ }
1537
+ },
1538
+ "type": "scatterpolar"
1539
+ }
1540
+ ],
1541
+ "scatterpolargl": [
1542
+ {
1543
+ "marker": {
1544
+ "colorbar": {
1545
+ "outlinewidth": 0,
1546
+ "ticks": ""
1547
+ }
1548
+ },
1549
+ "type": "scatterpolargl"
1550
+ }
1551
+ ],
1552
+ "scatterternary": [
1553
+ {
1554
+ "marker": {
1555
+ "colorbar": {
1556
+ "outlinewidth": 0,
1557
+ "ticks": ""
1558
+ }
1559
+ },
1560
+ "type": "scatterternary"
1561
+ }
1562
+ ],
1563
+ "surface": [
1564
+ {
1565
+ "colorbar": {
1566
+ "outlinewidth": 0,
1567
+ "ticks": ""
1568
+ },
1569
+ "colorscale": [
1570
+ [
1571
+ 0,
1572
+ "#0d0887"
1573
+ ],
1574
+ [
1575
+ 0.1111111111111111,
1576
+ "#46039f"
1577
+ ],
1578
+ [
1579
+ 0.2222222222222222,
1580
+ "#7201a8"
1581
+ ],
1582
+ [
1583
+ 0.3333333333333333,
1584
+ "#9c179e"
1585
+ ],
1586
+ [
1587
+ 0.4444444444444444,
1588
+ "#bd3786"
1589
+ ],
1590
+ [
1591
+ 0.5555555555555556,
1592
+ "#d8576b"
1593
+ ],
1594
+ [
1595
+ 0.6666666666666666,
1596
+ "#ed7953"
1597
+ ],
1598
+ [
1599
+ 0.7777777777777778,
1600
+ "#fb9f3a"
1601
+ ],
1602
+ [
1603
+ 0.8888888888888888,
1604
+ "#fdca26"
1605
+ ],
1606
+ [
1607
+ 1,
1608
+ "#f0f921"
1609
+ ]
1610
+ ],
1611
+ "type": "surface"
1612
+ }
1613
+ ],
1614
+ "table": [
1615
+ {
1616
+ "cells": {
1617
+ "fill": {
1618
+ "color": "#EBF0F8"
1619
+ },
1620
+ "line": {
1621
+ "color": "white"
1622
+ }
1623
+ },
1624
+ "header": {
1625
+ "fill": {
1626
+ "color": "#C8D4E3"
1627
+ },
1628
+ "line": {
1629
+ "color": "white"
1630
+ }
1631
+ },
1632
+ "type": "table"
1633
+ }
1634
+ ]
1635
+ },
1636
+ "layout": {
1637
+ "annotationdefaults": {
1638
+ "arrowcolor": "#2a3f5f",
1639
+ "arrowhead": 0,
1640
+ "arrowwidth": 1
1641
+ },
1642
+ "autotypenumbers": "strict",
1643
+ "coloraxis": {
1644
+ "colorbar": {
1645
+ "outlinewidth": 0,
1646
+ "ticks": ""
1647
+ }
1648
+ },
1649
+ "colorscale": {
1650
+ "diverging": [
1651
+ [
1652
+ 0,
1653
+ "#8e0152"
1654
+ ],
1655
+ [
1656
+ 0.1,
1657
+ "#c51b7d"
1658
+ ],
1659
+ [
1660
+ 0.2,
1661
+ "#de77ae"
1662
+ ],
1663
+ [
1664
+ 0.3,
1665
+ "#f1b6da"
1666
+ ],
1667
+ [
1668
+ 0.4,
1669
+ "#fde0ef"
1670
+ ],
1671
+ [
1672
+ 0.5,
1673
+ "#f7f7f7"
1674
+ ],
1675
+ [
1676
+ 0.6,
1677
+ "#e6f5d0"
1678
+ ],
1679
+ [
1680
+ 0.7,
1681
+ "#b8e186"
1682
+ ],
1683
+ [
1684
+ 0.8,
1685
+ "#7fbc41"
1686
+ ],
1687
+ [
1688
+ 0.9,
1689
+ "#4d9221"
1690
+ ],
1691
+ [
1692
+ 1,
1693
+ "#276419"
1694
+ ]
1695
+ ],
1696
+ "sequential": [
1697
+ [
1698
+ 0,
1699
+ "#0d0887"
1700
+ ],
1701
+ [
1702
+ 0.1111111111111111,
1703
+ "#46039f"
1704
+ ],
1705
+ [
1706
+ 0.2222222222222222,
1707
+ "#7201a8"
1708
+ ],
1709
+ [
1710
+ 0.3333333333333333,
1711
+ "#9c179e"
1712
+ ],
1713
+ [
1714
+ 0.4444444444444444,
1715
+ "#bd3786"
1716
+ ],
1717
+ [
1718
+ 0.5555555555555556,
1719
+ "#d8576b"
1720
+ ],
1721
+ [
1722
+ 0.6666666666666666,
1723
+ "#ed7953"
1724
+ ],
1725
+ [
1726
+ 0.7777777777777778,
1727
+ "#fb9f3a"
1728
+ ],
1729
+ [
1730
+ 0.8888888888888888,
1731
+ "#fdca26"
1732
+ ],
1733
+ [
1734
+ 1,
1735
+ "#f0f921"
1736
+ ]
1737
+ ],
1738
+ "sequentialminus": [
1739
+ [
1740
+ 0,
1741
+ "#0d0887"
1742
+ ],
1743
+ [
1744
+ 0.1111111111111111,
1745
+ "#46039f"
1746
+ ],
1747
+ [
1748
+ 0.2222222222222222,
1749
+ "#7201a8"
1750
+ ],
1751
+ [
1752
+ 0.3333333333333333,
1753
+ "#9c179e"
1754
+ ],
1755
+ [
1756
+ 0.4444444444444444,
1757
+ "#bd3786"
1758
+ ],
1759
+ [
1760
+ 0.5555555555555556,
1761
+ "#d8576b"
1762
+ ],
1763
+ [
1764
+ 0.6666666666666666,
1765
+ "#ed7953"
1766
+ ],
1767
+ [
1768
+ 0.7777777777777778,
1769
+ "#fb9f3a"
1770
+ ],
1771
+ [
1772
+ 0.8888888888888888,
1773
+ "#fdca26"
1774
+ ],
1775
+ [
1776
+ 1,
1777
+ "#f0f921"
1778
+ ]
1779
+ ]
1780
+ },
1781
+ "colorway": [
1782
+ "#636efa",
1783
+ "#EF553B",
1784
+ "#00cc96",
1785
+ "#ab63fa",
1786
+ "#FFA15A",
1787
+ "#19d3f3",
1788
+ "#FF6692",
1789
+ "#B6E880",
1790
+ "#FF97FF",
1791
+ "#FECB52"
1792
+ ],
1793
+ "font": {
1794
+ "color": "#2a3f5f"
1795
+ },
1796
+ "geo": {
1797
+ "bgcolor": "white",
1798
+ "lakecolor": "white",
1799
+ "landcolor": "#E5ECF6",
1800
+ "showlakes": true,
1801
+ "showland": true,
1802
+ "subunitcolor": "white"
1803
+ },
1804
+ "hoverlabel": {
1805
+ "align": "left"
1806
+ },
1807
+ "hovermode": "closest",
1808
+ "mapbox": {
1809
+ "style": "light"
1810
+ },
1811
+ "paper_bgcolor": "white",
1812
+ "plot_bgcolor": "#E5ECF6",
1813
+ "polar": {
1814
+ "angularaxis": {
1815
+ "gridcolor": "white",
1816
+ "linecolor": "white",
1817
+ "ticks": ""
1818
+ },
1819
+ "bgcolor": "#E5ECF6",
1820
+ "radialaxis": {
1821
+ "gridcolor": "white",
1822
+ "linecolor": "white",
1823
+ "ticks": ""
1824
+ }
1825
+ },
1826
+ "scene": {
1827
+ "xaxis": {
1828
+ "backgroundcolor": "#E5ECF6",
1829
+ "gridcolor": "white",
1830
+ "gridwidth": 2,
1831
+ "linecolor": "white",
1832
+ "showbackground": true,
1833
+ "ticks": "",
1834
+ "zerolinecolor": "white"
1835
+ },
1836
+ "yaxis": {
1837
+ "backgroundcolor": "#E5ECF6",
1838
+ "gridcolor": "white",
1839
+ "gridwidth": 2,
1840
+ "linecolor": "white",
1841
+ "showbackground": true,
1842
+ "ticks": "",
1843
+ "zerolinecolor": "white"
1844
+ },
1845
+ "zaxis": {
1846
+ "backgroundcolor": "#E5ECF6",
1847
+ "gridcolor": "white",
1848
+ "gridwidth": 2,
1849
+ "linecolor": "white",
1850
+ "showbackground": true,
1851
+ "ticks": "",
1852
+ "zerolinecolor": "white"
1853
+ }
1854
+ },
1855
+ "shapedefaults": {
1856
+ "line": {
1857
+ "color": "#2a3f5f"
1858
+ }
1859
+ },
1860
+ "ternary": {
1861
+ "aaxis": {
1862
+ "gridcolor": "white",
1863
+ "linecolor": "white",
1864
+ "ticks": ""
1865
+ },
1866
+ "baxis": {
1867
+ "gridcolor": "white",
1868
+ "linecolor": "white",
1869
+ "ticks": ""
1870
+ },
1871
+ "bgcolor": "#E5ECF6",
1872
+ "caxis": {
1873
+ "gridcolor": "white",
1874
+ "linecolor": "white",
1875
+ "ticks": ""
1876
+ }
1877
+ },
1878
+ "title": {
1879
+ "x": 0.05
1880
+ },
1881
+ "xaxis": {
1882
+ "automargin": true,
1883
+ "gridcolor": "white",
1884
+ "linecolor": "white",
1885
+ "ticks": "",
1886
+ "title": {
1887
+ "standoff": 15
1888
+ },
1889
+ "zerolinecolor": "white",
1890
+ "zerolinewidth": 2
1891
+ },
1892
+ "yaxis": {
1893
+ "automargin": true,
1894
+ "gridcolor": "white",
1895
+ "linecolor": "white",
1896
+ "ticks": "",
1897
+ "title": {
1898
+ "standoff": 15
1899
+ },
1900
+ "zerolinecolor": "white",
1901
+ "zerolinewidth": 2
1902
+ }
1903
+ }
1904
+ },
1905
+ "xaxis": {
1906
+ "anchor": "y",
1907
+ "domain": [
1908
+ 0,
1909
+ 1
1910
+ ],
1911
+ "title": {
1912
+ "text": "Provincia"
1913
+ }
1914
+ },
1915
+ "yaxis": {
1916
+ "anchor": "x",
1917
+ "domain": [
1918
+ 0,
1919
+ 1
1920
+ ],
1921
+ "title": {
1922
+ "text": "Superficie"
1923
+ }
1924
+ }
1925
+ }
1926
+ }
1927
+ },
1928
+ "metadata": {},
1929
+ "output_type": "display_data"
1930
+ }
1931
+ ],
1932
+ "source": [
1933
+ "import os\n",
1934
+ "import pandas as pd\n",
1935
+ "from chat2plot import chat2plot\n",
1936
+ "import sqlite3\n",
1937
+ "\n",
1938
+ "conn = sqlite3.connect('sitios2.sqlite')\n",
1939
+ "# 1. Set api-key\n",
1940
+ "# os.environ[\"OPENAI_API_KEY\"] = \"...\"\n",
1941
+ "\n",
1942
+ "# df = pd.read_csv(...)\n",
1943
+ "df = pd.read_sql_query(\"SELECT spoat, ecorregion, sag, provincia, supha, area, departamento FROM sitiospilotojson\", conn)\n",
1944
+ "display(df.head())\n",
1945
+ "# 2. Pass a dataframe to draw\n",
1946
+ "c2p = chat2plot(df)\n",
1947
+ "\n",
1948
+ "# 3. Make a question about the data\n",
1949
+ "result = c2p(\"superficie por provincia\")\n",
1950
+ "result.figure.show() # draw a plot\n",
1951
+ "print(result.config) # get a config (json / dataclass)\n",
1952
+ "print(result.explanation) # see the explanation generated by LLM\n",
1953
+ "\n",
1954
+ "# you can make follow-up request to refine the chart\n",
1955
+ "result = c2p(\"change to horizontal-bar chart\")\n",
1956
+ "result.figure.show()"
1957
+ ]
1958
+ }
1959
+ ],
1960
+ "metadata": {
1961
+ "kernelspec": {
1962
+ "display_name": "Python 3",
1963
+ "language": "python",
1964
+ "name": "python3"
1965
+ },
1966
+ "language_info": {
1967
+ "codemirror_mode": {
1968
+ "name": "ipython",
1969
+ "version": 3
1970
+ },
1971
+ "file_extension": ".py",
1972
+ "mimetype": "text/x-python",
1973
+ "name": "python",
1974
+ "nbconvert_exporter": "python",
1975
+ "pygments_lexer": "ipython3",
1976
+ "version": "3.11.4"
1977
+ },
1978
+ "orig_nbformat": 4
1979
+ },
1980
+ "nbformat": 4,
1981
+ "nbformat_minor": 2
1982
+ }
streamlit_agent/mrkl_demo.py CHANGED
@@ -12,6 +12,12 @@ from langchain.utilities import DuckDuckGoSearchAPIWrapper
12
 
13
  from streamlit_agent.callbacks.capturing_callback_handler import playback_callbacks
14
  from streamlit_agent.clear_results import with_clear_container
 
 
 
 
 
 
15
  import os
16
 
17
  user_openai_api_key = os.environ.get('OPENAI_API_KEY')
@@ -22,6 +28,7 @@ DB_PATH = (Path(__file__).parent / "sitios2.sqlite").absolute()
22
  SAVED_SESSIONS = {
23
  "Que provincias están representadas en los sitios pilotos?": "alanis.pickle",
24
  "Cual es la superficie total de sitios piloto en Buenos Aires?": "alanis.pickle",
 
25
  }
26
 
27
  st.set_page_config(
@@ -42,12 +49,19 @@ else:
42
  openai_api_key = "not_supplied"
43
  enable_custom = False
44
 
 
 
 
 
 
 
45
  # Tools setup
46
  llm = OpenAI(temperature=0, openai_api_key=openai_api_key, streaming=True)
47
  search = DuckDuckGoSearchAPIWrapper()
48
  llm_math_chain = LLMMathChain.from_llm(llm)
49
  db = SQLDatabase.from_uri(f"sqlite:///{DB_PATH}")
50
  db_chain = SQLDatabaseChain.from_llm(llm, db)
 
51
  tools = [
52
  Tool(
53
  name="Search",
@@ -64,6 +78,12 @@ tools = [
64
  func=db_chain.run,
65
  description="useful for when you need to answer questions about sitios piloto. Input should be in the form of a question containing full context",
66
  ),
 
 
 
 
 
 
67
  ]
68
 
69
  # Initialize agent
@@ -73,12 +93,6 @@ mrkl = initialize_agent(
73
 
74
  # read sitios2.sqlite and convert it to dataframe
75
 
76
- import pandas as pd
77
- import sqlite3
78
-
79
- conn = sqlite3.connect(DB_PATH)
80
- df = pd.read_sql_query("SELECT spoat, ecorregion, sag, provincia, supha, area, departamento FROM sitiospilotojson", conn)
81
- conn.close()
82
 
83
  st.write(df)
84
 
@@ -118,4 +132,9 @@ if with_clear_container(submit_clicked):
118
  # else:
119
  # answer = mrkl.run(user_input, callbacks=[st_callback])
120
  answer = mrkl.run(user_input, callbacks=[st_callback])
121
- answer_container.write(answer)
 
 
 
 
 
 
12
 
13
  from streamlit_agent.callbacks.capturing_callback_handler import playback_callbacks
14
  from streamlit_agent.clear_results import with_clear_container
15
+
16
+ from chat2plot import chat2plot
17
+ from chat2plot.chat2plot import Plot
18
+
19
+ import pandas as pd
20
+ import sqlite3
21
  import os
22
 
23
  user_openai_api_key = os.environ.get('OPENAI_API_KEY')
 
28
  SAVED_SESSIONS = {
29
  "Que provincias están representadas en los sitios pilotos?": "alanis.pickle",
30
  "Cual es la superficie total de sitios piloto en Buenos Aires?": "alanis.pickle",
31
+ "Realiza un grafico de las areas por provincia de la tabla de sitios piloto": "alanis.pickle",
32
  }
33
 
34
  st.set_page_config(
 
49
  openai_api_key = "not_supplied"
50
  enable_custom = False
51
 
52
+
53
+ conn = sqlite3.connect(DB_PATH)
54
+ df = pd.read_sql_query("SELECT spoat, ecorregion, sag, provincia, supha, area, departamento FROM sitiospilotojson", conn)
55
+ conn.close()
56
+
57
+
58
  # Tools setup
59
  llm = OpenAI(temperature=0, openai_api_key=openai_api_key, streaming=True)
60
  search = DuckDuckGoSearchAPIWrapper()
61
  llm_math_chain = LLMMathChain.from_llm(llm)
62
  db = SQLDatabase.from_uri(f"sqlite:///{DB_PATH}")
63
  db_chain = SQLDatabaseChain.from_llm(llm, db)
64
+ c2p = chat2plot(df)
65
  tools = [
66
  Tool(
67
  name="Search",
 
78
  func=db_chain.run,
79
  description="useful for when you need to answer questions about sitios piloto. Input should be in the form of a question containing full context",
80
  ),
81
+ Tool(
82
+ name="chat2plot",
83
+ func=c2p,
84
+ description="useful for when you need to create a plot from a table",
85
+ return_direct=True,
86
+ ),
87
  ]
88
 
89
  # Initialize agent
 
93
 
94
  # read sitios2.sqlite and convert it to dataframe
95
 
 
 
 
 
 
 
96
 
97
  st.write(df)
98
 
 
132
  # else:
133
  # answer = mrkl.run(user_input, callbacks=[st_callback])
134
  answer = mrkl.run(user_input, callbacks=[st_callback])
135
+ print(type(answer))
136
+ if isinstance(answer, Plot):
137
+ result = answer
138
+ st.plotly_chart(result.figure)
139
+ else:
140
+ answer_container.write(answer)