Loading...

verticapy.vDataFrame.to_geopandas

vDataFrame.to_geopandas(geometry: str) GeoDataFrame

Converts the vDataFrame to a Geopandas DataFrame.

Warning

The data will be loaded in memory.

Parameters

geometry: str

Geometry object used to create the GeoDataFrame. It can also be a Geography object, which will be casted to Geometry.

Returns

geopandas.GeoDataFrame

The geopandas.GeoDataFrame of the current vDataFrame relation.

Examples

We import verticapy:

import verticapy as vp

Hint

By assigning an alias to verticapy, we mitigate the risk of code collisions with other libraries. This precaution is necessary because verticapy uses commonly known function names like “average” and “median”, which can potentially lead to naming conflicts. The use of an alias ensures that the functions from verticapy are used as intended without interfering with functions from other libraries.

For this example, we will use the World dataset.

import verticapy.datasets as vpd

data = vpd.load_world()
123
pop_est
Integer
Abc
continent
Varchar(32)
Abc
country
Varchar(82)
Abc
Long varchar(2411724)
157713North AmericaGreenland
2279070OceaniaNew Caledonia
3339747EuropeIceland
4360346North AmericaBelize
51291358AsiaTimor-Leste
61467152AfricaeSwatini
71772255AfricaGabon
81792338AfricaGuinea-Bissau
91895250EuropeKosovo
101958042AfricaLesotho
112103721EuropeMacedonia
122214858AfricaBotswana
132484780AfricaNamibia
142875422AsiaKuwait
153045191AsiaArmenia
163351827North AmericaPuerto Rico
173474121EuropeMoldova
183500000AfricaSomaliland
193753142North AmericaPanama
203758571AfricaMauritania
214510327OceaniaNew Zealand
224954674AfricaCongo
235445829EuropeSlovakia
246653210AfricaLibya
258754413EuropeAustria
269850845EuropeHungary
279960487EuropeSweden
2811138234South AmericaBolivia
2911147407North AmericaCuba
3015460732North AmericaGuatemala
3115972000AfricaZambia
3217885245AfricaMali
3318556698AsiaKazakhstan
3423508428AsiaTaiwan
3524184810AfricaCôte d'Ivoire
3625054161AfricaMadagascar
3725248140AsiaNorth Korea
3829310273AfricaAngola
3929384297AsiaNepal
4029748859AsiaUzbekistan
41265100AsiaN. Cyprus
42603253AfricaW. Sahara
43758288AsiaBhutan
44920938OceaniaFiji
451221549AsiaCyprus
463360148South AmericaUruguay
474543126AsiaPalestine
484689021AfricaLiberia
494930258North AmericaCosta Rica
505011102EuropeIreland
515625118AfricaCentral African Rep.
525918919AfricaEritrea
536025951North AmericaNicaragua
546072475AsiaUnited Arab Emirates
558468555AsiaTajikistan
569038741North AmericaHonduras
5710734247North AmericaDominican Rep.
5810768477EuropeGreece
5911901484AfricaRwanda
6013805084AfricaZimbabwe
6117789267South AmericaChile
6219196246AfricaMalawi
6321529967EuropeRomania
6428571770AsiaSaudi Arabia
6531304016South AmericaVenezuela
6639192111AsiaIraq
6739570125AfricaUganda
6840969443AfricaAlgeria
6954841552AfricaSouth Africa
7080594017EuropeGermany
7182021564AsiaIran
7283301151AfricaDem. Rep. Congo
7396160163AsiaVietnam
74105350020AfricaEthiopia
75207353391South AmericaBrazil
761281935911AsiaIndia
77282814OceaniaVanuatu
78329988North AmericaBahamas
79443593AsiaBrunei
80594130EuropeLuxembourg
81737718South AmericaGuyana
82865267AfricaDjibouti
831218208North AmericaTrinidad and Tobago
841251581EuropeEstonia
851972126EuropeSlovenia
862051363AfricaGambia
872823859EuropeLithuania
882990561North AmericaJamaica
893068243AsiaMongolia
903856181EuropeBosnia and Herz.
914292095EuropeCroatia
925789122AsiaKyrgyzstan
936163195AfricaSierra Leone
946172011North AmericaEl Salvador
957111024EuropeSerbia
967126706AsiaLaos
977531386AfricaSomalia
987965055AfricaTogo
998236303EuropeSwitzerland
1008299706AsiaIsrael
Rows: 1-100 | Columns: 4

Note

VerticaPy offers a wide range of sample datasets that are ideal for training and testing purposes. You can explore the full list of available datasets in the Datasets, which provides detailed information on each dataset and how to use them effectively. These datasets are invaluable resources for honing your data analysis and machine learning skills within the VerticaPy environment.

Let’s convert the vDataFrame to a Geopandas DataFrame.

data.to_geopandas(geometry = "geometry")
pop_est continent country geometry
0 57713 North America Greenland POLYGON ((-46.76379 82.62796, -43.40644 83.22516, -39.89753 83.18018, -38.62214 83.54905, -35.08787 83.64513, -27.10046 83.51966, -20.84539 82.72669, -22.69182 82.34165, -26.51753 82.29765, -31.9 82.2, -31.39646 82.02154, -27.85666 82.13178, -24.84448 81.78697, -22.90328 82.09317, -22.07175 81.73449, -23.16961 81.15271, -20.62363 81.52462, -15.76818 81.91245, -12.77018 81.71885, -12.20855 81.29154, -16.28533 80.58004, -16.85 80.35, -20.04624 80.17708, -17.73035 80.12912, -18.9 79.4, -19.70499 78.75128, -19.67353 77.63859, -18.47285 76.98565, -20.03503 76.94434, -21.67944 76.62795, -19.83407 76.09808, -19.59896 75.24838, -20.66818 75.15585, -19.37281 74.29561, -21.59422 74.22382, -20.43454 73.81713, -20.76234 73.46436, -22.17221 73.30955, -23.56593 73.30663, -22.31311 72.62928, -22.29954 72.18409, -24.27834 72.59788, -24.79296 72.3302, -23.44296 72.08016, -22.13281 71.46898, -21.75356 70.66369, -23.53603 70.471, -24.30702 70.85649, -25.54341 71.43094, -25.20135 70.75226, -26.36276 70.22646, -23.72742 70.18401, -22.34902 70.12946, -25.02927 69.2588, -27.74737 68.47046, -30.67371 68.12503, -31.77665 68.12078, -32.81105 67.73547, -34.20196 66.67974, -36.35284 65.9789, -37.04378 65.93768, -38.37505 65.69213, -39.81222 65.45848, -40.66899 64.83997, -40.68281 64.13902, -41.1887 63.48246, -42.81938 62.68233, -42.41666 61.90093, -42.86619 61.07404, -43.3784 60.09772, -44.7875 60.03676, -46.26364 60.85328, -48.26294 60.85843, -49.23308 61.40681, -49.90039 62.38336, -51.63325 63.62691, -52.14014 64.27842, -52.27659 65.1767, -53.66166 66.09957, -53.30161 66.8365, -53.96911 67.18899, -52.9804 68.35759, -51.47536 68.72958, -51.08041 69.14781, -50.87122 69.9291, -52.01358 69.57492, -52.55792 69.42616, -53.45629 69.28362, -54.68336 69.61003, -54.75001 70.28932, -54.35884 70.82132, -53.43132 70.83576, -51.39014 70.56978, -53.10937 71.20485, -54.00422 71.54719, -55 71.40654, -55.83468 71.65444, -54.71819 72.58625, -55.32634 72.95861, -56.12003 73.64977, -57.32363 74.71026, -58.59679 75.09861, -58.58516 75.51727, -61.26861 76.10238, -63.39165 76.1752, -66.06427 76.13486, -68.50438 76.06141, -69.66485 76.37975, -71.40257 77.00857, -68.77671 77.32312, -66.76397 77.37595, -71.04293 77.63595, -73.297 78.04419, -73.15938 78.43271, -69.37345 78.91388, -65.7107 79.39436, -65.3239 79.75814, -68.02298 80.11721, -67.15129 80.51582, -63.68925 81.21396, -62.23444 81.3211, -62.65116 81.77042, -60.28249 82.03363, -57.20744 82.19074, -54.13442 82.19962, -53.04328 81.88833, -50.39061 82.43883, -48.00386 82.06481, -46.59984 81.98594, -44.523 81.6607, -46.9007 82.19979, -46.76379 82.62796))
... ... ... ... ...
176 1379302771 Asia China MULTIPOLYGON (((109.47521 18.1977, 108.65521 18.50768, 108.62622 19.36789, 109.11906 19.82104, 110.2116 20.10125, 110.78655 20.07753, 111.01005 19.69593, 110.57065 19.25588, 110.33919 18.6784, 109.47521 18.1977)), ((80.25999 42.35, 80.18015 42.92007, 80.86621 43.18036, 79.96611 44.91752, 81.94707 45.31703, 82.45893 45.53965, 83.18048 47.33003, 85.16429 47.00096, 85.72048 47.45297, 85.76823 48.45575, 86.59878 48.54918, 87.35997 49.21498, 87.75126 49.2972, 88.01383 48.59946, 88.8543 48.06908, 90.28083 47.69355, 90.97081 46.88815, 90.58577 45.71972, 90.94554 45.28607, 92.13389 45.11508, 93.48073 44.97547, 94.68893 44.35233, 95.30688 44.24133, 95.76245 43.31945, 96.3494 42.72564, 97.45176 42.74889, 99.51582 42.52469, 100.84587 42.6638, 101.83304 42.51487, 103.31228 41.90747, 104.52228 41.90835, 104.96499 41.59741, 106.12932 42.13433, 107.74477 42.48152, 109.2436 42.51945, 110.4121 42.87123, 111.12968 43.40683, 111.82959 43.74312, 111.66774 44.07318, 111.34838 44.45744, 111.87331 45.10208, 112.43606 45.01165, 113.46391 44.80889, 114.46033 45.33982, 115.9851 45.72724, 116.71787 46.3882, 117.4217 46.67273, 118.87433 46.80541, 119.66327 46.69268, 119.77282 47.04806, 118.86657 47.74706, 118.06414 48.06673, 117.29551 47.69771, 116.30895 47.85341, 115.74284 47.72654, 115.48528 48.13538, 116.1918 49.1346, 116.6788 49.88853, 117.87924 49.51098, 119.28846 50.14288, 119.27939 50.58292, 120.18208 51.64355, 120.7382 51.96411, 120.72579 52.51623, 120.17709 52.75389, 121.00308 53.2514, 122.24575 53.43173, 123.57147 53.4588, 125.06821 53.16104, 125.94635 52.7928, 126.5644 51.78426, 126.93916 51.35389, 127.28746 50.7398, 127.6574 49.76027, 129.39782 49.4406, 130.58229 48.72969, 130.98726 47.79013, 132.50669 47.78896, 133.3736 48.18344, 135.02631 48.47823, 134.50081 47.57845, 134.11235 47.21248, 133.76964 46.11693, 133.09712 45.14409, 131.88345 45.32116, 131.02519 44.96796, 131.28856 44.11152, 131.14469 42.92999, 130.63387 42.90301, 130.64 42.39502, 129.99427 42.98539, 129.59667 42.42498, 128.05222 41.99428, 128.20843 41.46677, 127.34378 41.50315, 126.86908 41.81657, 126.18205 41.10734, 125.07994 40.56982, 124.26562 39.92849, 122.86757 39.63779, 122.13139 39.17045, 121.05455 38.89747, 121.58599 39.36085, 121.37676 39.75026, 122.1686 40.42244, 121.64036 40.94639, 120.76863 40.59339, 119.6396 39.89806, 119.02346 39.25233, 118.04275 39.20427, 117.5327 38.73764, 118.0597 38.06148, 118.87815 37.89733, 118.91164 37.44846, 119.7028 37.15639, 120.82346 37.87043, 121.71126 37.48112, 122.35794 37.45448, 122.51999 36.93061, 121.10416 36.65133, 120.63701 36.11144, 119.66456 35.60979, 119.15121 34.90986, 120.22752 34.36033, 120.62037 33.37672, 121.22901 32.46032, 121.90815 31.69217, 121.89192 30.94935, 121.26426 30.67627, 121.50352 30.14291, 122.09211 29.83252, 121.93843 29.01802, 121.68444 28.22551, 121.12566 28.13567, 120.39547 27.05321, 119.5855 25.74078, 118.65687 24.54739, 117.28161 23.6245, 115.89074 22.78287, 114.76383 22.66807, 114.15255 22.22376, 113.80678 22.54834, 113.24108 22.05137, 111.84359 21.55049, 110.78547 21.39714, 110.44404 20.34103, 109.88986 20.28246, 109.62766 21.00823, 109.86449 21.39505, 108.52281 21.71521, 108.05018 21.55238, 107.04342 21.8119, 106.56727 22.2182, 106.7254 22.79427, 105.81125 22.97689, 105.32921 23.35206, 104.47686 22.81915, 103.50451 22.70376, 102.70699 22.7088, 102.17044 22.46475, 101.65202 22.3182, 101.80312 21.17437, 101.27003 21.20165, 101.18001 21.43657, 101.15003 21.84998, 100.41654 21.55884, 99.98349 21.74294, 99.2409 22.11831, 99.53199 22.94904, 98.89875 23.14272, 98.66026 24.06329, 97.60472 23.8974, 97.72461 25.08364, 98.67184 25.9187, 98.71209 26.74354, 98.68269 27.50881, 98.24623 27.74722, 97.91199 28.33595, 97.32711 28.26158, 96.24883 28.41103, 96.58659 28.83098, 96.11768 29.4528, 95.4048 29.03172, 94.56599 29.27744, 93.41335 28.64063, 92.50312 27.89688, 91.69666 27.77174, 91.25885 28.04061, 90.73051 28.06495, 90.01583 28.29644, 89.47581 28.04276, 88.81425 27.29932, 88.73033 28.08686, 88.12044 27.87654, 86.95452 27.97426, 85.82332 28.20358, 85.01164 28.64277, 84.23458 28.83989, 83.89899 29.32023, 83.33712 29.46373, 82.32751 30.11527, 81.5258 30.42272, 81.11126 30.18348, 79.72137 30.88271, 78.73889 31.51591, 78.45845 32.61816, 79.17613 32.48378, 79.20889 32.99439, 78.81109 33.5062, 78.91227 34.32194, 77.83745 35.49401, 76.19285 35.8984, 75.8969 36.66681, 75.15803 37.13303, 74.98 37.41999, 74.82999 37.99001, 74.86482 38.37885, 74.25751 38.60651, 73.92885 38.50582, 73.67538 39.43124, 73.96001 39.66001, 73.82224 39.89397, 74.77686 40.36643, 75.46783 40.56207, 76.52637 40.42795, 76.90448 41.06649, 78.1872 41.18532, 78.54366 41.58224, 80.11943 42.12394, 80.25999 42.35)))

Warning

Exporting to an in-memory object can take time if the data is massive. It is recommended to downsample the data before using such a function.

See also

vDataFrame.to_db() : Saves the current structure of vDataFrame to the Vertica Database.
vDataFrame.to_json() : Creates a JSON file of the current vDataFrame structure.