And this is the description
In [1]:
print ("Here is some text")
In [2]:
x = 10
x
Out[2]:
In [3]:
%load_ext metatab
%matplotlib inline
%mt_lib_dir lib
import pandas as pd
from os.path import exists
from os import remove
In [4]:
%%metatab -p .
Origin: example.com
Dataset: foobar.com
Identifier: de097279-28ef-42f5-a4f5-0eaac53b7dc4
Name: example.com-foobar.com
In [5]:
assert _notebook_dir.endswith('metatab-py/test-data/notebooks'), _notebook_dir
assert _package_dir.endswith('metatab-py/test-data/notebooks'), _package_dir
In [6]:
_notebook_dir
Out[6]:
In [7]:
%%metatab -p /tmp/foo
Origin: example.com
Dataset: foobar.com
Identifier: de097279-28ef-42f5-a4f5-0eaac53b7dc4
Name: example.com-foobar.com
In [8]:
assert _notebook_dir.endswith('metatab-py/test-data/notebooks')
assert _package_dir.endswith('/tmp/foo')
In [9]:
%%metatab
Origin: example.com
Dataset: foobar.com
Identifier: de097279-28ef-42f5-a4f5-0eaac53b7dc4
Name: example.com-foobar.com
Section: Contacts
Wrangler: Eric Busboom
Wrangler.Email: eric@civicknowledge.com
Section: References
Reference: http://public.source.civicknowledge.com/example.com/sources/renter_cost.csv
Reference.Name: reference
Reference.Title: The First Example Data File
Reference.Startline: 5
Reference.HeaderLines: 3,4
Section: Resources
Datafile: http://public.source.civicknowledge.com/example.com/sources/renter_cost.csv
Datafile.Name: ext_resource
Datafile.Title: An Extern CSV Resource
Datafile.Startline: 5
Datafile.HeaderLines: 3,4
In [10]:
assert _notebook_dir.endswith('metatab-py/test-data/notebooks')
assert _package_dir.endswith('metatab-py/test-data/notebooks/example.com-foobar.com')
In [11]:
from metatab.pands import MetatabDataFrame
odf = MetatabDataFrame({ 'cola':range(10), 'colb': range(10)})
odf.name = 'income_homeval'
odf.title = 'Income and Home Value Records for San Diego County'
odf.cola.description = 'Household income'
odf.colb.description = 'Home value'
%mt_add_dataframe odf --materialize
cols = list(mt_pkg.resource('income_homeval').columns())
assert 'cola' in [ c['name'] for c in cols]
assert 'colb' in [ c['name'] for c in cols]
In [12]:
%%bash
echo "This is a Bash cell"
touch /tmp/footouched
In [13]:
assert exists('/tmp/footouched')
remove('/tmp/footouched')
assert not exists('/tmp/footouched')
In [14]:
!ls
In [15]:
import matplotlib.pyplot as plt
import numpy as np
t = np.arange(0.0, 2.0, 0.01)
s = 1 + np.sin(2*np.pi*t)
plt.plot(t, s)
plt.xlabel('time (s)')
plt.ylabel('voltage (mV)')
plt.title('About as simple as it gets, folks')
plt.grid(True)
plt.show()
In [16]:
!pwd
In [ ]: