Last active
December 8, 2017 13:46
-
-
Save BlogBlocks/bf0f63873041ab035edfb02f573d4eac to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/python | |
| %matplotlib inline | |
| import numpy as np | |
| import matplotlib.pyplot as plt | |
| # gives a base to x and y | |
| x=[] | |
| y=[] | |
| with open("Crimes_file.txt") as f: | |
| data = f.read() | |
| data = zip(*[iter(data.split(" "))]*2) | |
| #x, y =data[0],data[1] | |
| for a_tuple in data: # iterates through each tuple | |
| for item in a_tuple: | |
| item = float(item)# iterates through each tuple items | |
| #append x value with every read | |
| if item >0:x.append(item) | |
| #append y value with every read | |
| if item<0:y.append(item) | |
| #once all reading is comleted plot x,y | |
| plt.scatter(x,y) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment