0

I've tried to strftime, but i have AttributeError Here is the code

dater=num2date(datafile.variables['lightning_flash_TAI93_time'][:], start_value_units.units)

        daty=dater.strftime("%Y%m%d")
        date = np.concatenate([date, daty[:]])

And error

File "ISS_LIS_FlashLoc_Quickview_Python3.py", line 154, in <module>
    main(file_path)
  File "ISS_LIS_FlashLoc_Quickview_Python3.py", line 97, in main
    daty=dater.strftime("%Y%m%d")
AttributeError: 'MaskedArray' object has no attribute 'strftime'

How i can solve it?

  • 1
    Does this answer your question? ["AttributeError: 'matrix' object has no attribute 'strftime'" error in numpy python](https://stackoverflow.com/questions/33055070/attributeerror-matrix-object-has-no-attribute-strftime-error-in-numpy-pyt) – R_Dax May 11 '21 at 11:16
  • @R_Dax thnx for answer, i saw it but i don't know, how i can convert maskedarray to time –  May 11 '21 at 11:25
  • @R_Dax i've tried this `dater=num2date(datafile.variables['lightning_flash_TAI93_time'][:], start_value_units.units) dater=datetime.datetime.strptime(dater, '%Y-%m-%d %H:%M:%S.%f') dater=dater.strftime("%m/%d/%Y") date = np.concatenate([date, dater[:]])` but error is still `TypeError: strptime() argument 1 must be str, not MaskedArray` –  May 11 '21 at 12:22
  • I personally am not 100% sure how to solve your specific problem, but just wanted to highlight another question on SO that might help. – R_Dax May 11 '21 at 15:04

0 Answers0