Eu consegui acertar o exercicio fazendo manual item a item, mas a resolução do exercicio tem um problema a seguir:
Cell In[125], line 25
22 metro = metro.to_crs('+proj=utm +zone=23 +south +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=km +no_defs')
24 # Criando as colunas com as respostas
---> 25 geo_dados['Metro_Perto'] = geo_dados['geometry'].apply(lambda x: metro['Nome'].iloc[metro.distance(x).idxmin()])
26 geo_dados['Dist_Min'] = geo_dados['geometry'].apply(lambda x: "{0:.2f} km".format(metro.distance(x).min()))
27 geo_dados['Metro_Longe'] = geo_dados['geometry'].apply(lambda x: metro['Nome'].iloc[metro.distance(x).idxmax()])
643 @doc(pd.Series)
644 def apply(self, func, convert_dtype=True, args=(), **kwargs):
--> 645 result = super().apply(func, convert_dtype=convert_dtype, args=args, **kwargs)
646 if isinstance(result, GeoSeries):
647 if self.crs is not None:
4789 def apply(
4790 self,
4791 func: AggFuncType,
(...)
4796 **kwargs,
4797 ) -> DataFrame | Series:
4798 """
4799 Invoke function on values of Series.
...
-> 1104 return np.array(self, dtype=dtype, copy=copy)
ValueError: Unable to avoid copy while creating an array as requested.
If using `np.array(obj, copy=False)` replace it with `np.asarray(obj)` to allow a copy when needed (no behavior change in NumPy 1.x).
For more details, see https://numpy.org/devdocs/numpy_2_0_migration_guide.html#adapting-to-changes-in-the-copy-keyword.
Envio uma pip list do meu ambiente:
❯ pip list
Package Version
----------------- -----------
asttokens 2.4.1
attrs 24.2.0
certifi 2024.8.30
click 8.1.7
click-plugins 1.1.1
cligj 0.7.2
comm 0.2.2
contourpy 1.3.0
cycler 0.12.1
debugpy 1.8.6
decorator 5.1.1
et-xmlfile 1.1.0
executing 2.1.0
fiona 1.10.1
fonttools 4.54.1
geopandas 0.13.2
ipykernel 6.29.5
ipython 8.28.0
jedi 0.19.1
jupyter_client 8.6.3
jupyter_core 5.7.2
kiwisolver 1.4.7
matplotlib 3.9.2
matplotlib-inline 0.1.7
nest-asyncio 1.6.0
numpy 2.1.1
openpyxl 3.1.5
packaging 24.1
pandas 2.2.3
parso 0.8.4
pexpect 4.9.0
pillow 10.4.0
pip 24.0
platformdirs 4.3.6
prompt_toolkit 3.0.48
psutil 6.0.0
ptyprocess 0.7.0
pure_eval 0.2.3
Pygments 2.18.0
pyogrio 0.10.0
pyparsing 3.1.4
pyproj 3.7.0
python-dateutil 2.9.0.post0
pytz 2024.2
pyzmq 26.2.0
seaborn 0.13.2
shapely 2.0.6
six 1.16.0
stack-data 0.6.3
tornado 6.4.1
traitlets 5.14.3
tzdata 2024.2
wcwidth 0.2.13
E possivel corrigir este item?