Inf2-FDS / FDS-S1-01-introduction

8 stars 33 forks source link

Deprecation warning for getting series entries by key (Series.__getitem__ treating keys as positions is deprecated.) #2

Open ettolrach opened 1 month ago

ettolrach commented 1 month ago

In the 6th code block where we access the 1st passenger using passenger[1], a deprecation warning is emitted:

[/tmp/ipykernel_523/1585013001.py:1](https://noteable.edina.ac.uk/tmp/ipykernel_523/1585013001.py#line=0): FutureWarning: Series.__getitem__ treating keys as positions is deprecated. In a future version, integer keys will always be treated as labels (consistent with DataFrame behavior). To access a value by position, use `ser.iloc[pos]`
  print(passenger[1]) # Careful: indexing starts at 0.

We should either find a way to hide this warning, mention it explicitly in the text, or switch to using .iloc[] throughout the course.

davidcsterratt commented 1 month ago

Thank you - yes we should fix this.