diff --git a/python/lsst/daf/butler/formatters/parquet.py b/python/lsst/daf/butler/formatters/parquet.py index 5c9c952bf4..6e8937a019 100644 --- a/python/lsst/daf/butler/formatters/parquet.py +++ b/python/lsst/daf/butler/formatters/parquet.py @@ -1098,7 +1098,8 @@ def _arrow_string_to_numpy_dtype( # String/bytes length from header. strlen = int(schema.metadata[encoded]) elif numpy_column is not None and len(numpy_column) > 0: - strlen = max([len(row) for row in numpy_column if row]) + lengths = [len(row) for row in numpy_column if row] + strlen = max(lengths) if lengths else 0 dtype = f"U{strlen}" if schema.field(name).type == pa.string() else f"|S{strlen}"