Day 2 [Learning IPyNB]

December 29, 2014

The experience is awesome. I am working on my own data using my Mac Book [OS: Yosemite]. Few info.:

  • Using Anaconda Launcher [easier to get all packages in the same place)
  • I am using Python 2.7.9-1 [later I downloaded Python 3.4.2; anaconda is also attached; but not the packages; so I am running Anconda in keeping root as Py 2.7.9-1]
  • Using the gallery to learn the basic.
  • I make a playist in youtube on Ipython tutorials.
  • I am a hardcore R fan. Now I am fully soaked in IPython NB.
In [25]:
%%script python
import sys
print 'hello from Python %s' % sys.version
hello from Python 2.7.9 |Anaconda 2.1.0 (x86_64)| (default, Dec 15 2014, 10:37:34) 
[GCC 4.2.1 (Apple Inc. build 5577)]
In [26]:
%%ruby
puts "Hello from Ruby #{RUBY_VERSION}"
Hello from Ruby 2.0.0
In [27]:
%%bash
echo "hello from $BASH"
hello from /bin/bash
In [6]:
ls
Image_nb.ipynb  a1.csv          a2.JPG          a3.JPG
a1.JPG          a1.dat*         a2.csv
In [28]:
%%ruby --bg --out ruby_lines
for n in 1...10
    sleep 1
    puts "line #{n}"
    STDOUT.flush
end
Starting job # 0 in a separate thread.
In [29]:
ruby_lines
Out[29]:
<open file '<fdopen>', mode 'rb' at 0x10cb618a0>
In [30]:
print(ruby_lines.read())
line 1
line 2
line 3
line 4
line 5
line 6
line 7
line 8
line 9

I am mainly replicating the codes to do my own stuff from here.

In [7]:
from IPython.display import display
from IPython.display import display_pretty, display_html, display_jpeg, display_png, display_json, display_latex, display_svg
from IPython.display import Image
In [8]:
from IPython.display import HTML
HTML('<iframe src=http://subasish.tumblr.com width=700 height=350></iframe>')
Out[8]:
In [11]:
i = Image(filename='a2.jpg', width= 500, height= 400)
i
Out[11]: