How to Import CSV Data with Coordinates into Python GeoPandas and Plot it (Beginner Python Tutorial)

Опубликовано: 02 Март 2026
на канале: Pro Geomatics
138
8

Let me save you from the most common GeoPandas headache. You have a CSV file with latitude and longitude but nothing shows up when you try to map it. In this tutorial, I show you the easiest way to read CSV coordinates into GeoPandas and convert them into real points on a map.

What you will learn:
• Read CSV with pandas
• Convert lat and lon to geometry
• Create a GeoDataFrame
• Set the correct CRS (EPSG 4326)
• Plot your points

This works for any Python GIS workflow.

Code used in this tutorial:

import pandas as pd
import geopandas as gpd
from shapely.geometry import Point

df = pd.read_csv('data.csv')
geometry = [Point(xy) for xy in zip(df.longitude, df.latitude)]
gdf = gpd.GeoDataFrame(df, geometry=geometry)
gdf.set_crs(epsg=4326, inplace=True)
gdf.plot()

If this helped you, check out my video on importing Shapefiles, GeoPackages and GeoJSON into GeoPandas.