Skip to content

Commit

Permalink
Convert columns from set to list before creating pd.DataFrame()
Browse files Browse the repository at this point in the history
Closes Hoohm#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.
  • Loading branch information
dtenenba authored Jul 22, 2024
1 parent f276945 commit 22e9c44
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cite_seq_count/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')


Expand Down

0 comments on commit 22e9c44

Please sign in to comment.