bmvandoren / Nighthawk

Nighthawk is a machine learning model for acoustic monitoring of nocturnal bird migration.
Other
21 stars 4 forks source link

Warning: "set on a copy of a slice" #10

Closed alhirzel closed 4 weeks ago

alhirzel commented 1 year ago

Thank you for your work on Nighthawk. I wanted to report something I am seeing in my logs when running with Vesper, and I wonder if it would be worth fixing:

2023-06-05 23:30:43,852 INFO                 /opt/conda/envs/nighthawk-0.2.0/lib/python3.10/site-packages/nighthawk/run_reconstructed_model.py:107: SettingWithCopyWarning: 
2023-06-05 23:30:43,852 INFO                 A value is trying to be set on a copy of a slice from a DataFrame.
2023-06-05 23:30:43,852 INFO                 Try using .loc[row_indexer,col_indexer] = value instead
2023-06-05 23:30:43,852 INFO                 
2023-06-05 23:30:43,852 INFO                 See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
2023-06-05 23:30:43,852 INFO                   df_split['tmp'] = range(df_split.shape[0])

It seems to reference the middle of:

https://github.com/bmvandoren/Nighthawk/blob/ea78866b4dbb6a9d9b3c340794c55ce06e5ac0ee/nighthawk/run_reconstructed_model.py#L101-L114

HaroldMills commented 4 weeks ago

Fixed in c330a53e11b6e36e67884dab917ee90be4b38ade.