Skip to content

Commit

Permalink
add limite 25 mqtt
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul Ronga committed Jul 4, 2019
1 parent 8237c7a commit 882b40c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions parser-stories.py
Expand Up @@ -24,8 +24,7 @@
# Get the stories as json

response = requests.get(config['get-stories'])
data = response.json()
df = pd.DataFrame(data)
df = pd.DataFrame(response.json())

nlp = spacy.load('fr')
d = gender.Detector()
Expand Down Expand Up @@ -99,12 +98,13 @@ def computeRatio(counts):

df['percentage'] = df['ratio'].apply(lambda x: "{0:.2f}%".format(x*100) if x == x else 'n/a')

mean = df['ratio'].mean() * 100

################
# MQTT
#

# on prend les 25 derniers
mean = df[25:]['ratio'].mean() * 100

client = mqtt.Client("xoxox")
client.connect(config['mqtt-broker'], port=1883)

Expand Down

0 comments on commit 882b40c

Please sign in to comment.