MAQ-Observations / MAQ-Observations/post-processing

FutureWarning triggered by units row in Dataframe

Open
#8 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Jupyter Notebook
Stars
6
Forks
2
PR merge metrics
No merged PRs in 30d

Description

It is nice to have the units in the second row of the `.csv`, but adding a row with strings to a Dataframe with numerical values results in a `FutureWarning`:

/home/bart/meteo/maq_observations/post-processing/fetch_data.py:94: FutureWarning: Setting an item of incompatible dtype is deprecated and will raise an error in a future version of pandas. Value 'W m-2' has dtype incompatible with float64, please explicitly cast to a compatible dtype first.
final_df_pivoted.loc[0] = units_row

So this will likely break in future versions. Unfortunately, the only solution I can think of is to add the extra row with units outside of Pandas....

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in post-processing/fetch_data.py at line 94 and inspect how units_row is inserted into final_df_pivoted. Reproduce the pandas FutureWarning with the current CSV/dataframe flow, then verify that the units row is preserved without the incompatible-dtype warning and remains compatible with future pandas versions.

Written by the indexing model from the issue text.

Assessment

Tech stack
pandas, python
Domain
data-engineering
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.