Advertisement
Guest User

Untitled

a guest
Jan 18th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. import numpy as np
  2. import matplotlib.pyplot as plt
  3. import sqlite3
  4. from sqlite3 import Error
  5.  
  6.  
  7. def create_con(db_name):
  8. try:
  9. cursor = sqlite3.connect(db_name)
  10. except Error as e:
  11. print(e)
  12.  
  13.  
  14. def grab_data(connection):
  15. cursor = connection.cursor()
  16. cursor.execute("SELECT * FROM Country")
  17. data = {}
  18.  
  19. rows = cursor.fetchall()
  20.  
  21. for ind, row in rows:
  22. data[ind] = row
  23. return data
  24.  
  25.  
  26. x = ['France', 'Iran', 'Russia', 'Japan', 'China', 'USA']
  27. y = [503, 32, 34223, 2343, 23, 211]
  28.  
  29. plt.ticklabel_format(style='sci', axis='y', scilimits=(0, 0))
  30. plt.bar(x, y)
  31. plt.ylabel('Hackers Value')
  32. plt.xlabel('Country')
  33. plt.title('Top 25 Countries for Hackers')
  34. plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement