sainsc.GridCounts.from_dataframe
- classmethod sainsc.GridCounts.from_dataframe(df, *, resolution=None, binsize=None, n_threads=None)
Initialize from dataframe.
Transform a
polars.DataFramethat provides a ‘gene’, ‘x’, and ‘y’ column intosainsc.GridCounts. If a ‘count’ column exists it will be used as counts else a count of 1 (single molecule) per row will be assumed.- Parameters:
df (polars.DataFrame) – The data to be transformed.
binsize (float or None, optional) – The size to bin the coordinates by. If None coordinates must be integers.
resolution (float, optional) – Resolution of each coordinate unit in nm. The default is 1,000 i.e. measurements are in um.
n_threads (int, optional) – Number of threads used for initializing
sainsc.LazyKDE. If None this will default to the number of logical CPUs.
- Return type: