verticapy.vDataFrame.to_shp¶
- vDataFrame.to_shp(name: str, path: str, usecols: Annotated[str | list[str], 'STRING representing one column or a list of columns'] | None = None, overwrite: bool = True, shape: Literal['Point', 'Polygon', 'Linestring', 'Multipoint', 'Multipolygon', 'Multilinestring'] = 'Polygon') vDataFrame¶
Creates a SHP file of the current
vDataFramerelation. For the moment, files will be exported in the Vertica server.Parameters¶
- name: str
Name of the SHP file.
- path: str
Absolute path where the SHP file is created.
- usecols: list, optional
vDataColumnto select from the finalvDataFramerelation. If empty, allvDataColumnare selected.- overwrite: bool, optional
If set to
True, the function overwrites the index (if an index exists).- shape: str, optional
Must be one of the following spatial classes:
Point,Polygon,Linestring,Multipoint,Multipolygon,Multilinestring.PolygonsandMultipolygonsalways have a clockwise orientation.
Returns¶
- vDataFrame
self
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 fromverticapyare used as intended without interfering with functions from other libraries.For this example, we will use the Cities dataset.
import verticapy.datasets as vpd data = vpd.load_cities()
AbccityAbc1 Abu Dhabi 2 Amsterdam 3 Apia 4 Ashgabat 5 Bangui 6 Budapest 7 Bujumbura 8 Castries 9 Colombo 10 Conakry 11 Cotonou 12 Dakar 13 Dublin 14 Georgetown 15 Havana 16 Kuala Lumpur 17 København 18 Lilongwe 19 Ljubljana 20 London 21 Monrovia 22 Oslo 23 Panama City 24 Paris 25 Phnom Penh 26 Podgorica 27 Pretoria 28 Rangoon 29 San Marino 30 San Salvador 31 Seoul 32 Suva 33 Tegucigalpa 34 Tehran 35 Thimphu 36 Vatican City 37 Warsaw 38 Yaounde 39 Zagreb 40 Andorra 41 Athens 42 Banjul 43 Basseterre 44 Belgrade 45 Bloemfontein 46 Bogota 47 Brasilia 48 Accra 49 Addis Ababa 50 Ankara 51 Antananarivo 52 Asmara 53 Astana 54 Asuncion 55 Bamako 56 Bangkok 57 Beijing 58 Berlin 59 Brussels 60 Buenos Aires 61 Chisinau 62 Damascus 63 Dar es Salaam 64 Dhaka 65 Djibouti 66 Doha 67 Jakarta 68 Jerusalem 69 Kampala 70 Kinshasa 71 Kuwait 72 La Paz 73 Lisbon 74 Luxembourg 75 Madrid 76 Manila 77 Maputo 78 Mbabane 79 Melekeok 80 Minsk 81 Nairobi 82 Naypyidaw 83 New Delhi 84 Nicosia 85 Nouakchott 86 Palikir 87 Port-au-Prince 88 Praia 89 Quito 90 Rome 91 Saint George's 92 San Jose 93 Sarajevo 94 Taipei 95 Tbilisi 96 Tokyo 97 Tripoli 98 Valletta 99 Vienna 100 Vilnius Rows: 1-100 | Columns: 2Note
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 create the SHP file of the current
vDataFrame.data.to_shp( name = "cities", path = "/home/dbadmin/", shape = "Point", )
Note
It will create “cities.shp” file at provided path.
See also