Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hope to support pandas.DataFrame object #25

Open
zsz00 opened this issue Dec 16, 2021 · 6 comments
Open

Hope to support pandas.DataFrame object #25

zsz00 opened this issue Dec 16, 2021 · 6 comments
Labels
enhancement New feature or request

Comments

@zsz00
Copy link

zsz00 commented Dec 16, 2021

Hope to support pandas.DataFrame object read and save DataFrames as pandas.DataFrame...

@chengchingwen chengchingwen added the enhancement New feature or request label Dec 17, 2021
@chengchingwen
Copy link
Owner

To what extent do you need this feature? i.e. Do you need both reading and saving DataFrame? What set of element types would you need?

@zsz00
Copy link
Author

zsz00 commented Dec 17, 2021

i need read pd.DataFrame to DataFrames.DataFrame and write DataFrames.DataFrame to pd.DataFrame in julia.

most need read pd.DataFrame to DataFrames.DataFrame in julia.

@chengchingwen
Copy link
Owner

What kind of value would your dataframe contain? number / string / datetime?

@zsz00
Copy link
Author

zsz00 commented Dec 17, 2021

number / string /bool

@zsz00
Copy link
Author

zsz00 commented Dec 17, 2021

I found an easy way to do it:
https://cjdoris.github.io/PythonCall.jl/stable/compat/#PythonCall.pytable

using DataFrames, PythonCall
@py import pandas as pd

input_table = pd.read_pickle("/mnt/img_list_2.csv_2.pkl")   # read to julia obj: PyPandasDataFrame, compatible Tables.jl. 
jl_df = DataFrame(input_table)

py_df = pytable(jl_df)    # julia DataFrame to  pd.DataFrame
py_df.describe()
pd.to_pickle(py_df, "data.pkl")

@chengchingwen
Copy link
Owner

Yes, you can always use PyCall.jl or PythonCall.jl to call those python function directly. The purpose of this package (Pickle.jl) is to provide a pure Julia implementation so that we can avoid python dependencies.

@zsz00 zsz00 mentioned this issue Sep 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants