-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathretrieve_data.py
49 lines (37 loc) · 1.08 KB
/
retrieve_data.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import os
from math import floor
from datetime import datetime
from pprint import pprint
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from dotenv import load_dotenv
from tinydb import Query, TinyDB
load_dotenv()
db = TinyDB("db.json")
Language = Query()
fig = plt.figure()
_res = db.search(
(Language.techno == "amoa")
| (Language.techno == "python")
| (Language.techno == "java")
| (Language.techno == "chef de projet")
| (Language.techno == "supply chain")
| (Language.techno == "solidity")
| (Language.techno == "power bi")
| (Language.techno == "react")
| (Language.techno == "vue")
)
df = pd.DataFrame(_res)
def date_to_nb(curr_date):
return datetime.strptime(curr_date, "%Y/%m/%d-%H:%M:%S").timetuple().tm_yday
def convert_to_nb_week(data):
return floor(data / 7)
df["date"] = df["date"].apply(date_to_nb)
df["no_week"] = df["date"].apply(convert_to_nb_week)
df = df.pivot("date", "techno", "total")
sns.set()
res = sns.lineplot(data=df, markers=True)
plt.title("Evolution nb techno")
plt.show()