I'm having a bit of trouble changing the CRS in a GeoDataFrame created by iterating over a larger dataset. The epsg is set to the correct value (5070, an Albers Equal Area projection using meters) but when plotting the data GeoPandas uses the wrong CRS. I'm relatively new to GeoPandas and python, so the problem might be very simple. Thanks for taking a look!
import geopandas as gpd
from geopandas import GeoDataFrame
import matplotlib.pyplot as plt
counties = gpd.read_file("C:/Users/j62/Documents/Practice Data/cb_2018_us_county_5m (1)")
contus = GeoDataFrame(columns=counties.columns)
for index, row in counties.iterrows():
if (int(row['STATEFP']) <= 56) & (int(row['STATEFP']) != 2) & (int(row['STATEFP']) != 15):
contus.loc[index,:] = row
contus.set_crs(epsg=5070,inplace=True)
print(contus.crs)
contus.plot()
This outputs epsg:5070 from the print statement and a map showing the data in a geographic coordinate system using lat/lon.
I've tried setting the CRS in the original GDF, which does seem to work correctly, but I'm unable to alter it afterword in the 'contus' GDF.