Questions tagged [pandas]
pandas is an open source, BSD-licensed library providing high-performance, easy-to-use data structures and data analysis tools for the Python programming language.
266
questions
1
vote
1
answer
394
views
Grouping Polygons by Attributes and by Distance Using GeoPandas and networkx
I am working on creating a unique group ID for a parcel dataset I have containing 115k records. I have been attempting to do this with PostGIS (Grouping Parcels with an ID based on conditions, Query ...
7
votes
1
answer
1k
views
Creating polyline from list of QgsPoints using PyQGIS
So I have a CSV of points that I've cleaned up using pandas, and appended to a list with each item being Type: QgsPoint, with its correct X and Y coordinate. I'm trying to find the correct operation ...
0
votes
1
answer
512
views
ArcGIS API for Python: SEDF from_layer Fails With 'Layer' object has no attribute 'filter'
I'm struggling to build a dataframe out of a featureclass (via a layer), where I'm getting this error message:
Exception: Could not load the dataset: 'Layer' object has no attribute 'filter'
from ...
0
votes
1
answer
234
views
Folium: ValueError: key_on `'FIPS'` not found
I'm working on a Folium choropleth map, using a shapefile from the Census bureau and religion data from the US Religion Census. I can get both sets of data loaded and cleaned up, so I have two DFs:
...
0
votes
1
answer
2k
views
Dividing Geographical region into equal sized grid and retrieving indexing position
I have GPS coordinates of human mobility in Beijing Area. I want to divide geographical space in to rectangular grid, for example 2 sq. km (delta), and access the indexing position of any point inside ...
1
vote
1
answer
1k
views
Converting Pandas DataFrame to spatially enabled DataFrame geometry removes geometry In some cases
I want to convert my Pandas DataFrame with a WKT geometry column to a Spatially Enabled DataFrame (SEDF) and then into a featureclass in a geodatabase; however, sometimes the geometry column in the ...
0
votes
2
answers
122
views
How to round or limit the number of decimals in geodataframe
I need to limit or round decimals in my GeoDataFrame so that when importing to a shapefile and opening a file in QGIS, the number of decimals remains the same as in the dataframe.
In GDF looks like: ...
0
votes
1
answer
397
views
Concatenating pandas dataframes into one geopandas dataframe throws "the truth value..." error when trying to bring it into a geoseries
I am trying to buffer a GeoSeries in geopandas; I have concatenated 3 dataframes together in pandas and converted them into a geoDataFrame using gpd.GeoSeries(cgdf).buffer(x) throws an error "...
0
votes
1
answer
393
views
Create a geopackage file with integer attribute containing NULL values in GeoPandas
I've been asked to produce a geopackage file in a specified format where one attribute is specified to be int64 nullable, and my case includes NULL values. Trying in GeoPandas, my problem is that I ...
1
vote
2
answers
3k
views
Attribute Table into pandas DataFrame-PyQGIS
I'm trying to develop a plugin in QGIS.
My issue is that I don't know how to transform an attribute table into a dataframe in order to use it further in run(self) function later.
I also used a ...
1
vote
1
answer
387
views
Processing time applying dask_geopandas. Dissolve a polygon layer with parallelization
I'm testing the dask_geopandas library to dissolve a polygon layer. However, at the moment the processing time applying the dissolution without parallelization (df) is lower than applying the supposed ...
0
votes
1
answer
86
views
How to return subtype and domain description instead of the code, when using arcgis.gis Python
I am working on some Python that takes an attribute table and makes a pandas df from it. I am doing this by creating an empty list, and looping through each record of the attribute table and making a ...
0
votes
1
answer
719
views
Generating Queried CSV from shapefile using ArcGIS API for Python?
I'm trying to create a csv from a query of a feature layer hosted in ArcGIS Online. The csv only needs to contain one field, where the query is met, geometry is not needed. I'm having issues getting ...
1
vote
1
answer
917
views
Why are some of my markers not showing up in Folium?
I'm creating a map in Folium and it is working great, except several hundred markers aren't showing up on the map. There is no error message, I just notice that there are fewer markers than I expect.
...
0
votes
1
answer
117
views
Overwriting hosted table in ArcGIS Online with CSV file from Pandas dataframe in Python
I have a script that I'm using to sort through a very large feature layer with thousands of records and create a summary table of them by type. It also calculates the count of records of the last 5 ...
1
vote
1
answer
95
views
rio.to_raster returns ValueError: cannot convert float NaN to integer
Maybe this is more like a Pandas question but when I try to write an xarray to a raster using rio.to_raster() I get a ValueError in Python. If I don't convert the type of xarray to int16 (this is a ...
10
votes
3
answers
16k
views
Geopandas: Write layer back into GeoDataBase
I use geopandas (which uses fiona) to read a GeoDataBase layer (using driver="OpenFileGDB") into a geodataframe for easy manipulation.
read_shp = gpd.read_file(GDB_file, layer=layer_choice)
That ...
1
vote
1
answer
50
views
Create filtered file out of overlapping coordinates
I have two CSV files with multiple columns of data (csv_1 and csv_2) which I have as Panda dataframes in Python as cal and pog. They both contain an 'x' and a 'y' column.
I want to make a new dataset ...
2
votes
2
answers
114
views
Colorizing polygons based on a user-defined color scheme determined by the column value
I have a shapefile, and the population density for each polygon is provided in a separate CSV file.I would like to assign colors to each polygon based on a user-defined color scheme determined by the ...
0
votes
1
answer
87
views
Joining by attribute using Fuzzywuzzy module (Python Script)
I'm hoping to get some assistance of debugging my script using fuzzywuzzy attribute joins.
I have housing permit data that needs to be joined to parcel data. Unfortunately, the housing permit data is ...
0
votes
0
answers
178
views
How do I merge 8 data frame without having duplicate suffixes?
I'm trying to merge a grid cell data set with 7 travel time (to shopping centres) data sets.
Here's the head of the grid cell data:
Here's the head of one of the shopping centre data sets(The other ...
0
votes
1
answer
59
views
How to generate multi band raster map from CSV
I'm trying to generate a map from a CSV with percent land usages.
The CSV data looks something like the following:
Index x y l1 l2 l3 l4 l5 l6 l7 l8 l9 l10 l11 l12 l13 l14 l15 l16 l17 ...
0
votes
1
answer
106
views
Get geometry from a <geoprocessing describe geometry object object at 0x000001A9F576D120>
I am trying to use arcpy and pandas to build a line geometry from 2 point geometry columns in a pandas dataframe.
I create the dataframe by loading in the featureclass using the GeoAccessor
from ...
6
votes
3
answers
6k
views
Read a GDB table into a pandas dataframe in ArcPy
I have a set of tables that I have exported to a file geodatabase. I would like to read it into python as a pandas dataframe. When I try to read the file directly using pd.read_csv
import pandas as pd
...
0
votes
1
answer
91
views
df.spatial.to_featureclass produces an empty shapefile [closed]
I am using ArcGIS Pro 2.9.8 and Python 3.7 from the ArcGIS\PRO\bin\Python\envs\arcgis-pro-py3\python.exe.
I have a pandas dataframe from CSV I am trying to get to a shapefile or featureclass for a set ...
3
votes
3
answers
936
views
Preserve column order of GeoPandas file read
I have a shapefile I'm reading in using GeoPandas and then I do some geometry conversion of the data but in the process it unfortunately sorts the columns alphabetically. I need to preserve original ...
4
votes
2
answers
4k
views
Export ArcGIS spatially enabled dataframe to feature class
I'm working to develop a tool that converts JSON data pulled from an API into a feature class to be stored in an ESRI file geodatabase. I'm currently testing the functionality in a Jupyter notebook ...
0
votes
0
answers
33
views
rasterio.mask.mask returning strange values
I am using rasterio.mask.mask to extract values from a raster based on a polygon feature:
out_img, out_transform = mask(raster, feature, all_touched=True, crop=True, nodata=-999)
Mostly it works ...
1
vote
1
answer
108
views
Qgis Plugin DataPlotly (Ubuntu) : 'ModuleNotFoundError: No module named 'pandas'
I work with Qgis 3.34.0-Prizren on Ubuntu.
I would like test and use the qgis DataPlotly plugin.
I succeed in installing this plugin via the qgis plugin manager. But when i try to enable it still into ...
1
vote
1
answer
178
views
Merging a DataFrame with a GeoDataFrame based on two keys
I have a GeoDataFrame called gdf_points with a list of POINTs:
index
NAME
geometry
1
A
POINT(A)
2
B
POINT(B)
And another DataFrame called df_names in which each POINT is associated with possibly ...
70
votes
9
answers
81k
views
Finding nearest point in other GeoDataFrame using GeoPandas
I've got two geodataframes:
import geopandas as gpd
from shapely.geometry import Point
gpd1 = gpd.GeoDataFrame([['John',1,Point(1,1)],['Smith',1,Point(2,2)],['Soap',1,Point(0,2)]],columns=['Name','ID'...
1
vote
1
answer
276
views
Make XY Event Layer in arcpy using a pandas dataframe
I have a Pandas df with Latitude and Longitude columns I am trying to export to a featureclass using ArcPy. I cannot resolve the fiona and GeoPandas issue so I tried to use MakeXYEventLayer_management ...
1
vote
1
answer
140
views
Create multiband raster in Python from X, Y
How do you create a multiband raster in Python and save it as a .tif file from a long dataframe format?
import pandas as pd
import numpy as np
from rasterio.crs import CRS
import rasterio
from ...
1
vote
0
answers
392
views
ArcPy Pandas export spatial data frame to feature class
I am successfully creating two data frames with ArcPy and Pandas, 1) from an enterprise geodatabase feature class and 2) from an enterprise geodatabase table, then merging them into 3) data frame that ...
0
votes
0
answers
47
views
Spatial join of multiple GDFs and extract values
I have several different polygon geodataframes:
I would like to get the interseting area of one to another. I was able to do it like that:
frames = [oranzove, modre, cervene, tyrkysove]
empty = []
...
5
votes
1
answer
16k
views
Getting elevation for multiple lat long coordinates in Python
I have seen the answer to Elevation info for multiple lat long coordinates and I would like to be able to do this with a python script instead. I cannot use Googles API because I have 8000 points. I ...
1
vote
1
answer
2k
views
Merge several JSON files into one CSV file
I have about 37 nested JSON files. The keys and the values are same in all the files. My objective is to combine the data in all the files into a single CSV file so I can analyze the output . I have ...
1
vote
2
answers
611
views
Create pandas DataFrame from raster image - one row per pixel with bands as columns, preserving coordinates [duplicate]
I have a 37 band image that I hoping to transform so that each row is a pixel and each column a band. I am following what was suggested in this post: Create pandas DataFrame from raster image - one ...
9
votes
3
answers
8k
views
Create pandas DataFrame from raster image - one row per pixel with bands as columns
I have a raster image with 3 bands. I would like to convert this image to a csv file where each row will be one pixel and each column will be one band, so that I can easily see the three values each ...
2
votes
1
answer
643
views
Converting list of datapoints with variable CRS to WGS 84 using Python and GeoPandas
I have a file, metadata.csv, containing a list of N sensors, and their location:
sensor_id, pos_east, pos_north, crs
sensor1, 109435.44, 1157776.64, 5110
sensor2, 254194, 6593776, 25833
...
1
vote
0
answers
868
views
How to make folium multiple markers's popups display simultaneously on click on any one of them?
this code works fine but it only displays the popup of the clicked marker. I rather want that all markers' popups display when clicking on any marker of them.
import folium
import pandas as pd
data = ...
5
votes
1
answer
898
views
Converting Pandas column with featurecollection to GeoJSON
I downloaded a CSV that contains a column which has a GeoJSON format and imported it as Pandas DataFrame. How can I convert this to a GeoJSON .geojson? I have about 10,000 rows, each with information ...
1
vote
2
answers
1k
views
Building a GeoDataFrame out of a shapely GeometryCollection with shapely 2.0.0 -> ValueError: DataFrame constructor not properly called!
I successfully used to build a GeoDataFrame out of a shapely GeometryCollection (hereafter gc) as gdf = gpd.GeoDataFrame(gc) but I'm now facing this error with shapely 2.0.0:
gdf = gpd.GeoDataFrame(gc)...
0
votes
1
answer
132
views
How to change eps float value to geographic meter distance
I have a problem in making distance meter parameters for the DBSCAN tool. The problem is that I don't know the eps unit to use and how to change it to meters to be a parameter. Here's the Python ...
1
vote
1
answer
1k
views
GeoPandas installation problems [closed]
I wanted to install GeoPandas, but I end up getting only this. (conda install geopandas)
I also tried the other methods (https://geopandas.org/en/stable/getting_started/install.html), but doesn't ...
1
vote
1
answer
689
views
(Geo)DataFrame left join leads to NaN in all right values
Let these two CSV files on the disk:
$ cat /path/to/gdf0.csv
myid,geometry
332,"MULTIPOLYGON Z (((0 0 0, 0 0 1, 0 1 1, 0 0 0)))"
220,"MULTIPOLYGON Z (((1 1 1, 1 1 2, 1 2 2, 1 1 1)))&...
1
vote
2
answers
871
views
GeoPandas .explode() FutureWarning: Currently, index_parts defaults to True, but in the future, it will default to False to be consistent with Pandas
I have a simple GeoDataFrame containing 2 records, with MultiPolygonZ having several single parts as geometry elements. When I try to split those in their single parts using the .explode() method, it ...
0
votes
1
answer
2k
views
Getting area (%) of two intersecting polygons in Python
I am trying to calculate the area of two intersecting polygons in my GDB using Python (probably geopandas).
I have found solution using PostGIS:
SELECT layer.text,
layer_2.text,
sum(...
2
votes
3
answers
3k
views
Creating GeoTIFF from Pandas DataFrame
I have a Pandas DataFrame that looks like this:
SIF_743,latitude,longitude
0.7626782059669495,-85.90831756591797,22.40107536315918
0.3139636516571045,-85.9532470703125,22.630943298339844
0....
1
vote
1
answer
870
views
Merging points to linestrings using GeoPandas
I have two GeoPandas DataFrames:
points (long,lat) : 60,000 rows
Jams segment (LineStrings) : 204,000 rows
I am trying to create a new DataFrame with the points that are located on LineStrings.
I ...