From 22e9c448ff07849b58e356e69f9f53283942aa05 Mon Sep 17 00:00:00 2001 From: Dan Tenenbaum Date: Mon, 22 Jul 2024 15:56:33 -0700 Subject: [PATCH] Convert `columns` from set to list before creating pd.DataFrame() Closes #192 Pandas' DataFrame() constructor used to accept a `set` as its `columns` argument, but no longer does. This simply converts the `set` to a `list` before creating the data frame. There may be better approaches to deal with this issue, but I'm not familiar enough with this package to know about them. --- cite_seq_count/io.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cite_seq_count/io.py b/cite_seq_count/io.py index 2dc04f0..3102d49 100644 --- a/cite_seq_count/io.py +++ b/cite_seq_count/io.py @@ -45,7 +45,7 @@ def write_dense(sparse_matrix, index, columns, outfolder, filename): """ prefix = os.path.join(outfolder) os.makedirs(prefix, exist_ok=True) - pandas_dense = pd.DataFrame(sparse_matrix.todense(), columns=columns, index=index) + pandas_dense = pd.DataFrame(sparse_matrix.todense(), columns=list(columns), index=index) pandas_dense.to_csv(os.path.join(outfolder,filename), sep='\t')