Commits

Miki Tebeka  committed dde0ad5

generate REAME.md

  • Participants
  • Parent commits c5fe31a

Comments (0)

Files changed (3)

File README

-Place for everything Pandas.
+
+Place for everything Pandas.
+
+Lessons
+-------
+
+* [04 - Lesson](http://nbviewer.ipython.org/urls/bitbucket.org/hrojas/learn-pandas/raw/master/lessons/lessons/04%20-%20Lesson.ipynb)
+* [09 - Lesson](http://nbviewer.ipython.org/urls/bitbucket.org/hrojas/learn-pandas/raw/master/lessons/lessons/09%20-%20Lesson.ipynb)
+* [07 - Lesson](http://nbviewer.ipython.org/urls/bitbucket.org/hrojas/learn-pandas/raw/master/lessons/lessons/07%20-%20Lesson.ipynb)
+* [06 - Lesson](http://nbviewer.ipython.org/urls/bitbucket.org/hrojas/learn-pandas/raw/master/lessons/lessons/06%20-%20Lesson.ipynb)
+* [10 - Lesson](http://nbviewer.ipython.org/urls/bitbucket.org/hrojas/learn-pandas/raw/master/lessons/lessons/10%20-%20Lesson.ipynb)
+* [Lesson 2 V2](http://nbviewer.ipython.org/urls/bitbucket.org/hrojas/learn-pandas/raw/master/lessons/lessons/02%20-%20Lesson.ipynb)
+* [Lesson 1 V2](http://nbviewer.ipython.org/urls/bitbucket.org/hrojas/learn-pandas/raw/master/lessons/lessons/01%20-%20Lesson.ipynb)
+* [11 - Lesson](http://nbviewer.ipython.org/urls/bitbucket.org/hrojas/learn-pandas/raw/master/lessons/lessons/11%20-%20Lesson.ipynb)
+* [08 - Lesson](http://nbviewer.ipython.org/urls/bitbucket.org/hrojas/learn-pandas/raw/master/lessons/lessons/08%20-%20Lesson.ipynb)
+* [05 - Lesson](http://nbviewer.ipython.org/urls/bitbucket.org/hrojas/learn-pandas/raw/master/lessons/lessons/05%20-%20Lesson.ipynb)
+* [03 - Lesson](http://nbviewer.ipython.org/urls/bitbucket.org/hrojas/learn-pandas/raw/master/lessons/lessons/03%20-%20Lesson.ipynb)

File gen-readme.py

+#!/usr/bin/env python
+
+from sys import version_info
+
+if version_info[0] < 3:
+    from urllib import quote
+else:
+    from urllib.request import quote
+
+
+from glob import glob
+import json
+
+header = '''
+Place for everything Pandas.
+
+Lessons
+-------
+'''
+
+
+
+format_item = '* [{name}]({url})'.format
+bb_url = 'bitbucket.org/hrojas/learn-pandas/raw/master/lessons/{}'.format
+
+
+def notebooks():
+    return glob('lessons/*Lesson.ipynb')
+
+
+def lesson_name(filename):
+    with open(filename) as fo:
+        return json.load(fo)['metadata']['name']
+
+
+def nb_url(filename):
+    raw_url = bb_url(quote(filename))
+    return 'http://nbviewer.ipython.org/urls/{}'.format(raw_url)
+
+
+def write_readme(nblist, fo):
+    fo.write('{}\n'.format(header))
+    for nb in nblist:
+        name = lesson_name(nb)
+        url = nb_url(nb)
+        fo.write('{}\n'.format(format_item(name=name, url=url)))
+
+
+def main():
+    nblist = notebooks()
+    with open('README.md', 'w') as fo:
+        write_readme(nblist, fo)
+
+
+if __name__ == '__main__':
+    main()
+
+