graphrag
graphrag copied to clipboard
Fix ValueError when setting DataFrame columns in cluster_graph
Description
Fixed ValueError when setting DataFrame columns in cluster_graph by correcting the assignment of exploded DataFrame columns to ensure column length matches keys. This was done by replacing direct DataFrame assignment with explicit column assignment using the columns parameter, and adding detailed handling for splitting (level, graph) pairs into separate columns.
Related Issues
Resolves: #724
Proposed Changes
- Corrected the assignment of exploded DataFrame columns to ensure column length matches keys.
- Replaced direct DataFrame assignment with explicit column assignment using the
columnsparameter. - Added detailed handling for splitting
(level, graph)pairs into separate columns. - Ensured the output DataFrame structure aligns correctly, preventing ValueError due to mismatched lengths.
Checklist
- [x] I have tested these changes locally.
- [x] I have reviewed the code changes.
- [ ] I have updated the documentation (if necessary).
- [ ] I have added appropriate unit tests (if applicable).
Additional Notes
N/A