python dsws tool DS_Response.py pandas performance warning

Berowne
Berowne Newcomer
edited February 13 in Datastream

dsws gets a performance warning from pandas

…\python3.12\latest\Lib\site-packages\DatastreamDSWS\DS_Response.py:361: 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()

offending line :
df[colNames] = None

temp hack:

import warnings
# Suppress PerformanceWarningwarnings.simplefilter(action='ignore', category=pd.errors.PerformanceWarning)

Answers

  • Jirapongse
    Jirapongse ✭✭✭✭✭

    @Berowne

    Thank you for reaching out to us.

    The DatastreamDSWS library has been rebranded to DatastreamPy.

    The code needs to be modified, as follows.

    import DatastreamPy as DSWS
    
    ds = DSWS.DataClient(None, username = username, password = password)
    

    Please try this new DatastreamPy library.