[Python] NaTType does not support isocalendar (just on one particular machine)

Discussão em 'Python' iniciado por Stack, Junho 27, 2025.

  1. Stack

    Stack Membro Participativo

    I have a few pythons scripts that run fine, except on one laptop, where they throw this error NaTType does not support isocalendar. On other laptops they run fine, same version of Python & Pandas*, uninstalled and re-installed Python but still the same.

    *Correction: script runs fine on python 3.9.7 but not on 3.10

    Any suggestion what to look at next? Thanks!

    Here a snippet of one of the scripts that run fine on other machines, with the same underlying data:

    145 # create list of lists of values
    146 pm01_emea = [pm01_emea.columns.tolist()] + pm01_emea.values.tolist()
    147
    148 # write the headers and data starting in row 1 (index 0)
    149 row = 0
    150 for project in (pm01_emea):
    151 worksheet0.write_row(row, 0, project)
    152 row +=1


    Here the error it is throwing:

    Traceback (most recent call last):
    File "C:\GitHub\pm01\pm01.py", line 151, in <module>
    worksheet0.write_row(row, 0, project)
    File "C:\Users\username\AppData\Local\Programs\Python\Python310\lib\site-packages\xlsxwriter\worksheet.py", line 85, in
    cell_wrapper
    return method(self, *args, **kwargs)
    File "C:\Users\username\AppData\Local\Programs\Python\Python310\lib\site-packages\xlsxwriter\worksheet.py", line 1370, in write_row
    error = self._write(row, col, token, cell_format)
    File "C:\Users\username\AppData\Local\Programs\Python\Python310\lib\site-packages\xlsxwriter\worksheet.py", line 508, in _write
    return self._write_datetime(row, col, *args)
    File "C:\Users\username\AppData\Local\Programs\Python\Python310\lib\site-packages\xlsxwriter\worksheet.py", line 1019, in _write_datetime
    number = self._convert_date_time(date)
    File "C:\Users\username\AppData\Local\Programs\Python\Python310\lib\site-packages\xlsxwriter\worksheet.py", line 4320, in _convert_date_time
    return datetime_to_excel_datetime(dt_obj,
    File "C:\Users\username\AppData\Local\Programs\Python\Python310\lib\site-packages\xlsxwriter\utility.py", line 702, in datetime_to_excel_datetime
    and dt_obj.isocalendar() == (1900, 1, 1)):
    File "pandas\_libs\tslibs\nattype.pyx", line 75, in pandas._libs.tslibs.nattype._make_error_func.f
    ValueError: NaTType does not support isocalendar
    PS C:\GitHub\pm01>

    Continue reading...

Compartilhe esta Página