metric_entity.py 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. # -*- coding: utf-8 -*-
  2. """
  3. @author: yq
  4. @time: 2024/11/1
  5. @desc: 常用指标实体集合
  6. """
  7. from typing import Union
  8. import pandas as pd
  9. class MetricFucEntity():
  10. """
  11. 指标计算函数结果类
  12. """
  13. def __init__(self, table: pd.DataFrame = None, value: str = None, image_path: Union[str, list] = None,
  14. table_font_size=12, table_autofit=False, table_cell_width=None, image_size: int = 6):
  15. self._table = table
  16. self._table_font_size = table_font_size
  17. self._table_cell_width = table_cell_width
  18. self._table_autofit = table_autofit
  19. self._value = value
  20. self._image_path = image_path
  21. self._image_size = image_size
  22. @property
  23. def table_cell_width(self):
  24. return self._table_cell_width
  25. @property
  26. def table_autofit(self):
  27. return self._table_autofit
  28. @property
  29. def table_font_size(self):
  30. return self._table_font_size
  31. @property
  32. def table(self) -> pd.DataFrame:
  33. return self._table
  34. @property
  35. def value(self):
  36. return self._value
  37. @property
  38. def image_path(self):
  39. return self._image_path
  40. @property
  41. def image_size(self):
  42. return self._image_size
  43. if __name__ == "__main__":
  44. pass