'How to solve the attribution problem is python: AttributeError: module 'pandas._typing' has no attribute 'FilePathOrBuffer'

I am trying to read a Dicom format file in my python and since the image is 3D, the image cannot be viewed directly.

I tried to save the helper function from the related repo and followed guidelines offered by the repo. However, it seems I cannot import the helper .py file and run the helper function, below is the error message I received :

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Input In [22], in <cell line: 1>()
----> 1 from helper import dcmread_image
      3 image = dcmread_image(fp=sample_dcm, view=view)
      4 plt.imshow(image[0], cmap=plt.cm.gray)

File ~/ai_project/AI-IN-MEDICAL-MATERIALS/03-Data-Formats/helper.py:36, in <module>
     29     pixel_array = rescale_intensity(
     30         pixel_array, in_range=(low, high), out_range="dtype"
     31     )
     32     return pixel_array
     35 def read_boxes(
---> 36     boxes_fp: pd._typing.FilePathOrBuffer, filepaths_fp: pd._typing.FilePathOrBuffer
     37 ) -> pd.DataFrame:
     38     """Read pandas DataFrame with bounding boxes joined with file paths"""
     39     df_boxes = pd.read_csv(boxes_fp)

AttributeError: module 'pandas._typing' has no attribute 'FilePathOrBuffer'

How do I resolve the problem?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source