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.

Filter by
Sorted by
Tagged with
3 votes
1 answer
94 views

'ValueError: Expected object or value' when reading GeoJSON file with Pandas

I tried to read a GeoJSON file with Pandas, but I got a ValueError message: 'ValueError: Expected object or value' Here's the approach I used: import pandas as pd geojsonPath = r"Z:\dems\...
user avatar
  • 31
1 vote
0 answers
23 views

Computing the centroid manually seems to affect the distance in GeoPandas [closed]

Consider this simple example: import pandas as pd import numpy as np import geopandas as gpd # read geodata for five nyc boroughs gdf_nyc = gpd.read_file(gpd.datasets.get_path('nybb')) # read geodata ...
user avatar
0 votes
1 answer
41 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 ...
user avatar
  • 68
0 votes
0 answers
38 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 ...
user avatar
1 vote
1 answer
89 views

Converting x/y in Pandas DataFrame to lat/long

I have written the following Python code to convert various input files into a shapefile using Pandas. The coordinates of the input file are x,y which is what my shapefile outputs to, but I would like ...
user avatar
0 votes
0 answers
38 views

Spatial DataFrame layer object has no attribute 'layer'

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 ...
user avatar
  • 203
3 votes
0 answers
89 views

Constructing shapely Points from pandas series

I am new to geospatial analysis including geopandas and shapely. My requirement is to do a point in a polygon operation using a spark dataframe and pandas UDF (for performance reasons). The spark ...
user avatar
0 votes
0 answers
38 views

Load dataset and create raster .grd whit python

Hi I'm new working whit geoespatial documents and I'm trying to load data from a plain text file and I want to convert it to a .grd raster. I would be very grateful if someone could guide me on what I ...
user avatar
5 votes
2 answers
561 views

Joining two Pandas DataFrames based on lat, long as fields

I have two Pandas DataFrames containing "lat" and "long" coordinates. I'd like to do a spatial join and merge columns from one DataFrame into another. import pandas as pd df1 = pd....
user avatar
  • 345
0 votes
0 answers
59 views

How do you do a cx_oracle executemany with a geofield

I am trying to do in python mass insert of data from one table to another where one of the fields is an oracle SDO_GEOMETRY(2001,4283,MDSYS.SDO_POINT_TYPE(X,Y ,NULL),NULL,NULL) using the cx_oracle ...
user avatar
  • 1
4 votes
1 answer
152 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 ...
user avatar
3 votes
3 answers
773 views

Reverse geocoding of Pandas DataFrame with Lat/Long columns

I have a DataFrame with Lat/Long coordinates in separate series. I am trying to use GeoPy and Nominatim to get the reverse raw address. I keep getting errors such as: TypeError: reverse() takes 2 ...
user avatar
  • 613
0 votes
0 answers
19 views

Selecting an FID column from a CSV file and assigning it to variable to query

I'm trying to create a wordle game and I'm running into issues trying to query the list of countries that I have in a separate CSV file. I keep running into errors and I'm not really sure what method ...
user avatar
  • 1
3 votes
1 answer
157 views

Find duplicates between two Pandas based on lat, long intersect

I have two pandas DataFrames with Address, Lat and Long as columns. I'd like to find rows that are duplicates between the 2 dataframes based on the intersection of their coordinates. I'll define the ...
user avatar
  • 345
1 vote
0 answers
39 views

Label coordinates that fall in a specific shapefile

I have a dataframe for individuals, each individual has X and Y coordinates, and I have a .shp file that has a number of polygons. individuals dataframe look like: ind_ID x_coordinates y_coordinates ...
user avatar
  • 11
0 votes
0 answers
65 views

ArcGIS Python API - FeatureLayer set CRS

I'm loading a layer from ArcGIS with the ArcGIS Python API: from arcgis.features import FeatureLayer layer=FeatureLayer(lyr_url) Then I make it a pandas dataframe and then move it to Geodataframe as ...
user avatar
  • 133
0 votes
1 answer
178 views

Adding column in a GeoDataFrame with the SRID of each geometry?

I'm merging a list of shapefiles with this code: from pathlib import Path import pandas import geopandas from tqdm import tqdm folder = Path(r"read path") shapefiles = folder.glob("...
user avatar
  • 281
2 votes
0 answers
26 views

Naming or extracting segments as geometrical objects from polygons

I have this little issue that I can't really make a good solution for. I have this dataframe: index id x_polygon y_polygon \ 0 0 168bb0ea-3748-42ad-84c3-...
user avatar
1 vote
0 answers
56 views

Why count() doesn't work but size() does in Pandas? [closed]

I have a point and a polygon data and in this line I'm simply making a spatial join and group its output to count incidents per area. Currently this line works but I don't understand why it works. I ...
user avatar
  • 431
1 vote
1 answer
486 views

Subsetting a Pandas dataframe based on latitude and longitude values and coordinates of a circular boundary in Python

I have a dataset with coordinates (LAT and LON) and boundary coordinates of a circle (shown in the figure below). I want to subset a dataset based on coordinates of this circular boundary for getting ...
user avatar
1 vote
2 answers
248 views

Extracting points from a (FIRMS)Google Earth Engine layer in Python

My goal is to extract data from FIRMS to further analyze it in a tabular data format. How can I extract those orange marks that indicate fire? Can I output them as a CSV or a pandas dataframe? I would ...
user avatar
3 votes
1 answer
1k views

Pandas DataFrame to GeoDataFrame with Polygon geometry using groupby and lambda

I have a pandas DataFrame like this name loc_x loc_y grp_name a1 1.0 2.0 set1 a2 2.0 3.0 set1 a3 3.2 4.1 set2 a4 7.9 4.2 ...
user avatar
  • 93
1 vote
1 answer
280 views

Converting text file into GeoJSON using Python

I'm trying to take in a txt-file and convert it into data for a GeoJSON dataset with these values. I used this piece of code from this article: Pandas to GeoJSON (Multiples points + features) with ...
user avatar
3 votes
1 answer
2k views

Parsing/converting ISO 8601 datetime fields using pandas

I have a datetime field in a Pandas dataframe that becomes problematic when using ArcGIS Pro to load data from a csv to a table on ArcSDE. The field in Pandas looks like this: 2007-02-01T05:00:00....
user avatar
0 votes
1 answer
88 views

Update cursor with nested dictionary with ArcPy

I'm trying to update a mosaic dataset tables attributes with values from a CSV. The CSV and dataset share a field that uniquely identifies each record, and all of the fields to update have exactly the ...
user avatar
  • 363
1 vote
1 answer
260 views

Why are columns in a GeoDataFrame supposedly 'missing" when the set_index method is called?

I am trying to use the NetworkX package in Python to find the shortest route between two points along a road network. Rather than straight lines between nodes in the road network, I need my script to ...
user avatar
1 vote
0 answers
38 views

Extract time series from CFSV2 Google Earth Engine Python

I'm trying to export to a dataframe the time series of the CFS model for the maximum temperature since 2000 for any latitude/longitude, but I have a Time Out problem. So, I tried a for each year and ...
user avatar
3 votes
1 answer
88 views

Detecting intersection points which lay within U-shape using ArcPy

I have three shapefiles: the first is a line the second contains a polygon and the third contains all intersections points of the shapefiles. I have written an algorithm that adds the length of the ...
user avatar
  • 55
1 vote
1 answer
35 views

Matching/Joining Photos to two fields and a fuzzy time

I have a directory with around 100,000 images sorted by the crew that took the photo and the time it was uploaded. I also have a master spreadsheet with the dates the images were taken, the camera's ...
user avatar
0 votes
1 answer
33 views

Points within buffer with the same id

I have a buffer layer and a point layer: buffer_gdf ID 0 1A 1 1B 2 1C and point_gdf ID 0 1A 1 1A 2 1A 3 1A 4 1A 5 1B 6 1B 7 1B 8 1B 9 1B ...
user avatar
0 votes
0 answers
261 views

Fiona Saving Gives DriverIOError

I have a script that I used before to clip polygons. I modified it a touch to use in another place, but am running into a fiona.errors.DriverIOError. As far as I can tell, all the code is working ...
user avatar
  • 944
1 vote
2 answers
922 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 ...
user avatar
  • 167
-1 votes
1 answer
80 views

How to solve error when querying the .shp file to Excel?

I am making a Python code with geopandas and xlwings, what I do is colsulse .shp files from Excel, it works fine but when it reaches the last line of the code wb.save (in_file) where it should be ...
user avatar
1 vote
0 answers
262 views

Geometry not recognized as such even though it is

I have a GeoDataFrame in which the geometry column consists of polygons. Zones = id geometry 0 A1 POLYGON ((119.82334 28.35047, 119.79008 28.350... 1 ...
user avatar
0 votes
0 answers
128 views

Edits to a spatial dataframe dont carry over when exporting to a featureclass in ArcPy, why?

I created a spatial dataframe from a featureclass. Then I edited the spatial dataframe, and exported it back to a featureclass. I was expecting the attribute table of the featureclass to keep the ...
user avatar
  • 147
2 votes
1 answer
210 views

How can I create a Choropleth by combining a polygon GeoPanda with a point GeoPanda?

I have two GeoPanda dataframes, one with the location of shops with point coordinates in the geometry column, and one with London boroughs with polygons in the geometry column. My usual approach with ...
user avatar
  • 23
0 votes
0 answers
38 views

Spliting the column in CSV its showing attribute Error in QGIS plugin

I am trying create a new plugin in QGIS. I have my own script its work in normal Jupyter Notebook, then I planned to convert into as QGIS Plugin.The dout/error occur while spliting the columns. ...
user avatar
  • 43
9 votes
1 answer
3k views

Shapely coordinate sequence to GeoDataFrame

Using the shapely bounding box function box, and a GeoDataFrameof points, I have extracted a bounding box and created a buffer around it (below gdf is a GeoDataFrameof points): bbox=shapely.geometry....
user avatar
  • 1,483
1 vote
0 answers
152 views

Creating a code that computes the distance between two properties given northings and eastings

I was given a file with different properties in different sheets containing coordinates for each corners. I need to create a program that computes the distance between two lots. I'm not sure how to ...
user avatar
1 vote
0 answers
133 views

Getting error while trying to read multipolygon data using shapely wkt.loads (Python)

I have a CSV file from which I'm trying to read multipolygons using wkt.loads of shapely. While this works: from shapely import wkt x='MULTIPOLYGON(((18.62981086588664 73.79447461830097,18....
user avatar
1 vote
1 answer
372 views

Array memory error when reading rasters

I'm attempting to make a spatio-temporal statistics analysis on a few chunks of data using rasterstats, rasterio and pandas/geopandas on Python. # create dataframes for areas of interest and specify ...
user avatar
  • 81
0 votes
2 answers
619 views

Combine multiple rows in a CSV using Pandas

I have over a hundred CSV files that I will join with selections of a shapefile to represent visually in QGIS. However, in these CSV files, the data is sometimes split into rows of 1A and 1B, or 13A ...
user avatar
  • 11
1 vote
1 answer
35 views

Geopandas Points within Polygon; Is there a method to convert bool series result into a python list?

Working in Linux OS with Visual Studio Code; Jupyter Notebook module. import geopandas as gpd ubp1 = "/media/rg/data/map/urban boundary.geojson" poly1 = gpd.read_file(ubp1) import shapely....
user avatar
  • 13
2 votes
2 answers
174 views

Selecting attributes by coordinates from DataFrame in Python

I wonder how to return the right information needed from this df. Currently I get an empty return. I think the problem is my selection because the coordinates are correct and all variables are as well....
user avatar
0 votes
1 answer
465 views

How to plot coordinate system from EPSG 4326 on north pole centered map in Python?

I have the following pandas dataframe (df) which looks like this with column headers and data values, 3 points each: temperature: array([-101.6015625, -100.9296875, -85.4296875]) latitude: array([32....
user avatar
4 votes
1 answer
502 views

Return Geometry in a Pandas Dataframe Google Earth Engine

I have found some sample code that returns features from a GEE image to a pandas dataframe based on specific points in my feature collection. The challenge is I need the geometry on these points to be ...
user avatar
1 vote
0 answers
30 views

How to speed up a complex process of compositing multispectral images in python?

I would like to speed up my process. I have a one month time series which consists of 5 images (Sentinel-2) taken over several days. Each image is made up of the same bands that I selected. After ...
user avatar
  • 61
1 vote
1 answer
478 views

How to split a single polyline shapefile into many shapefiles based on unique value using GeoPandas?

I have a single polyline shapefile with multiple features (row). I want to export each row to separate shapefile with using GeoPandas. But I got Geometry error in the code. This is my shapefile: and ...
user avatar
1 vote
1 answer
51 views

Convert the time to the suitable format using Pandas [closed]

I have a file whose name is "MCD43A3_Alb_QA_SWIR_2020_061.tif", and I want to split the time "2020_061" and convert to the format "2020-03-01", how can I do that? Here is ...
user avatar
  • 51
1 vote
0 answers
485 views

Getting the center point of a cluster in Pandas

I have a list of of coordinates that have areas mapped out as follows import pandas as pd import numpy as np import folium from folium import plugins from folium.plugins import HeatMap import pyodbc ...
user avatar
  • 95

1
2 3 4 5