Bonjour à tous,
j'ai un soucis avec un petit code que je suis entrain d'essayer et je j'ai besoins de vos aide pour y voir un peu plus clair.
En fait je récupère des données bitcoins depuis un site, tout ce passe bien.

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
 
Voilà les données récupérées (ce que contient allData): 
[						
	{'price': 0.00603, 'volume': 0.00999201, 'side': 'buy', 'timestamp': '2020-04-16T18:23:32Z'}, 
	{'price': 0.00602, 'volume': 0.26999997, 'side': 'buy', 'timestamp': '2020-04-16T18:17:08Z'}, 
         ...
	{'price': 0.00602, 'volume': 0.01000799, 'side': 'buy', 'timestamp': '2020-04-16T18:17:08Z'}
]
[
	{'price': 0.00601, 'volume': 1.00519584, 'side': 'buy', 'timestamp': '2020-04-17T22:00:49Z'}, 
	{'price': 0.00601, 'volume': 0.19084732, 'side': 'buy', 'timestamp': '2020-04-17T21:33:31Z'},
        ... 
	{'price': 0.00601, 'volume': 0.03097522, 'side': 'buy', 'timestamp': '2020-04-17T21:20:48Z'}] 
 
#---------------- Code sources ---------------
#########################
 
def ani(i):
    ...
 
    try:
        allData = urlopen(request)
    except HTTPError as e:
        allData = e 
    status =  allData.getcode()
    allData = bytes.decode(allData.read())
    # print("Status code: " + str(status)) # me renvoie 200 donc c'est OK
    allData = json.loads(allData)
 
    allData = pd.DataFrame(allData)
 
    buys = allData[(allData['side'] == "buy")]
    buyDates = (buys['datestamp']).tolist() # Meme si je fais: buyDates = (sells[3]).tolist() 
 
    sells = data[(allData['side'] == "sell")]
    sellDates = (sells['datestamp']).tolist()  # Meme si je fais: sellDates = (sells[3]).tolist() 
 
    a.clear()
 
    a.plot_date(buyDates, buys[0], "#00A3E0",label="buys")
    a.plot_date(sellDates, sells[0], "#00A3E0",label="sells")
A l'exécution voilà ce que j'ai comme erreur:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
raceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pandas/core/indexes/base.py", line 2646, in get_loc
    return self._engine.get_loc(key)
  File "pandas/_libs/index.pyx", line 111, in pandas._libs.index.IndexEngine.get_loc
  File "pandas/_libs/index.pyx", line 138, in pandas._libs.index.IndexEngine.get_loc
  File "pandas/_libs/hashtable_class_helper.pxi", line 1619, in pandas._libs.hashtable.PyObjectHashTable.get_item
  File "pandas/_libs/hashtable_class_helper.pxi", line 1627, in pandas._libs.hashtable.PyObjectHashTable.get_item
KeyError: 3
Quelqu'un y comprend quelque chose?
Merci d'avance