Skip to content

Getting Started

MetaFrames gives you full control of your complex DataFrame MultiIndex in a very accesible way. Complex filters become easy, both with the API and in Excel!

Features Highlights

  • I/O for complex DataFrames: practical Excel/Text exports and automatic reading.
  • MultiIndex positional/label-indexer: selection and assignment identical to a DataFrame.
  • Semantic selections: human-readable selections for complex filters, regex-compatible.
  • Customisable summaries: extract important informations with enxtensive summaries.

Installation

git clone https://gitlab.com/dwishsan/metaframe.git
cd metaframe
pip install .

or

pip install pandas-metaframe

Your first MetaFrame

import metaframe as mf # or `import metaframe as pd`

# Convert any pandas DataFrame to metaframe DataFrame:
# df = mf.DataFrame(<pandas_DataFrame>)

# Or use pre-build metaframe.DataFrame objects
from metaframe.testing import df

print(df)

# DataFrame view of the index
print(df.mfr)

# DataFrame view of the columns
print(df.mfc)

# Have a look at the Excel export!
## You can play with MFR/MFC filters
df.to_file('metaframe_dataframe.xlsx')

# Selecter
## Query
print(df.q['integers == mixed_numeric'])
## Get-string
print(df.gs["mixed_types:'.*1$'"])
## MetaFrame label indexer
print(df.mfloc[["integers", "bool"], "strings"])
## MetaFrame positional indexer
print(df.mfiloc[[0, 1], 0])

# Summaries
dfs = df.to_summary()
dfs.basic()
dfs.whole()
dfs.row()
dfs.col()

# Utilities
print(df.auto_sort())