In [2]:
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
import pandas as pd
from pymongo import MongoClient
from geopy.geocoders import Nominatim

locate = Nominatim()
client = MongoClient()
db = client.twitterCleanDb
tweetCollection = db.tenKtweetsCleaned

times = []
polarities = []
subjectivities = []
locations = []
locationPolarities = []
lats = []
longs = []
modiTweets = tweetCollection.find({'cleantest' :{'$regex': '.*a*.'}})
for tweet in modiTweets:
    times.append(tweet['created_at'])
    polarities.append(tweet['polarity'])
    subjectivities.append(tweet['subjectivity'])
    
    latlong = locate.geocode(tweet['user']['location'], timeout = 10)
    if latlong is None:
        latlong = locate.geocode(tweet['user']['time_zone'], timeout = 10)
        if latlong is None:
            print('appended')
        else:
            locations.append([latlong.latitude, latlong.longitude])
            print('appended 1', latlong, latlong.latitude, latlong.longitude)
            locationPolarities.append(tweet['polarity'])
    else:
        locations.append([latlong.latitude, latlong.longitude])
        print('appended 2', latlong, latlong.latitude, latlong.longitude)
        locationPolarities.append(tweet['polarity'])
    
appended 2 Nederland 52.2379891 5.53460738161551
appended 2 Harris County, Texas, 77449, United States of America 29.8207822747903 -95.7366129151
appended 2 Tarpon Springs, Pinellas County, Florida, 34689, United States of America 28.1477885 -82.7774086726313
appended 1 None, TO, PIE, Italia 44.933143 7.540121
appended 2 London, Greater London, England, SW1A 2DU, UK 51.5073219 -0.1276474
appended 2 Mabunda, Município de Luanda, Luanda, 64346, Angola -8.8483112 13.2076618
appended 2 Santa Marta, Magdalena, Colombia 11.0869172 -73.8806606343634
appended 2 Kalamazoo, Kalamazoo County, Michigan, United States of America 42.291707 -85.5872286
appended 1 None, TO, PIE, Italia 44.933143 7.540121
appended 2 United States of America 39.7837304 -100.4458825
appended 2 नेपाल 28.1083929 84.0917139
appended 2 Nigeria 9.6000359 7.9999721
appended 1 None, TO, PIE, Italia 44.933143 7.540121
appended 1 None, TO, PIE, Italia 44.933143 7.540121
appended 1 London, Greater London, England, SW1A 2DU, UK 51.5073219 -0.1276474
appended 2 Niort, Deux-Sèvres, Nouvelle-Aquitaine, France métropolitaine, 79000, France 46.3239455 -0.4645212
appended 1 None, TO, PIE, Italia 44.933143 7.540121
appended 1 None, TO, PIE, Italia 44.933143 7.540121
appended 2 Campana, CS, CAL, Italia 39.4124481 16.8225645
appended 1 Time, King Street West, University District, Kingston, Ontario, K7L2V3, Canada 44.2222023 -76.4986098
appended 1 Time, King Street West, University District, Kingston, Ontario, K7L2V3, Canada 44.2222023 -76.4986098
appended 2 Maryland, United States of America 39.5162234 -76.9382069
appended 1 None, TO, PIE, Italia 44.933143 7.540121
appended 2 Moon, Marathon County, Wisconsin, United States of America 44.7716333 -89.787902
appended 2 Helsingborg, Skåne, Götaland, 252 68, Sverige 56.0441984 12.7040684
appended 1 None, TO, PIE, Italia 44.933143 7.540121
appended 1 None, TO, PIE, Italia 44.933143 7.540121
appended 2 United States of America 39.7837304 -100.4458825
appended 2 General Luna, Surigao Del Norte, Caraga, 8419, Philippines 9.80067315 126.118702106101
appended 2 Annapolis, Anne Arundel County, Maryland, United States of America 38.9786401 -76.492786
appended 2 Marseille, Bouches-du-Rhône, Provence-Alpes-Côte d'Azur, France métropolitaine, 13000, France 43.2961743 5.3699525
appended 2 Brazil, Clay County, Indiana, 47834, United States of America 39.523652 -87.1250154
appended 2 Tallahassee, Leon County, Florida, United States of America 30.4380832 -84.2809332
appended 1 None, TO, PIE, Italia 44.933143 7.540121
appended 2 Winchester, Winchester City, Virginia, United States of America 39.1852184 -78.1652404
appended 2 KL, Malaysia 3.1546872 101.7136362
appended 1 None, TO, PIE, Italia 44.933143 7.540121
appended 2 Lafayette, Lafayette Parish, Louisiana, United States of America 30.2240897 -92.0198427
appended 1 None, TO, PIE, Italia 44.933143 7.540121
appended 2 Estados Unidos, Becerril, Cesar, Colombia 9.624388 -73.2125095
appended 2 Rachel, Lincoln County, Nevada, 89001, United States of America 37.6413209 -115.748361
appended 1 None, TO, PIE, Italia 44.933143 7.540121
appended 2 Wales, UK 52.2928116 -3.73893
appended 1 None, TO, PIE, Italia 44.933143 7.540121
appended 2 Ctes., Argentina -28.5912315 -57.9394658
appended 1 None, TO, PIE, Italia 44.933143 7.540121
appended 2 서울특별시, 대한민국 37.5666791 126.9782914
appended 2 Michigan, United States of America 43.6211955 -84.6824346
appended 2 Listening, 600, 5th Avenue, West Edge, International District/Chinatown, Seattle, King County, Washington, 98104, United States of America 47.6041834 -122.3292397
appended 2 اليمن 16.3471243 47.8915271
appended 1 None, TO, PIE, Italia 44.933143 7.540121
appended 2 La Camila, Departamento San Martín, SDE, G4322, Argentina -28.1652832 -63.64468
appended 2 Braga, Cávado, Norte, 4700-435, Portugal 41.5510583 -8.4280045
appended 2 Chapel Hill, Orange County, North Carolina, United States of America 35.9131542 -79.05578
appended 2 Miami, Miami-Dade County, Florida, United States of America 25.7742658 -80.1936589
appended 1 None, TO, PIE, Italia 44.933143 7.540121
appended 2 Westfield, Hamilton County, Indiana, United States of America 40.0428151 -86.1274888
appended 1 None, TO, PIE, Italia 44.933143 7.540121
appended 2 Corpus Christi, Nueces County, Texas, United States of America 27.8002542 -97.3955744
appended 2 Waukesha, Waukesha County, Wisconsin, United States of America 43.0116784 -88.2314813
appended 1 None, TO, PIE, Italia 44.933143 7.540121
appended 1 None, TO, PIE, Italia 44.933143 7.540121
appended 2 Minha casa, 1480, Rua Tamoio, Niterói, Sede, Canoas, Microrregião de Porto Alegre, Região Metropolitana de Porto Alegre, Mesorregião Metropolitana de Porto Alegre, RS, Região Sul, 92120-001, Brasil -29.9476433 -51.1695867
appended 2 Glasgow, Glasgow City, Scotland, G, UK 55.856656 -4.2435817
appended 2 Deutschland, Europe 51.0834196 10.4234469
appended 2 Manchester, Greater Manchester, North West England, England, UK 53.4791301 -2.2441009
appended 1 None, TO, PIE, Italia 44.933143 7.540121
appended 1 None, TO, PIE, Italia 44.933143 7.540121
appended 1 None, TO, PIE, Italia 44.933143 7.540121
appended 2 Greenville, Greenville County, South Carolina, United States of America 34.851354 -82.3984882
appended 2 Tucumán, San Miguel de Tucumán, Departamento Capital, TU, T4000, Argentina -26.8303703 -65.2038133
appended 2 Wisconsin, United States of America 44.4308975 -89.6884637
appended 2 NYC, New York, United States of America 40.7306458 -73.9866136
appended 1 None, TO, PIE, Italia 44.933143 7.540121
appended 2 Ghana 8.0300284 -1.0800271
appended 1 None, TO, PIE, Italia 44.933143 7.540121
appended 1 None, TO, PIE, Italia 44.933143 7.540121
appended 2 St. Petersburg, FL, 2nd Avenue North, Methodist Town, St. Petersburg, Pinellas County, Florida, 33701, United States of America 27.77330515 -82.6469934
appended 2 El Paso City, El Paso County, Texas, United States of America 31.8111305 -106.501349395577
appended 1 None, TO, PIE, Italia 44.933143 7.540121
appended
appended 2 ‏پاکستان‎ 30.3308401 71.247499
appended 2 Wilson, Wilson County, North Carolina, 27893, United States of America 35.7212689 -77.9155395
appended
appended 2 England, UK 52.7954791 -0.540240286617432
appended 2 Perth, Padbury Walk, Northbridge, Perth, Western Australia, 6005, Australia -31.9513659 115.860389528787
appended 1 Arizona, United States of America 34.395342 -111.7632755
appended 2 European Union, Ananda Coomaraswami Mawatha, Cinnamon Gardens, Colombo, කොළඹ දිස්ත්‍රික්කය, Western Province, 0007, ශ්‍රී ලංකාව இலங்கை 6.9116138 79.8578631
appended 1 Time, King Street West, University District, Kingston, Ontario, K7L2V3, Canada 44.2222023 -76.4986098
appended 1 London, Greater London, England, SW1A 2DU, UK 51.5073219 -0.1276474
appended 2 Minneapolis, Hennepin County, Minnesota, United States of America 44.9772995 -93.2654692
appended 1 None, TO, PIE, Italia 44.933143 7.540121
appended 2 Texas, United States of America 31.8160381 -99.5120986
appended
appended 1 None, TO, PIE, Italia 44.933143 7.540121
appended 2 Redmond, King County, Washington, United States of America 47.6694141 -122.1238767
appended 2 Stone Mountain, DeKalb County, Georgia, 30087, United States of America 33.8062166 -84.1457505
appended 2 Toronto, Ontario, Canada 43.653963 -79.387207
appended
appended 1 None, TO, PIE, Italia 44.933143 7.540121
appended
appended 2 Dallas, Dallas County, Texas, United States of America 32.7762719 -96.7968559
appended 1 None, TO, PIE, Italia 44.933143 7.540121
appended 2 Happiness, Rotonda, Charlotte County, Florida, 33981, United States of America 26.925995 -82.25603
appended 1 None, TO, PIE, Italia 44.933143 7.540121
appended 2 John B. Keane Road, Listowel, Listowel Urban, Listowel, County Kerry, Munster, V31TR74, Ireland 52.4498412 -9.4777916
appended 1 Time, King Street West, University District, Kingston, Ontario, K7L2V3, Canada 44.2222023 -76.4986098
appended 2 California, United States of America 36.7014631 -118.7559974
appended
appended 2 United States of America 39.7837304 -100.4458825
appended 1 None, TO, PIE, Italia 44.933143 7.540121
appended
appended 1 None, TO, PIE, Italia 44.933143 7.540121
appended 1 None, TO, PIE, Italia 44.933143 7.540121
appended 2 Boston, Suffolk County, Massachusetts, United States of America 42.3604823 -71.0595678
appended
appended 1 None, TO, PIE, Italia 44.933143 7.540121
appended
appended 1 None, TO, PIE, Italia 44.933143 7.540121
appended 1 None, TO, PIE, Italia 44.933143 7.540121
appended 2 Washington, District of Columbia, United States of America 38.8949549 -77.0366456
appended 1 None, TO, PIE, Italia 44.933143 7.540121
appended 2 Englewood, Chicago, Cook County, Illinois, 60636, United States of America 41.7797559 -87.6458836
appended
appended 2 Canada 61.0666922 -107.9917071
appended 2 Lowndes County, Georgia, United States of America 30.8195619 -83.2628255
appended 1 กรุงเทพมหานคร, ประเทศไทย 13.7538929 100.8160803
appended 1 None, TO, PIE, Italia 44.933143 7.540121
appended 1 None, TO, PIE, Italia 44.933143 7.540121
appended 2 Miami Drive, Tallahassee, Leon County, Florida, 32311, United States of America 30.429583 -84.217732
appended
appended 2 London, Greater London, England, SW1A 2DU, UK 51.5073219 -0.1276474
appended 1 None, TO, PIE, Italia 44.933143 7.540121
appended 2 NYC, New York, United States of America 40.7306458 -73.9866136
appended 2 Oregon, United States of America 43.9792797 -120.737257
appended 2 Drexel Hill, Valley Road, Upper Darby Township, Delaware County, Pennsylvania, 19026, United States of America 39.9483282 -75.306887787778
appended 1 None, TO, PIE, Italia 44.933143 7.540121
appended 1 None, TO, PIE, Italia 44.933143 7.540121
appended 1 None, TO, PIE, Italia 44.933143 7.540121
appended 2 NYC, New York, United States of America 40.7306458 -73.9866136
appended 2 Hulu Kelang, Selangor, 53100, Malaysia 3.209928 101.7608508
appended
appended 2 California, United States of America 36.7014631 -118.7559974
appended 2 BK, Kings County, NYC, New York, 11226, United States of America 40.6501038 -73.9495823
appended
appended 2 Atlanta, Fulton County, Georgia, United States of America 33.7490987 -84.3901849
appended 1 Београд, Централна Србија, 11000, Србија 44.8178131 20.4568974
appended 2 England, Legoland Windsor, Rose Cottages, Oakley Green, Windsor and Maidenhead, South East, England, SL4 4AU, UK 51.46426255 -0.651714721140142
appended 1 None, TO, PIE, Italia 44.933143 7.540121
appended 2 Nederland 52.2379891 5.53460738161551
appended 2 Hamilton, Ontario, L8N 1A3, Canada 43.255205 -79.868202
appended
appended 2 India 22.3511148 78.6677428
appended 2 North America 51.0000002 -109.0000002
appended 2 Uddingston, South Lanarkshire, Scotland, G71 7ES, UK 55.8170913 -4.0822926
appended
appended 2 Ciudad de México, Cuauhtémoc, CDMX, 06060, México 19.4326009 -99.1333416
appended
appended 1 None, TO, PIE, Italia 44.933143 7.540121
appended 2 Crieff, Perth and Kinross, Scotland, PH7 3HU, UK 56.372717 -3.8397453
appended 1 Helsinki, Helsingin seutukunta, Uusimaa, Etelä-Suomi, Manner-Suomi, Suomi 60.1674086 24.9425683
appended 1 None, TO, PIE, Italia 44.933143 7.540121
appended
appended 2 Norwich, Norfolk, East of England, England, UK 52.628606 1.29227
appended 1 None, TO, PIE, Italia 44.933143 7.540121
appended 1 None, TO, PIE, Italia 44.933143 7.540121
appended 2 Home of the Brave, King Street West, King West, Old Toronto, Toronto, Ontario, M5V 1M5, Canada 43.6442782 -79.4002211
appended 1 London, Greater London, England, SW1A 2DU, UK 51.5073219 -0.1276474
appended
appended 2 Queens County, NYC, New York, United States of America 40.6524927 -73.7914214158161
appended 2 Mansour, حي الأندلس, الكرخ, محافظة بغداد, 10013, العراق 33.321756 44.335385
appended 1 Time, King Street West, University District, Kingston, Ontario, K7L2V3, Canada 44.2222023 -76.4986098
appended 2 Columbus, Franklin County, Ohio, United States of America 39.9622601 -83.0007065
appended 2 O Town, Railway Parade North, Syndal, Glen Waverley, City of Monash, Greater Melbourne, Victoria, 3150, Australia -37.8789504 145.1625316
appended 2 Miami Beach, Miami-Dade County, Florida, United States of America 25.7881436 -80.1272705
appended 1 Time, King Street West, University District, Kingston, Ontario, K7L2V3, Canada 44.2222023 -76.4986098
appended 2 Motherwell, North Lanarkshire, Scotland, ML1, UK 55.7915214 -3.9823503
appended 2 Allahabad, Uttar Pradesh, India 25.2859603 81.896732069544
appended 2 原宿, 表参道, 渋谷1, 渋谷区, 東京都, 150-0001, 日本 35.6687049 139.7053357
appended 2 서울특별시, 대한민국 37.5666791 126.9782914
appended 1 None, TO, PIE, Italia 44.933143 7.540121
appended 2 Lusaka, Lusaka Province, Zambia -15.416697 28.281381
appended 2 NYC, New York, United States of America 40.7306458 -73.9866136
appended 2 United States of America 39.7837304 -100.4458825
appended 2 Bournemouth, South West England, England, UK 50.74467035 -1.85798090318094
appended 2 Nairobi, Kenya -1.2832533 36.8172449
appended 1 None, TO, PIE, Italia 44.933143 7.540121
appended 2 กรุงเทพมหานคร, ประเทศไทย 13.7538929 100.8160803
appended 1 None, TO, PIE, Italia 44.933143 7.540121
appended 2 Africa 2.0000003 15.9999997
appended 1 None, TO, PIE, Italia 44.933143 7.540121
appended 2 Newcastle, Amajuba District Municipality, KwaZulu-Natal, 2940, South Africa -27.762778 29.923889
appended 2 Boston, Suffolk County, Massachusetts, United States of America 42.3604823 -71.0595678
appended 2 NYC, New York, United States of America 40.7306458 -73.9866136
appended 2 Toronto, Ontario, Canada 43.653963 -79.387207
appended 2 Казахстан 47.2286086 65.2093197
appended 2 LA, Los Angeles County, California, United States of America 34.054935 -118.244476
appended 2 Montebello, Papineau, Outaouais, Québec, Canada 45.6512171 -74.942673
appended 2 Turtle Island, Oxford County, Maine, United States of America 44.0357402 -70.4837919763434
appended 2 East Midlands, England, UK 52.79657515 -0.671822256833873
appended 2 Boston, Suffolk County, Massachusetts, United States of America 42.3604823 -71.0595678
appended 2 Beach City, Chambers County, Texas, United States of America 29.7419486 -94.8395296
appended 1 None, TO, PIE, Italia 44.933143 7.540121
appended 2 England, UK 52.7954791 -0.540240286617432
appended 2 Team Mystic Mural, Bromley Road, Downham, London Borough of Lewisham, London, Greater London, England, BR1 4JT, UK 51.419243 0.0015531
appended 2 Sussex, St. Helena Lane, Streat, Lewes, East Sussex, South East, England, BN7 3DH, UK 50.94468065 -0.06192935288129
appended 2 Omaha, Douglas County, Nebraska, United States of America 41.2587317 -95.9378732
appended 1 None, TO, PIE, Italia 44.933143 7.540121
appended 2 Nairobi, Kenya -1.2832533 36.8172449
appended 2 Accra, Accra Metropolitan, Greater Accra Region, 0302, Ghana 5.5600141 -0.2057437
appended 1 None, TO, PIE, Italia 44.933143 7.540121
appended 2 Baby, Provins, Seine-et-Marne, Île-de-France, France métropolitaine, 77480, France 48.3955294 3.3427924
---------------------------------------------------------------------------
timeout                                   Traceback (most recent call last)
/usr/lib/python3.5/urllib/request.py in do_open(self, http_class, req, **http_conn_args)
   1253             try:
-> 1254                 h.request(req.get_method(), req.selector, req.data, headers)
   1255             except OSError as err: # timeout error

/usr/lib/python3.5/http/client.py in request(self, method, url, body, headers)
   1105         """Send a complete request to the server."""
-> 1106         self._send_request(method, url, body, headers)
   1107 

/usr/lib/python3.5/http/client.py in _send_request(self, method, url, body, headers)
   1150             body = _encode(body, 'body')
-> 1151         self.endheaders(body)
   1152 

/usr/lib/python3.5/http/client.py in endheaders(self, message_body)
   1101             raise CannotSendHeader()
-> 1102         self._send_output(message_body)
   1103 

/usr/lib/python3.5/http/client.py in _send_output(self, message_body)
    933 
--> 934         self.send(msg)
    935         if message_body is not None:

/usr/lib/python3.5/http/client.py in send(self, data)
    876             if self.auto_open:
--> 877                 self.connect()
    878             else:

/usr/lib/python3.5/http/client.py in connect(self)
   1259             self.sock = self._context.wrap_socket(self.sock,
-> 1260                                                   server_hostname=server_hostname)
   1261             if not self._context.check_hostname and self._check_hostname:

/usr/lib/python3.5/ssl.py in wrap_socket(self, sock, server_side, do_handshake_on_connect, suppress_ragged_eofs, server_hostname)
    376                          server_hostname=server_hostname,
--> 377                          _context=self)
    378 

/usr/lib/python3.5/ssl.py in __init__(self, sock, keyfile, certfile, server_side, cert_reqs, ssl_version, ca_certs, do_handshake_on_connect, family, type, proto, fileno, suppress_ragged_eofs, npn_protocols, ciphers, server_hostname, _context)
    751                         raise ValueError("do_handshake_on_connect should not be specified for non-blocking sockets")
--> 752                     self.do_handshake()
    753 

/usr/lib/python3.5/ssl.py in do_handshake(self, block)
    987                 self.settimeout(None)
--> 988             self._sslobj.do_handshake()
    989         finally:

/usr/lib/python3.5/ssl.py in do_handshake(self)
    632         """Start the SSL/TLS handshake."""
--> 633         self._sslobj.do_handshake()
    634         if self.context.check_hostname:

timeout: _ssl.c:629: The handshake operation timed out

During handling of the above exception, another exception occurred:

URLError                                  Traceback (most recent call last)
~/.local/lib/python3.5/site-packages/geopy/geocoders/base.py in _call_geocoder(self, url, timeout, raw, requester, deserializer, **kwargs)
    151         try:
--> 152             page = requester(req, timeout=(timeout or self.timeout), **kwargs)
    153         except Exception as error: # pylint: disable=W0703

/usr/lib/python3.5/urllib/request.py in urlopen(url, data, timeout, cafile, capath, cadefault, context)
    162         opener = _opener
--> 163     return opener.open(url, data, timeout)
    164 

/usr/lib/python3.5/urllib/request.py in open(self, fullurl, data, timeout)
    465 
--> 466         response = self._open(req, data)
    467 

/usr/lib/python3.5/urllib/request.py in _open(self, req, data)
    483         result = self._call_chain(self.handle_open, protocol, protocol +
--> 484                                   '_open', req)
    485         if result:

/usr/lib/python3.5/urllib/request.py in _call_chain(self, chain, kind, meth_name, *args)
    443             func = getattr(handler, meth_name)
--> 444             result = func(*args)
    445             if result is not None:

/usr/lib/python3.5/urllib/request.py in https_open(self, req)
   1296             return self.do_open(http.client.HTTPSConnection, req,
-> 1297                 context=self._context, check_hostname=self._check_hostname)
   1298 

/usr/lib/python3.5/urllib/request.py in do_open(self, http_class, req, **http_conn_args)
   1255             except OSError as err: # timeout error
-> 1256                 raise URLError(err)
   1257             r = h.getresponse()

URLError: <urlopen error _ssl.c:629: The handshake operation timed out>

During handling of the above exception, another exception occurred:

GeocoderTimedOut                          Traceback (most recent call last)
<ipython-input-2-58d756bfb8e8> in <module>()
     26     latlong = locate.geocode(tweet['user']['location'], timeout = 10)
     27     if latlong is None:
---> 28         latlong = locate.geocode(tweet['user']['time_zone'], timeout = 10)
     29         if latlong is None:
     30             print('appended')

~/.local/lib/python3.5/site-packages/geopy/geocoders/osm.py in geocode(self, query, exactly_one, timeout, limit, addressdetails, language, geometry)
    228 
    229         return self._parse_json(
--> 230             self._call_geocoder(url, timeout=timeout), exactly_one
    231         )
    232 

~/.local/lib/python3.5/site-packages/geopy/geocoders/base.py in _call_geocoder(self, url, timeout, raw, requester, deserializer, **kwargs)
    169             elif isinstance(error, URLError):
    170                 if "timed out" in message:
--> 171                     raise GeocoderTimedOut('Service timed out')
    172                 elif "unreachable" in message:
    173                     raise GeocoderUnavailable('Service not available')

GeocoderTimedOut: Service timed out
In [3]:
import dateutil
df = pd.DataFrame({'time':times, 'polarity': polarities, 'subjectivity': subjectivities})
df = df.sort_values(by=['time'])
df['time'] = df['time'].apply(dateutil.parser.parse)
df.dtypes
Out[3]:
polarity                    float64
subjectivity                float64
time            datetime64[ns, UTC]
dtype: object
In [4]:
plt.figure(figsize = (12, 5))

plt.title('Sentiment Comparision')
plt.plot(df['time'], df['polarity'])
plt.plot(df['time'], df['subjectivity'])

plt.xlabel('Time')
plt.ylabel('Sentiment Value')
Out[4]:
Text(0,0.5,'Sentiment Value')
In [5]:
lats = [lat[0] for lat in locations]
longi = [long[1] for long in locations]

print(lats, " +  ", longi)
[52.2379891, 29.8207822747903, 28.1477885, 44.933143, 51.5073219, -8.8483112, 11.0869172, 42.291707, 44.933143, 39.7837304, 28.1083929, 9.6000359, 44.933143, 44.933143, 51.5073219, 46.3239455, 44.933143, 44.933143, 39.4124481, 44.2222023, 44.2222023, 39.5162234, 44.933143, 44.7716333, 56.0441984, 44.933143, 44.933143, 39.7837304, 9.80067315, 38.9786401, 43.2961743, 39.523652, 30.4380832, 44.933143, 39.1852184, 3.1546872, 44.933143, 30.2240897, 44.933143, 9.624388, 37.6413209, 44.933143, 52.2928116, 44.933143, -28.5912315, 44.933143, 37.5666791, 43.6211955, 47.6041834, 16.3471243, 44.933143, -28.1652832, 41.5510583, 35.9131542, 25.7742658, 44.933143, 40.0428151, 44.933143, 27.8002542, 43.0116784, 44.933143, 44.933143, -29.9476433, 55.856656, 51.0834196, 53.4791301, 44.933143, 44.933143, 44.933143, 34.851354, -26.8303703, 44.4308975, 40.7306458, 44.933143, 8.0300284, 44.933143, 44.933143, 27.77330515, 31.8111305, 44.933143, 30.3308401, 35.7212689, 52.7954791, -31.9513659, 34.395342, 6.9116138, 44.2222023, 51.5073219, 44.9772995, 44.933143, 31.8160381, 44.933143, 47.6694141, 33.8062166, 43.653963, 44.933143, 32.7762719, 44.933143, 26.925995, 44.933143, 52.4498412, 44.2222023, 36.7014631, 39.7837304, 44.933143, 44.933143, 44.933143, 42.3604823, 44.933143, 44.933143, 44.933143, 38.8949549, 44.933143, 41.7797559, 61.0666922, 30.8195619, 13.7538929, 44.933143, 44.933143, 30.429583, 51.5073219, 44.933143, 40.7306458, 43.9792797, 39.9483282, 44.933143, 44.933143, 44.933143, 40.7306458, 3.209928, 36.7014631, 40.6501038, 33.7490987, 44.8178131, 51.46426255, 44.933143, 52.2379891, 43.255205, 22.3511148, 51.0000002, 55.8170913, 19.4326009, 44.933143, 56.372717, 60.1674086, 44.933143, 52.628606, 44.933143, 44.933143, 43.6442782, 51.5073219, 40.6524927, 33.321756, 44.2222023, 39.9622601, -37.8789504, 25.7881436, 44.2222023, 55.7915214, 25.2859603, 35.6687049, 37.5666791, 44.933143, -15.416697, 40.7306458, 39.7837304, 50.74467035, -1.2832533, 44.933143, 13.7538929, 44.933143, 2.0000003, 44.933143, -27.762778, 42.3604823, 40.7306458, 43.653963, 47.2286086, 34.054935, 45.6512171, 44.0357402, 52.79657515, 42.3604823, 29.7419486, 44.933143, 52.7954791, 51.419243, 50.94468065, 41.2587317, 44.933143, -1.2832533, 5.5600141, 44.933143, 48.3955294]  +   [5.53460738161551, -95.7366129151, -82.7774086726313, 7.540121, -0.1276474, 13.2076618, -73.8806606343634, -85.5872286, 7.540121, -100.4458825, 84.0917139, 7.9999721, 7.540121, 7.540121, -0.1276474, -0.4645212, 7.540121, 7.540121, 16.8225645, -76.4986098, -76.4986098, -76.9382069, 7.540121, -89.787902, 12.7040684, 7.540121, 7.540121, -100.4458825, 126.118702106101, -76.492786, 5.3699525, -87.1250154, -84.2809332, 7.540121, -78.1652404, 101.7136362, 7.540121, -92.0198427, 7.540121, -73.2125095, -115.748361, 7.540121, -3.73893, 7.540121, -57.9394658, 7.540121, 126.9782914, -84.6824346, -122.3292397, 47.8915271, 7.540121, -63.64468, -8.4280045, -79.05578, -80.1936589, 7.540121, -86.1274888, 7.540121, -97.3955744, -88.2314813, 7.540121, 7.540121, -51.1695867, -4.2435817, 10.4234469, -2.2441009, 7.540121, 7.540121, 7.540121, -82.3984882, -65.2038133, -89.6884637, -73.9866136, 7.540121, -1.0800271, 7.540121, 7.540121, -82.6469934, -106.501349395577, 7.540121, 71.247499, -77.9155395, -0.540240286617432, 115.860389528787, -111.7632755, 79.8578631, -76.4986098, -0.1276474, -93.2654692, 7.540121, -99.5120986, 7.540121, -122.1238767, -84.1457505, -79.387207, 7.540121, -96.7968559, 7.540121, -82.25603, 7.540121, -9.4777916, -76.4986098, -118.7559974, -100.4458825, 7.540121, 7.540121, 7.540121, -71.0595678, 7.540121, 7.540121, 7.540121, -77.0366456, 7.540121, -87.6458836, -107.9917071, -83.2628255, 100.8160803, 7.540121, 7.540121, -84.217732, -0.1276474, 7.540121, -73.9866136, -120.737257, -75.306887787778, 7.540121, 7.540121, 7.540121, -73.9866136, 101.7608508, -118.7559974, -73.9495823, -84.3901849, 20.4568974, -0.651714721140142, 7.540121, 5.53460738161551, -79.868202, 78.6677428, -109.0000002, -4.0822926, -99.1333416, 7.540121, -3.8397453, 24.9425683, 7.540121, 1.29227, 7.540121, 7.540121, -79.4002211, -0.1276474, -73.7914214158161, 44.335385, -76.4986098, -83.0007065, 145.1625316, -80.1272705, -76.4986098, -3.9823503, 81.896732069544, 139.7053357, 126.9782914, 7.540121, 28.281381, -73.9866136, -100.4458825, -1.85798090318094, 36.8172449, 7.540121, 100.8160803, 7.540121, 15.9999997, 7.540121, 29.923889, -71.0595678, -73.9866136, -79.387207, 65.2093197, -118.244476, -74.942673, -70.4837919763434, -0.671822256833873, -71.0595678, -94.8395296, 7.540121, -0.540240286617432, 0.0015531, -0.06192935288129, -95.9378732, 7.540121, 36.8172449, -0.2057437, 7.540121, 3.3427924]
In [6]:
lats = list(filter(lambda a: a != 'p', lats))
In [7]:
import mplleaflet

mapdf = pd.DataFrame({'lat': lats, 'longi': longi, 'polarity':polarities[:len(lats)]})
plt.figure(figsize=(8, 8))
plt.scatter(longi, lats, c = polarities[:len(lats)])
mplleaflet.display()
Out[7]: