bito-code-review[bot] commented on PR #43694:
URL: https://github.com/apache/superset/pull/43694#issuecomment-5469989633

   <!-- Bito Reply -->
   The flagged issue is correct. Filling a datetime index with a string like 
`<NULL>` will cause a `TypeError` because pandas datetime dtypes cannot hold 
string values. To resolve this, you should check the dtype of the index column 
before filling it. If the column is a datetime type, you should either leave 
the `NaT` values as they are or convert the column to an object type before 
filling it with the string.
   
   **superset/utils/pandas_postprocessing/pivot.py**
   ```
   for col in index:
           if (
               isinstance(df[col].dtype, pd.CategoricalDtype)
               and NULL_STRING not in df[col].cat.categories
           ):
               df[col] = df[col].cat.add_categories([NULL_STRING])
           elif pd.api.types.is_datetime64_any_dtype(df[col].dtype):
               continue
           df[col] = df[col].fillna(value=NULL_STRING)
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to