In [1]:
#2019-03-19 16:41:35.967941
%load_ext metapack.jupyter.magic

In [2]:
CACHE_DIR='/Users/eric/Library/Application Support/metapack/'
RESOURCE_NAME='df'
RESOLVED_URL='file:///Users/eric/proj/virt-proj/data-project/metatab-packages/example.com/example-ipynb/metadata.ipynb#df'
WORKING_DIR='/Users/eric/proj/virt-proj/data-project/metatab-packages/example.com/example-ipynb'
METATAB_DOC='metapack+file:///Users/eric/proj/virt-proj/data-project/metatab-packages/example.com/example-ipynb/metadata.ipynb'
METATAB_WORKING_DIR='/Users/eric/proj/virt-proj/data-project/metatab-packages/example.com/example-ipynb'
METATAB_PACKAGE='metapack+file:///Users/eric/proj/virt-proj/data-project/metatab-packages/example.com/example-ipynb/'
url='metadata.ipynb#df'
name='df'
description='Random UUIDs, integers and numbers'

In [3]:
METAPACK_BUILDING=True

A Metatab Example Data Package

An example data package, from the Metatab tutorial at https://github.com/CivicKnowledge/metatab-py/blob/master/README.rst

Name: example_data_package-2017-us-2 Dataset: example-data-package Version: 2 Space: US Time: 2017 Spatialgrain: None Giturl: https://github.com/Metatab/metatab-packages.git Identifier: e7466d89-9156-4df6-a171-3102b04ae583 Section: Documentation|Title|Description Homepage: http://metatab.org .Title: Metatab Home Page .Description: Main Metatab home page Documentation: https://github.com/CivicKnowledge/metatab-py/blob/master/README.rst .Title: Metatab Python Package README .Description: The README in the Metatab Githup repo contains the tutorial for generating this package. Section: Contacts|email Origin: example.com Creator: Eric Busboom .Email: eric@civicknowledge. com Wrangler: Eric Busboom .Email: eric@civicknowledge. com Section: Notes Note: None
Section: Resources|Name|StartLine|HeaderLines|Encoding|Description Datafile: http://public.source.civicknowledge.com/example.com/sources/test_data.zip#test_data%2Fcsv%2Fsimple-example.csv .Name: simple-example .Description: Random UUIDs, integers and numbers Datafile: metadata.ipynb#df .Name: df .Description: Random UUIDs, integers and numbers

In [4]:
import seaborn as sns
import metapack as mp
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from IPython.display import display 

%matplotlib inline
%load_ext metapack.jupyter.magic
sns.set_context('notebook')
mp.jupyter.init()


The metapack.jupyter.magic extension is already loaded. To reload it, use:
  %reload_ext metapack.jupyter.magic

In [5]:
# Code goes after metadata, before schema

df = pd.DataFrame({
    'rand': np.random.randint(0,100,1000)
})
Section: Schema|AltName|DataType|Description|Datatype Table: simple-example Table.Column: id .Datatype: integer Table.Column: uuid .Datatype: string Table.Column: int .Datatype: integer Table.Column: float .Datatype: number Table: df Table.Column: rand .Datatype: integer

In [6]:
%mt_materialize df '/Users/eric/Library/Application Support/metapack/_materialized_data/example_data_package-2017-us-2'


{
    "df_name": "df",
    "path": "/Users/eric/Library/Application Support/metapack/_materialized_data/example_data_package-2017-us-2/df.csv"
}

In [7]:
%mt_materialize_all '/Users/eric/Library/Application Support/metapack/_materialized_data/example_data_package-2017-us-2'


[]

In [8]:
%mt_show_metatab


Declare: metatab-latest
Section: Resources|Name|Title|Description|StartLine|HeaderLines|Encoding

In [9]:
%mt_show_libdirs


[]