Coverage for python/lsst/daf/butler/formatters/parquetFormatter.py : 96%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
# This file is part of daf_butler. # # Developed for the LSST Data Management System. # This product includes software developed by the LSST Project # (http://www.lsst.org). # See the COPYRIGHT file at the top-level directory of this distribution # for details of code ownership. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>.
Any, Dict, Iterable, Iterator, List, Optional, Tuple, Union, )
"""Helper class for loading Parquet files into `pandas.DataFrame` instances.
Parameters ---------- path : `str` Full path to the file to be loaded. """
if not name.startswith("__")) else:
"""Split a string that represents a multi-index column.
PyArrow maps Pandas' multi-index column names (which are tuples in Pythons) to flat strings on disk. This routine exists to reconstruct the original tuple.
Parameters ---------- n : `int` Number of levels in the `pd.MultiIndex` that is being reconstructed. names : `~collections.abc.Iterable` of `str` Strings to be split.
Yields ------ tuple : `tuple` of `str` A multi-index column name tuple. """
"""Transform a dictionary index into a multi-index column into a string directly understandable by PyArrow.
Parameters ---------- columns : `dict` Dictionary whose elements are string multi-index level names and whose values are the value or values (as a list) for that level.
Yields ------ name : `str` Stringified tuple representing a multi-index column name. """ raise ValueError(f"Cannot use dict with keys {set(columns.keys())} " f"to select columns from {self.indexLevelNames}.") for i, level in enumerate(self.indexLevelNames)] raise ValueError(f"Unrecognized value {value!r} for index {self.indexLevelNames[i]!r}.")
) -> pd.DataFrame: """Read some or all of the Parquet file into a `pandas.DataFrame` instance.
Parameters ---------- columns: : `dict`, `list`, or `str`, optional A description of the columns to be loaded. See :ref:`lsst.daf.butler-concrete_storage_classes_dataframe`.
Returns ------- df : `pandas.DataFrame` A Pandas DataFrame. """ else:
"""Write a `pandas.DataFrame` instance as a Parquet file. """
"""Interface for reading and writing Pandas DataFrames to and from Parquet files.
This formatter is for the :ref:`lsst.daf.butler-concrete_storage_classes_dataframe` StorageClass. """
# Docstring inherited from Formatter.read.
# Docstring inherited from Formatter.write.
"""Return a new `Location` instance updated with this formatter's extension. """
# Docstring inherited from Formatter.predictPathFromLocation. |