kayjan / bigtree

Tree Implementation and Methods for Python, integrated with list, dictionary, pandas and polars DataFrame.

Home Page:https://bigtree.readthedocs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Making `pandas` optional library

jzazo opened this issue · comments

I want to use this package in a library that I am building, but I would prefer not to depend on pandas. Would it be possible to make pandas an optional library? Thanks.

Hello, thanks for using bigtree!

One of the main features of bigtree is the integration with Python lists, dictionaries, and pandas DataFrames. Under the hood, the methods are dependent on each other, for example creating tree from dictionary (dict_to_tree) converts it to pandas Dataframe and performs dataframe_to_tree. You can view the dependency graph here. Given the interdependency between methods and the popularity of pandas, I would prefer to leave it as a required library.

If you want to install bigtree without pandas, I would suggest trying pip install --no-deps bigtree to ignore the dependencies.

I can see the dependency on pandas/numpy is pretty pervasive. Making this package an optionally pure-python package would make it even more powerful.

Aside from the methods for directly building pandas dataframes. how much of pandas / numpy is relied on for the core service?

I see, in the upcoming release (v0.8.4) I edited and used alternative methods to replace numpy. As for pandas, it is only used in constructing and exporting of trees, and only methods pd.DataFrame and pd.merge are used, which is quite minimal.

Hope this addresses your concern!

Would love the same, this library would be much easier to integrate without the fixed dependency on pandas.

Update: Pandas is now an optional library in v0.12.0!

Thanks for all your support and suggestions in making bigtree better 😄