Я запускаю код python с использованием geo pandas для анализа данных. и я получил ОШИБКУ: Проблема касается 5 последних строк А вот данные , которые я использовал : https://www.fr.freelancer.com/users/l.php?url=https:% 2F% 2Fapp.box.com% 2Fshared % 2Fstatic% 2Fyig4yill3xl83n7361c5q88kehikhje0.zip & sig = ec739bd7319b7823aa4c1d776a8d5ffc3c2da5040abfa799549180c82f1f93bd * 1015
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import geopandas as gpd
from descartes.patch import PolygonPatch
from mpl_toolkits.axes_grid1 import make_axes_locatable
svi = gpd.read_file(r'C:\Users\Hamza\Desktop\Freelancer\SVI_IL2018.shp') # use a Tab key after you type data/ to select a file in the folder
svi.head() # show SVI by tracts in Ilinois
type(svi)
type(svi['geometry'])
svi['geometry'].geom_type
svi['geometry'].area
svi.crs
svi2 = svi.to_crs('epsg:3723') # change CRS to UTM 16N
svi.plot() # plot a GeoDataFrame. This shows tracts in Illinois
svi2 = svi.to_crs('epsg:3723') # change CRS to UTM 16N
svi2.plot()
svi2.head()
ilcounty = svi2.dissolve(by='STCNTY') # dissolve tracts by county
# map overall percentile ranking of social vulnerability
svi2.plot(column='RPL_THEMES', figsize=(6, 8), legend=True) # figsize = (width, height) in inches, default (6.4, 4.8)
svi2['RPL_THEMES'].describe() # get descriptive statistics of RPL_THEMES
svi2['RPL_THEMES'].hist() # show histogram of RPL_THEMES
svi3 = svi2.replace(-999, np.nan) # replace -999 with NaN (null values)
svi3['RPL_THEMES'].describe()
svi3.plot(column='RPL_THEMES', figsize=(8, 10), legend=True)
svi3.plot(column='RPL_THEMES', figsize=(8, 10), legend=True, cmap='YlOrBr')
svi3.plot(column='RPL_THEMES', figsize=(8, 10), legend=True, cmap='hot_r')
tri = gpd.read_file(r'C:\Users\Hamza\Desktop\Freelancer\TRI.geojson')
tri.crs
schools = gpd.read_file(r'C:\Users\Hamza\Desktop\Freelancer\schools.shp')
schools.head()
# 3) show the CRS of a GeoDataFrame schools. They should be in SPCS83
schools.crs
type(schools)
type(schools['geometry'])
tri.plot()
schools.plot()
svi3.plot()
# create fig (figure object) and ax (axis object)
fig, ax = plt.subplots(figsize=(8, 10))
# by default this creates a figure with one subplot (axis) as parameters for nrows and ncols are omitted
# if you create multiple axes, it would be good to name axes instead of ax
# plot three GeoDataFrames on the ax object created above
svi3.plot(ax=ax, column='RPL_THEMES') # plot 'RPL_THEMES' on ax
tri.plot(ax=ax, color='r') # plot tri on ax in red
schools.plot(ax=ax, color='g') # plot schools on ax in green
svi4 = svi3.to_crs('epsg:3435') # change CRS to UTM 16N
svi4.crs
# show three GeoDataFrames in one figure
fig, ax = plt.subplots(figsize=(8, 10))
svi4.plot(ax=ax, column='RPL_THEMES') # map 'RPL_THEMES'
tri.plot(ax=ax, color='r') # show tri in red
schools.plot(ax=ax, color='g') # show schools in green
path = 'https://data.cityofchicago.org/api/geospatial/cauq-8yn6?method=export&format=GeoJSON'
comm = gpd.read_file(path)
comm.head()
comm.crs
comm = comm.to_crs('epsg:3435') # change WGS84 to SPC IL East
comm.crs
# clip svi4 by comm
svi5 = gpd.clip(svi4, comm)
# clip tri by comm
tri2 = gpd.clip(tri, comm)
# warning of change in functionality. you can ignore this.
1012 * Здесь * код * 1012 Hamza \ AppData \ Local \ Programs \ Python \ Python37 \ lib \ site-packages \ geopandas \ geoseries.py: 358: UserWarning: GeoSeries.notna () ранее возвращал False как для отсутствующей (None), так и для пустой геометрии. Теперь он возвращает False только для пропущенных значений. Поскольку вызывающая GeoSeries содержит пустую геометрию, результат изменился по сравнению с предыдущими версиями Geo Pandas. Имея GeoSeries 's, вы можете использовать' ~ s.is_empty & s.notna () ', чтобы вернуть прежнее поведение.
Чтобы игнорировать это предупреждение, вы можете: import warnings; warnings.filterwarnings ('ignore', 'GeoSeries.notna', UserWarning) return self.notna ()