'How to load a pandas dataframe that is stored as pickle or feather (df.pkl or df.ftr) into sqldf
I have two files - df.pkl and df.ftr. And I am using run_qry = lambda q: sqldf(q, globals()) to run sql queries. So for example: I am creating a new DataFrame like new_dfr = run_qry("""select * from df""") but I need to load the df.pkl or df.ftr in run_qry(sqldf) to run this query.
Can you tell me, how to do load previously created DataFrame here?
Thanks in advance.
Solution 1:[1]
If I understand correctly, you are just trying to load dataframes from pickle and feather files?
If so I think you can use the pandas.read_pickle() and read_feather() methods:
import pandas as pd
df_pkl = pd.read_pickle(pickle_file_path)
df_ftr = pd.read_feather(feather_file_path)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Alex S |
