scanpy.write#
- scanpy.write(filename, adata, *, ext=None, convert_strings_to_categoricals=True, compression='gzip', compression_opts=None)[source]#
Write
AnnData
objects to file.- Parameters:
- filename
PathLike
[str
] |str
If the filename has no file extension, it is interpreted as a key for generating a filename via
sc.settings.writedir / (filename + sc.settings.file_format_data)
. This is the same behavior as inread()
.- adata
AnnData
Annotated data matrix.
- ext
Union
[Literal
['h5ad'
,'zarr'
],Literal
['csv'
],None
] (default:None
) File extension from which to infer file format. If
None
, defaults tosc.settings.file_format_data
.- convert_strings_to_categoricals
bool
(default:True
) If anndata supports it, setting this to
False
will avoid converting string columns to categorical arrays when writing.- compression
Optional
[Literal
['gzip'
,'lzf'
]] (default:'gzip'
) - compression_opts
int
|None
(default:None
)
- filename
- Return type: