Skip to content

Avoid growing Pandas.DataFrame in list

Following warning was raised by nucount.image_segmentation.ImageSegmentation.getNumberOfNuclei():

PerformanceWarning: DataFrame is highly fragmented. This is usually the result of calling `frame.insert` many times, which has poor performance

Possible fix: Append rows as list to a list and build DataFrame after the loop.

ToDo:

  • fix nucount.image_segmentation.ImageSegmentation.getNumberOfNuclei()
  • fix nucount.visium_segmentation.VisiumSegmentation.getNumberOfNucleiBySpot()