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
0
votes
0answers
17 views

Nest a dictionary in JSON with Python for GeoJSON properties

Using the Python GeoJSON library I am creating a feature collection of MultiPolygons. I cannot find a way to include properties (attributes) in the features. I have tried: features = df.apply( ...
1
vote
0answers
21 views

Convert ODK geo_shape to geojson

I've collected polygon data using ODK's geo_shape. I'm trying to convert it to a geojson for use in QGIS. I'm using python 3, pandas and geojson to do this. The geo_shape output from ODK looks like ...
0
votes
0answers
28 views

From SQL database to pandas dataframe to numpy array to ESRI Table

End goal: Join data pulled from a SQL database to three different feature classes in a ESRI geodatabase. Efforts: Using PYODBC, I've connected to the database and dumped the data into a Pandas ...
1
vote
1answer
72 views

Cutting a portion of a satellite image based on coordinates in GDAL?

I have a satellite image of 7-channels (Basically I have seven .tif files, one for each band). And I have a .csv file with coordinates of points-of-interest that are in the region shot by the ...
0
votes
0answers
51 views

Checking for geospatial similarity in Python?

Say I have two pandas dataframes in a format similar to this one where each 'Point' represents a person and where they were at. Assume that there are multiple line strings representing different ...
1
vote
1answer
21 views

How to determine column value based on lowest value from other column? [closed]

I have the following dataframe with same value in 'nearest_beacon' column but different distance in 'vms_distance' column. My Dataframe: nearest_beacon vms_distance associated 4548780 0.486456 ...
2
votes
0answers
32 views

Plotting Geopandas Gallery example fails?

I have been having trouble getting the figures from the example provided in Geopandas Gallery examples. When I ran these scripts in Jupyter console: import geopandas import geoplot import matplotlib....
2
votes
1answer
42 views

Retaining last position of vessel position in geodataframe including time series?

I have geodataframe about vessel position which include unique code called 'mmsi' and time series. In the following 'mmsi' column has more than 1 'mmsi' code and time series (* mark). mmsi ...
2
votes
1answer
45 views

Setting up ArcPy virtual environment with Pandas?

Do I need to bounce back and forth between two virtual environments in order to run Pandas and ArcPy in the same script, while ensuring Pandas (or accidental updates to NumPy) doesn't break Arcpy? I'...
2
votes
1answer
44 views

arcpy.da.NumPyArrayToTable() RuntimeError: Unspecified error

Using arcpy for ArcGIS Desktop 10.7.1... In order to append data from a Pandas data frame to an ArcGIS table, I am attempting to create a temporary in-memory table from the Pandas data frame as ...
2
votes
1answer
26 views

Find gaps in spatial database based on attributes and fill those caps with new features with existing attributes

I have a big line shapefile data (over 2 millions features) showing animal movements. Simplified example: ID    Year    st_time     end_time&...
2
votes
1answer
94 views

TypeError: Input geometry column must contain valid geometry objects

I'm working in a urban biodiversity project and I have a csv file for a birds inventory with a column index called 'geom' composed by multypolygons as this: name geom ...
2
votes
1answer
137 views

Iterating over column from CSV using pandas? [closed]

The problem that I am experiencing is as following: I have a csv with the following columns: 'time' (with date and time), 'id', 'lat', and 'long'. The data shows movements and id represents a mobile ...
0
votes
1answer
52 views

Returning raw address from pandas column using Geopy?

I have a Pandas dataframe, and I'm calling a geopy function on each row of 'address_original' column to get as much detail as possible about every address from geopy.geocoders import GoogleV3 ...
2
votes
2answers
52 views

Opening different XLS spreadsheets as table with ArcPy?

I am trying to write a Python script that uses a xls file with different spreadsheets as input to build features and domains in a geodatabase. This is the data in Sheet1: and this the data in ...
1
vote
1answer
222 views

Multiple shapefiles to one GeoPandas GeoDataFrame

I'm trying to vertically concatenate multiple shapefiles that reside in one directory, into one geodataframe. They all have the same table schema and same CRS. I am trying to use the code from this ...
0
votes
1answer
61 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
1answer
86 views

Extracting values from array created with FeatureClassToNumPyArray and converted to DataFrame?

I cannot understand how to use the values in the arrays created with arcpy.FeaturesToNumPyArray. I want to create an array and then convert them to a pandas DataFrame. So I created an array from ...
0
votes
1answer
321 views

How to create a GeoDataFrame points grid from a numpy.mgrid?

I'm trying to create a GeoDataFrame points grid from a numpy.mgrid. I already have created the numpy.mgrid with coordinates of future points. >>>arr = np.mgrid[-1827342.1753285176:-1827523....
2
votes
1answer
185 views

Calculate mean values for all bands and date to a dataframe

I have 5 rasters, each having 10 bands, where each band corresponds to a specific date. How do I calculate mean values for all 10 bands and save them? I need to save the mean values in a dataframe ...
1
vote
0answers
36 views

Preserving data types when publishing to ArcGIS Online using ArcGIS Python API?

I have a Python script which does some data manipulation using Pandas dataframes, then outputs to CSV. The CSVs are then published to AGOL using the ArcGIS Python API, overwriting the existing ...
5
votes
2answers
2k views

GeoPandas spatial join and count

I have following two GeoDataFrames. One with the crime count per polygon per year. Polygon Year total_crime shape_area geometry 0 0 2009 1 3.266388e+06 ...
0
votes
0answers
277 views

Creating geodatabase table from pandas data frame?

I have a .xlsm file which I use to update an existing point feature class, with the information from a certain sheet. The data from the sheet has to be projected in GIS using Route events, and later, ...
0
votes
1answer
45 views

Compare same values and keep biggest number's value in another column? [closed]

Here is an example to explain what I mean: I want from this: index area key 0 1 50 1f 1 2 60 2 2 3 70 3d 3 5 80 4 4 1 90 5 5 2 100 6 6 ...
1
vote
1answer
446 views

Creating LineString and length of LineString from multiple latlon points for each row in a Pandas Dataframe

So I want to create a LineString and get the length of the LineString from two sets of LatLon coordinates (points) in each row in a Pandas Dataframe, and store in a new column How can I do this?
1
vote
1answer
224 views

How to identify unique attributes in a column and add them as separate columns and perform spatial join sum in python

I need to extract all unique values from the "CATEGORIES" column from shapefile 2 (from the Shapefile and its data frame is shown below) and add them as columns to the Shapefile-A data table (see ...
3
votes
1answer
493 views

How to create the prj file with fiona and geopandas?

I am trying to create a shapefile and a geojson using geopandas and fiona. import fiona import fiona.crs ... geometry = [Point(xy) for xy in zip(df['longitude'],df['latitude'])] crs = {'init': '...
1
vote
1answer
69 views

Encoding in Python toolbox?

My Python toolbox uses a function (code below) to save values to a CSV file. When I was using the same code in a Jupyter notebook, saved records were properly encoded (I am dealing with Polish letters ...
1
vote
0answers
310 views

Reading data to geopandas using WFS - GML format

This relates to the question here: Reading data to geopandas using WFS? Is there a way to to do the same with a service that does not supply the data in GeoJSON format, but in GML-format? The ...
1
vote
0answers
47 views

Select different columns from each feature layer to be count values [closed]

How to count values (occurences of values) in each feature layer using a loop? The problem is that the column names are not the same for all layers. I have a table that has columns: ...
2
votes
0answers
119 views

QGIS plugin external libraries in plugin’s directory

I’m developing my first QGIS plugin and I have to use two external libraries not included in the default OSGeoW64 installation: Couchdb and Pandas. I would like to include those libraries in my ...
1
vote
1answer
52 views

Joining attributes after selecting one polygon which intersects another using geopandas?

To select the polygons which overlap other layer's polygons, I came up with this code based on what I found on this site: import geopandas as gpd import fiona import os import sys # Get the current ...
1
vote
1answer
4k views

Uninstalling and Reinstalling Anaconda

I had 2 versions of pandas (22 and 23) in my Anaconda environment for Python 3.6. One of the pandas looks like it was installed through Python 2.7 pip. Basically, I am unable to import pandas at all ...
3
votes
1answer
219 views

How to process 2 GeoDataFrames by rows pairwise?

I have 2 GeoDataFrames 100 records each, and want to calculate distances between respective geometries (Points, of course). I can't see how to make it other than write a cycle to iterate rows ...
0
votes
1answer
84 views

StopIteration: iteration not started Error when zipping a cursor using arcpy.da.UpdateCursor

I've run into a StopIteration: iteration not started error while trying to order a table using an update cursor. Is this caused by zipping the cursor together? I've tried updating a different table ...
2
votes
1answer
476 views

Join Pandas Dataframe to Shapefile?

I have a shapefile: Street1 Street2 Street3 Field Clark Taylor Field Jackson State Franklin 23rd 25th And a Dataframe df: Page Entry_Date 12 08012018 17 ...
2
votes
2answers
357 views

Replace several coordinates by its mean value grouped by multiindex Pandas

I have a table with some info that are getting by a GPS, in my table I have this structure: Date Time Latitude Longitude Accuracy Weather Visibility ViewPoint Species Bearing ...
2
votes
1answer
452 views

Extracting GPS points inside the region boundary

I have large set of GPS coordinates of human mobility in different parts of China, but I am only interested in points in Beijing City. These points are in excel csv file that I read into pandas ...
1
vote
0answers
479 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 ...
2
votes
2answers
3k views

Visualizing GPS points on interactive map [closed]

I am using version 3.0 of python, I want to visualize GPS points in my dataset on interactive map. Is there any python library that can help me to visualize my data on maps. Reference of any tutorial ...
3
votes
2answers
1k views

Transfering from pandas dataframe to Geopandas?

I am not able to transfer a pandas dataframe column with geolocation coordinates into a Geopandas Point format. location = pd.read_csv('City_addresses') print location['Geolocation'].head() Outputs ...
5
votes
0answers
323 views

Taking ArcGIS feature class to pandas pivot table? [closed]

I'm new to pandas and am trying to create a pivot table based off of two fields - DIVISION and MATERIAL. I'd like to count each occurances of each value. Rows would be DIVISION and columns would be ...
4
votes
1answer
322 views

Importing pandas dataframe as layer in QGIS?

I'm working on a dataset that is readily available as a pandas dataframe object. Now, I would like to import this data as a layer in QGIS. I didn't find any helpful library or code to do so. So, I ...
0
votes
1answer
1k views

Saving dataframe as dbf with simpledbf in Python?

I am doing a number of joins outside of ArcGIS as pandas seems to outperform it. I read in the dbf file with simpledbf, convert it to a dataframe, then do the join: import pandas as pd from simpledbf ...
0
votes
1answer
461 views

How to display large geospatial data in a jupyter notebook with style and tooltip?

I have a large amount of data stored on a postgreSQL database (RDS) with the PostGIS extension enabled. We are currently doing quality assessment of the data and therefore I would like to inspect/...
1
vote
0answers
350 views

Group by index column, compare area and add values to new column in Python?

I have these columns: index, area_of_poly, cad_admin I have to group by index (it is a normal column called index) in order to take the rows that have the same value. #all the ones, all the twos, ...
0
votes
3answers
102 views

Populate missing fields/labels for a grid of polygons with python? [closed]

I have an Esri polygon feature class in a grid that covers a geographic region, and one field, which we'll call 'Label' has an arbitrary label that consists of two digits for north/south, and two ...
1
vote
0answers
208 views

Why GROUPBY doesn't work?

I don't know why but pandas groupby doesn't work in this case whereas I used it well in other scripts. All lines are still there after it. This is my code: all_points['WKT'] = all_points['geometry']...
3
votes
1answer
2k views

How to create a raster from csv points file [duplicate]

I have a CSV points file, with NDVI values. My goal is to create a GeoTiff with 10 meters pixel, where each pixel value is calculated as the mean of points values in this square. I read the CSV with ...
3
votes
1answer
4k views

How to measure distance between 2 GPS points in Pandas?

I have two data frames both containing x,y GPS coordinates and I'm trying to determine if they are within a 1/4, 1/2 and 1 mile of each other. Like this: # COORDS1 DAY LATITUDE ...