AiiDA data plugin for pandas DataFrame objects
-
Store
pandas.DataFrame
objects in the Database:import pandas as pd PandasFrameData = DataFactory('dataframe.frame') df = pd.DataFrame( { "A": 1.0, "B": pd.Timestamp("20130102"), "C": pd.Series(1, index=list(range(4)), dtype="float32"), "D": np.array([3] * 4, dtype="int32"), "E": pd.Categorical(["test", "train", "test", "train"]), "F": "foo", } ) df_node = PandasFrameData(df) df_node.store()
-
Retrieving the
pandas.DataFrame
from the Database :from aiida.orm import QueryBuilder df_node = QueryBuilder().append(PandasFrameData).first()[0] df = df_node.df #The df property reconstructs the pandas DataFrame print(df.head())
pip install aiida-dataframe
verdi quicksetup # better to set up a new profile
verdi plugin list aiida.data # should now show your data plugins
The plugin also includes verdi commands to inspect its data types:
verdi data dataframe list
verdi data dataframe export <PK>
verdi data dataframe show <PK>
git clone https://github.com/janssenhenning/aiida-dataframe .
cd aiida-dataframe
pip install --upgrade pip
pip install -e .[pre-commit,testing] # install extra dependencies
pre-commit install # install pre-commit hooks
pytest -v # discover and run all tests
See the developer guide for more information.
MIT