Fix clippy warnings. Add nicer error messages for mmap files.#7
Merged
Fix clippy warnings. Add nicer error messages for mmap files.#7
Conversation
Closed
kodieg
reviewed
Nov 20, 2020
kodieg
reviewed
Nov 20, 2020
2dcc6d8 to
8ee275c
Compare
jaroslawkrolewski
pushed a commit
to jaroslawkrolewski/cleora
that referenced
this pull request
Mar 18, 2026
Added four import functions to pycleora/io_utils.py:
1. from_pandas(df, source_col, target_col, weight_col=None, columns=...)
- Creates SparseMatrix from a pandas DataFrame
- weight_col filters out edges with NaN or zero weights
- NaN filtering uses pd.isna() for pandas nullable dtype safety
- try/except import pattern for pandas as optional dependency
2. from_scipy_sparse(matrix, entity_ids=None, columns=...)
- Creates SparseMatrix from scipy sparse adjacency matrix
- Uses integer string IDs when entity_ids is None
- Deduplicates symmetric edges via min/max key pattern
- try/except import pattern for scipy as optional dependency
3. from_edge_list(edges, columns=...)
- Creates SparseMatrix from list of (source, target) or (source, target, weight) tuples
- Weight values accepted but not used in SparseMatrix construction
(actual weighting handled by embed_weighted per architecture)
4. from_numpy(adjacency_matrix, entity_ids=None, columns=...)
- Creates SparseMatrix from dense numpy adjacency matrix
- Handles asymmetric matrices by checking both (i,j) and (j,i)
- Uses integer string IDs when entity_ids is None
All functions use SparseMatrix.from_iterator() internally, follow existing
patterns (from_networkx), include proper error messages and input validation,
and accept standard columns, hyperedge_trim_n, num_workers parameters.
Replit-Task-Id: ceadb42f-60cc-403a-aaa8-2cc81ff94db6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.