This PR fixes https://github.com/daler/pybedtools/issues/376 and support for polars dataframes. Users can now convert a BedTool object to a polars dataframe using the to_polars_dataframe method, and create a BedTool object from a polars dataframe using the from_polars_dataframe method. The functions follow the style of the to_dataframe and from_dataframe functions with required modifications for polars syntax.
I have also added docs for the functionality to export to/import from pandas/polars dataframes. I have not worked with reStructuredText before so it might have some visual glitches.
I have also added some tests for both functions in the test_from_polars_dataframe function in test_1.py.
Hi @daler , please let me know if you have any thoughts on this - I think it would be useful to have this functionality for pybedtools. Happy to make changes as needed. :)
This PR fixes https://github.com/daler/pybedtools/issues/376 and support for polars dataframes. Users can now convert a
BedTool
object to a polars dataframe using theto_polars_dataframe
method, and create aBedTool
object from a polars dataframe using thefrom_polars_dataframe
method. The functions follow the style of theto_dataframe
andfrom_dataframe
functions with required modifications for polars syntax.I have also added docs for the functionality to export to/import from pandas/polars dataframes. I have not worked with reStructuredText before so it might have some visual glitches.
I have also added some tests for both functions in the
test_from_polars_dataframe
function intest_1.py
.Let me know what you think!