0

i'm running this code but the api stopped to send bets values, how can i dataframe the "vazio" to scrappe values inside?

vazio='https://api-v2.blaze.com/roulette_games/current'
    
urlData = requests.get(vazio).content
rodadaatual = pd.read_json(io.StringIO(urlData.decode('utf-8')))

output

Empty DataFrame
Columns: [id, color, roll, created_at, updated_at, status, total_red_eur_bet, total_red_bets_placed, total_white_eur_bet, total_white_bets_placed, total_black_eur_bet, total_black_bets_placed, bets]
Index: []
6
  • how are we supposed to guess what a request to a random API will output? Commented Jul 12, 2022 at 13:13
  • I think he wants an empty dataframe with a column index of the keys of the json response. Vazio mean empty in portuguese so i am guessing here Commented Jul 12, 2022 at 13:14
  • yes, i want the data on this link, but he returning a empty Dataframe Commented Jul 12, 2022 at 13:22
  • Hi @LucasMendes can you try my answer and let me know if it helps. If it does please consider accepting the answer by clicking on check symbol left of the answer box Commented Jul 16, 2022 at 19:05
  • Hey @LucasMendes, can you atleast confirm if answer worked for you or not Commented Jul 19, 2022 at 9:43

1 Answer 1

1

You need to provide the data you read in a valid json list format. Then you can use pandas.read_json to read the json data

urlData = '[' + urlData.decode('utf-8') + ']'
pd.read_json(urlData)

Output :

This gives us the desired dataframe

           id  color  roll  ... total_black_eur_bet total_black_bets_placed bets
0  BylLAX00rG    NaN   NaN  ...                   0                       0   []

[1 rows x 13 columns]
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.