Deltares / hatyan

Harmonic tidal analysis and prediction
https://deltares.github.io/hatyan/
GNU General Public License v3.0
13 stars 2 forks source link

fix PerformanceWarning about fragmented dataframe (pytest python 3.9 and 3.12) #272

Closed veenstrajelmer closed 2 weeks ago

veenstrajelmer commented 4 months ago
tests/test_analysis_prediction.py: 56 warnings
  /home/runner/work/hatyan/hatyan/hatyan/schureman.py:55: PerformanceWarning: DataFrame is highly fragmented.  This is usually the result of calling `frame.insert` many times, which has poor performance.  Consider joining all columns at once using pd.concat(axis=1) instead. To get a de-fragmented frame, use `newframe = frame.copy()`
    v0uf_base_forv0u = v0uf_base_forv0u.eval(shallow_eqs_pd_str, inplace=False)
tests/test_analysis_prediction.py: 56 warnings
  /home/runner/work/hatyan/hatyan/hatyan/schureman.py:57: PerformanceWarning: DataFrame is highly fragmented.  This is usually the result of calling `frame.insert` many times, which has poor performance.  Consider joining all columns at once using pd.concat(axis=1) instead. To get a de-fragmented frame, use `newframe = frame.copy()`
    v0uf_base_forf = v0uf_base_forf.eval(shallow_eqs_pd_str.replace('-','+'), inplace=False) #for f only multiplication is applied, never division

Todo: