Guest User

works_lighttable

a guest
Sep 27th, 2014
294
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.03 KB | None | 0 0
  1.  
  2. """
  3. This is a test to see how good it all is!
  4.  
  5. """
  6.  
  7. import numpy as np
  8. import scipy as sp
  9. import pandas as pd
  10. from ggplot import *
  11.  
  12. def test_this(test):
  13.   print "test this %s " % test
  14.  
  15.  
  16. test_this("hello there!")
  17.  
  18.  
  19. x = np.linspace(0, 10, 30) # 30 points between 0 and 10 as an nparray
  20. y = np.sin(x)
  21. z = y + np.random.normal(size=30)*.2
  22. dataframe = pd.DataFrame([x,y,z]).T
  23. dataframe.columns = ['x','y','z']
  24. dataframe
  25. p = ggplot(aes(x='x', y ='y'), data=dataframe)
  26. p + geom_point(color='green') + geom_line(color='blue')
  27.  
  28. # <markdown>
  29. # This is a lab a obout interacting with webpages and xml (I think)
  30.  
  31. # <codecell>
  32.  
  33. import urllib2
  34. import bs4
  35. import json
  36. import datetime as dt
  37. import pandas as pd
  38. import numpy as np
  39. x = urllib2.urlopen("http://www.google.com")
  40. htmlSource = x.read()
  41. x.close()
  42. type(htmlSource)
  43. print htmlSource[:800]
  44.  
  45. x = urllib2.urlopen("http://www.reddit.com")
  46. htmlSource = x.read()
  47. x.close()
  48. print htmlSource[:500]
  49.  
  50. soup = bs4.BeautifulSoup(htmlSource)
  51. print type(soup.prettify())
Advertisement
Add Comment
Please, Sign In to add comment