copy#

SingleCell.copy(*, deep=False, num_threads=None)[source]#

Make a copy of this SingleCell dataset.

Parameters:
  • deep: bool

    whether to perform a deep or shallow copy. Since polars DataFrames are immutable, obs and var will always point to the same underlying data as the original. The difference when deep=True is that X and any NumPy arrays in obsm, varm, obsp, varp, and uns will point to fresh copies of the underlying data, instead of the same data as the original SingleCell dataset. When deep=False, any modifications to these NumPy arrays will modify both copies!

  • num_threads: int | None

    the number of threads to use when making a deep copy of X. Set num_threads=-1 to use all available cores, as determined by os.cpu_count(). By default (num_threads=None), use self.num_threads cores. Does not affect the copied SingleCell dataset’s num_threads; this will always be the same as the original dataset’s num_threads. Can only be specified when deep=True and X is not None.

Returns:

A copy of the SingleCell dataset.

Return type:

SingleCell