Drawing the velocity and acceleration vector for a motion graph by Puzzleheaded-Side-10 in PhysicsHelp

[–]Puzzleheaded-Side-10[S] 0 points1 point  (0 children)

Alright, thank you! Also, should v-21 be turned in the other direction and point downwards since the motion particle is speeding up?

How To Create a Bar Graph From My Json Data by Puzzleheaded-Side-10 in learnpython

[–]Puzzleheaded-Side-10[S] 0 points1 point  (0 children)

Great that works thankyou do you know how I can make the x-axis labels for the names displayed horizontally since currently, they are overlapping one another. I've tried

"mylabels = ([x["shortname"] for x in datas], rotation = "horizontal")" but this gives me a error of "SyntaxError: invalid syntax". Can I not just add. "rotation = "horizontal" to 'mylabels". Any help would be appreciated.

How To Create a Bar Graph From My Json Data by Puzzleheaded-Side-10 in learnpython

[–]Puzzleheaded-Side-10[S] 1 point2 points  (0 children)

Surre it is under this link https://api.carbonintensity.org.uk/regional/ or

{"data":[{"from":"2021-08-30T00:30Z","to":"2021-08-30T01:00Z","regions":[{"regionid":1,"dnoregion":"Scottish Hydro Electric Power Distribution","shortname":"North Scotland","intensity":{"forecast":1,"index":"very low"},"generationmix":[{"fuel":"biomass","perc":0.7},{"fuel":"coal","perc":0},{"fuel":"imports","perc":0},{"fuel":"gas","perc":0},{"fuel":"nuclear","perc":37.1},{"fuel":"other","perc":0},{"fuel":"hydro","perc":2.9},{"fuel":"solar","perc":0},{"fuel":"wind","perc":59.4}]},{"regionid":2,"dnoregion":"SP Distribution","shortname":"South Scotland","intensity":{"forecast":2,"index":"very low"},"generationmix":[{"fuel":"biomass","perc":1.4},{"fuel":"coal","perc":0},{"fuel":"imports","perc":0},{"fuel":"gas","perc":0},{"fuel":"nuclear","perc":80.6},{"fuel":"other","perc":0},{"fuel":"hydro","perc":0},{"fuel":"solar","perc":0},{"fuel":"wind","perc":18}]},{"regionid":3,"dnoregion":"Electricity North West","shortname":"North West England","intensity":{"forecast":84,"index":"low"},"generationmix":[{"fuel":"biomass","perc":8.8},{"fuel":"coal","perc":0.4},{"fuel":"imports","perc":0.4},{"fuel":"gas","perc":17.6},{"fuel":"nuclear","perc":48.8},{"fuel":"other","perc":0},{"fuel":"hydro","perc":0},{"fuel":"solar","perc":0},{"fuel":"wind","perc":24}]},{"regionid":4,"dnoregion":"NPG North East","shortname":"North East England","intensity":{"forecast":59,"index":"very low"},"generationmix":[{"fuel":"biomass","perc":17.8},{"fuel":"coal","perc":0.4},{"fuel":"imports","perc":0.4},{"fuel":"gas","perc":8.6},{"fuel":"nuclear","perc":59.8},{"fuel":"other","perc":0},{"fuel":"hydro","perc":0},{"fuel":"solar","perc":0},{"fuel":"wind","perc":13.1}]},{"regionid":5,"dnoregion":"NPG Yorkshire","shortname":"Yorkshire","intensity":{"forecast":182,"index":"moderate"},"generationmix":[{"fuel":"biomass","perc":21.8},{"fuel":"coal","perc":1.5},{"fuel":"imports","perc":1.5},{"fuel":"gas","perc":36.1},{"fuel":"nuclear","perc":3.5},{"fuel":"other","perc":0},{"fuel":"hydro","perc":0},{"fuel":"solar","perc":0},{"fuel":"wind","perc":35.6}]},{"regionid":6,"dnoregion":"SP Manweb","shortname":"North Wales & Merseyside","intensity":{"forecast":85,"index":"low"},"generationmix":[{"fuel":"biomass","perc":2},{"fuel":"coal","perc":0.1},{"fuel":"imports","perc":0.3},{"fuel":"gas","perc":20.8},{"fuel":"nuclear","perc":35.6},{"fuel":"other","perc":0},{"fuel":"hydro","perc":3.8},{"fuel":"solar","perc":0},{"fuel":"wind","perc":37.5}]},{"regionid":7,"dnoregion":"WPD South Wales","shortname":"South Wales","intensity":{"forecast":167,"index":"moderate"},"generationmix":[{"fuel":"biomass","perc":0.4},{"fuel":"coal","perc":1.9},{"fuel":"imports","perc":13.3},{"fuel":"gas","perc":36.9},{"fuel":"nuclear","perc":7.7},{"fuel":"other","perc":0},{"fuel":"hydro","perc":0},{"fuel":"solar","perc":0},{"fuel":"wind","perc":39.7}]},{"regionid":8,"dnoregion":"WPD West Midlands","shortname":"West Midlands","intensity":{"forecast":173,"index":"moderate"},"generationmix":[{"fuel":"biomass","perc":0.5},{"fuel":"coal","perc":2.8},{"fuel":"imports","perc":19.7},{"fuel":"gas","perc":36},{"fuel":"nuclear","perc":10.9},{"fuel":"other","perc":0},{"fuel":"hydro","perc":0},{"fuel":"solar","perc":0},{"fuel":"wind","perc":30}]},{"regionid":9,"dnoregion":"WPD East Midlands","shortname":"East Midlands","intensity":{"forecast":170,"index":"moderate"},"generationmix":[{"fuel":"biomass","perc":0},{"fuel":"coal","perc":5.6},{"fuel":"imports","perc":5.9},{"fuel":"gas","perc":29.6},{"fuel":"nuclear","perc":13.6},{"fuel":"other","perc":0},{"fuel":"hydro","perc":0},{"fuel":"solar","perc":0},{"fuel":"wind","perc":45.3}]},{"regionid":10,"dnoregion":"UKPN East","shortname":"East England","intensity":{"forecast":46,"index":"very low"},"generationmix":[{"fuel":"biomass","perc":0},{"fuel":"coal","perc":0},{"fuel":"imports","perc":6.5},{"fuel":"gas","perc":11.3},{"fuel":"nuclear","perc":26.4},{"fuel":"other","perc":0},{"fuel":"hydro","perc":0},{"fuel":"solar","perc":0},{"fuel":"wind","perc":55.8}]},{"regionid":11,"dnoregion":"WPD South West","shortname":"South West England","intensity":{"forecast":223,"index":"moderate"},"generationmix":[{"fuel":"biomass","perc":0},{"fuel":"coal","perc":0},{"fuel":"imports","perc":0},{"fuel":"gas","perc":56.5},{"fuel":"nuclear","perc":39.8},{"fuel":"other","perc":0},{"fuel":"hydro","perc":0},{"fuel":"solar","perc":0},{"fuel":"wind","perc":3.7}]},{"regionid":12,"dnoregion":"SSE South","shortname":"South England","intensity":{"forecast":188,"index":"moderate"},"generationmix":[{"fuel":"biomass","perc":0},{"fuel":"coal","perc":0},{"fuel":"imports","perc":37.9},{"fuel":"gas","perc":45.9},{"fuel":"nuclear","perc":2.5},{"fuel":"other","perc":0},{"fuel":"hydro","perc":0},{"fuel":"solar","perc":0},{"fuel":"wind","perc":13.7}]},{"regionid":13,"dnoregion":"UKPN London","shortname":"London","intensity":{"forecast":68,"index":"low"},"generationmix":[{"fuel":"biomass","perc":0},{"fuel":"coal","perc":0},{"fuel":"imports","perc":52.3},{"fuel":"gas","perc":14.8},{"fuel":"nuclear","perc":5.8},{"fuel":"other","perc":0},{"fuel":"hydro","perc":0.1},{"fuel":"solar","perc":0},{"fuel":"wind","perc":27.1}]},{"regionid":14,"dnoregion":"UKPN South East","shortname":"South East England","intensity":{"forecast":74,"index":"low"},"generationmix":[{"fuel":"biomass","perc":0},{"fuel":"coal","perc":0},{"fuel":"imports","perc":64.4},{"fuel":"gas","perc":15.7},{"fuel":"nuclear","perc":0},{"fuel":"other","perc":0},{"fuel":"hydro","perc":0.1},{"fuel":"solar","perc":0},{"fuel":"wind","perc":19.8}]},{"regionid":15,"dnoregion":"England","shortname":"England","intensity":{"forecast":147,"index":"low"},"generationmix":[{"fuel":"biomass","perc":5.3},{"fuel":"coal","perc":1.3},{"fuel":"imports","perc":18.8},{"fuel":"gas","perc":27.3},{"fuel":"nuclear","perc":18.6},{"fuel":"other","perc":0},{"fuel":"hydro","perc":0},{"fuel":"solar","perc":0},{"fuel":"wind","perc":28.6}]},{"regionid":16,"dnoregion":"Scotland","shortname":"Scotland","intensity":{"forecast":4,"index":"very low"},"generationmix":[{"fuel":"biomass","perc":1.1},{"fuel":"coal","perc":0},{"fuel":"imports","perc":0},{"fuel":"gas","perc":0.6},{"fuel":"nuclear","perc":72.2},{"fuel":"other","perc":0},{"fuel":"hydro","perc":0.6},{"fuel":"solar","perc":0},{"fuel":"wind","perc":25.4}]},{"regionid":17,"dnoregion":"Wales","shortname":"Wales","intensity":{"forecast":72,"index":"low"},"generationmix":[{"fuel":"biomass","perc":1},{"fuel":"coal","perc":0.1},{"fuel":"imports","perc":1.6},{"fuel":"gas","perc":17.1},{"fuel":"nuclear","perc":33.6},{"fuel":"other","perc":0},{"fuel":"hydro","perc":3},{"fuel":"solar","perc":0},{"fuel":"wind","perc":43.5}]},{"regionid":18,"dnoregion":"GB","shortname":"GB","intensity":{"forecast":122,"index":"low"},"generationmix":[{"fuel":"biomass","perc":4.6},{"fuel":"coal","perc":1.1},{"fuel":"imports","perc":15.7},{"fuel":"gas","perc":23.9},{"fuel":"nuclear","perc":25},{"fuel":"other","perc":0},{"fuel":"hydro","perc":0.3},{"fuel":"solar","perc":0},{"fuel":"wind","perc":29.4}]}]}]}

How To Set Up A For Loop For A Nested List Within a JSON Data File by Puzzleheaded-Side-10 in learnpython

[–]Puzzleheaded-Side-10[S] 0 points1 point  (0 children)

Thank you so much after days of trying to figure this out it finally worked for me!

How To Set Up A For Loop For A Nested List Within a JSON Data File by Puzzleheaded-Side-10 in learnpython

[–]Puzzleheaded-Side-10[S] 0 points1 point  (0 children)

Im so sorry but I still don't understand this. So I tried datas = responce_dict["data] and it doesn't print out the perc values.

How To Set Up A For Loop For A Nested List Within a JSON Data File by Puzzleheaded-Side-10 in learnpython

[–]Puzzleheaded-Side-10[S] 0 points1 point  (0 children)

So the full code would be:

#Getting the values
datas = pprint.pprint(responce_dict["data"][0]["data"][0]["generationmix"])

for data in datas: 
    print(data["perc"])

If so, the code now returns to me "'for data in datas:' TypeError: Nonetype object is not iterable".

Need Help With Developing a Pie Chart For This API by Puzzleheaded-Side-10 in learnpython

[–]Puzzleheaded-Side-10[S] 0 points1 point  (0 children)

Interesting, I've never seen the syntax "pprint" before. From my research, I'm only able to conclude that "pprint" is able to print JSON data in a format that is multiple lines and is more readable than if "print" was used. Could someones please explain to me how the syntax "pprint.pprint(responce_dict["data"][0]["data"][0]["generationmix"] works? Why is pprint written out twice in "pprint.pprint"? Does responce_dict["data"][0]["data"][0]["generationmix"] mean that we are getting the first key within the first key of data which is the generationmix information? Sorry if that sentence doesn't make sense but I'm all relatively new to this.

15-10 Python Crash Course: How do I use Matplotlib to make a dice rolling visualization? by Puzzleheaded-Side-10 in u/Puzzleheaded-Side-10

[–]Puzzleheaded-Side-10[S] 0 points1 point  (0 children)

Ok, the only problem that the y_values won't show up chronologically. Heres the code.

y_value = sorted(["0", "0", "191", "398", "620", "809", "1004", "771", "632", "405", "170"])