ZipCodes'ı lat ve long'a dönüştürmek için tweepy ve geocode paketlerini kullanıyorum, ancak tweepy kullanarak twitter API'den çekiyorum, ancak geri dönmek için hiçbir şey alamıyorum. Kod satırımı geçtim ve yürüttüm ve her seferinde hiçbir şey döndürmeden api.search üzerinde takılıyorum.tweety twitter APi hiçbir şey döndürmez (python)
query = 'stack'
radius = 1000
DataSet = pd.DataFrame
loopCount = 0
appended_data = []
appendData = []
def toDataFrame(tweets):
DataSet = pd.DataFrame()
DataSet['tweetID'] = [tweet.id for tweet in tweets]
DataSet['tweetText'] = [tweet.text for tweet in tweets]
DataSet['tweetRetweetCt'] = [tweet.retweet_count for tweet in tweets]
DataSet['tweetFavoriteCt'] = [tweet.favorite_count for tweet in tweets]
DataSet['tweetSource'] = [tweet.source for tweet in tweets]
DataSet['tweetCreated'] = [tweet.created_at for tweet in tweets]
DataSet['userID'] = [tweet.user.id for tweet in tweets]
DataSet['userScreen'] = [tweet.user.screen_name for tweet in tweets]
DataSet['userName'] = [tweet.user.name for tweet in tweets]
DataSet['userCreateDt'] = [tweet.user.created_at for tweet in tweets]
DataSet['userDesc'] = [tweet.user.description for tweet in tweets]
DataSet['userFollowerCt'] = [tweet.user.followers_count for tweet in tweets]
DataSet['userFriendsCt'] = [tweet.user.friends_count for tweet in tweets]
DataSet['userLocation'] = [tweet.user.location for tweet in tweets]
DataSet['userTimezone'] = [tweet.user.time_zone for twee
def location(zip):
geolocator = Nominatim()
location = geolocator.geocode(zip)
cordinates = ((location.latitude, location.longitude))
cordinates = str(cordinates)
cordinates = cordinates.replace("(","")
cordinates = cordinates.replace(")","")
return cordinates
def lookUp(results):
for result in results:
DataSet = pd.DataFrame(results)
print DataSet
return DataSet
##hidden for SO
auth = tp.OAuthHandler('','')
auth.set_access_token('', '')
api = tp.API(auth)
for zip in zips:
#for row, zip in zips.iterrows():
if (loopCount == 15):
t.sleep(960)
loopCount = 0
loopCount = loopCount + 1
cordinates = location(zip)
inputCode = cordinates + ', ' + str(radius)
results = api.search(geocode=inputCode, count=100, q=query)
DataSet = lookUp(results)
appendData.append(DataSet)
appended_data = pd.concat(appendedData, axis=1)