Find answers from the community

Updated 4 months ago

Pd

At a glance
When using PandasQueryEngine, does anyone know how it can use the pd (pandas) library? I'm trying to get it to generate queries using pd.to_numeric but PandasQueryEngine errors out saying that it doesn't have access to that library.

If this isn't possible, i'm potentially just considering spinning up an ad-hoc sandbox environment and using the Pandas library there directly. Would love to have the convenience of just using PandasQueryEngine directly though.
L
k
8 comments
It should be there actually, but it might have been recently added (you might have to upgrade)
(Note that in a few days, I'm putting out an update to move pandas query engine into llama-index-experimental -- it allows for arbitrary code execution, and tbh the security issues on the package are a pain lol)
ah perfect, updating to latest (was a couple versions behind) was successful, and thank you for the heads up i'll keep that in mind!
@Logan M Sorry to bother you, but while I have you - what's the best way to store IndexNodes? I understand that we can store TextNodes in DocStores, but do we store IndexNodes in IndexStores?

My use-case is that I need to persist both TextNodes and IndexNodes for consistent use in multiple/different sessions. The IndexNodes should keep its PandaQueryEngine mappings intact. Currently using MongoDB for docstore, and could use the same for IndexNodes if it is indeed stored via the IndexStore, but the confusion is how do i retrieve them? For TextNodes i would just call docstore.docs.values(), but how do i store/retrieve IndexNodes with its QueryEngine mapping etc?
index nodes can also go into a docstore, a docstore just holds BaseNode objects, which both TextNode and IndexNode extend from
@Logan M I see, and how and where would the dict mapping for index_id to QueryEngine be stored?
That would have to be maintained externally (generate it on app startup? Pickle it? To/from dataframe -> json?)

Actually if you convert it to json, it could be in the node metadata lol
I see, makes sense, I think I have enough information to work around the problem, much appreciated for your help!
Add a reply
Sign up and join the conversation on Discord