Best Python code snippet using molotov_python
lekce05_dotazy.py
Source:lekce05_dotazy.py
1#import wget2#wget.download("https://kodim.cz/czechitas/progr2-python/python-pro-data-1/zakladni-dotazy/assets/staty.json")3import pandas4staty = pandas.read_json("staty.json")5staty = staty.set_index("name")6print(staty[["population", "area"]])7#když dám 2 promÄnné, tak jsou 2 závorky - dÄlám totiž jeÅ¡tÄ z toho seznam8populace = staty["population"]9#vybÃrám jeden sloupec, tedy jeden rozmÄr, je to série, nenà to dataframe10#když chci seÄÃst celou populaci, vypisuje to jako ÄÃslo11print(populace.sum())12print(staty["population"] < 1000)13#vypÃÅ¡e vÅ¡echny státy a u toho True nebo False, jestli byla splnÄná podmÃnka14#pokud chci vypsat konkrétnà státy, tak když uvidà False, tak dá pryÄ, pokud True, tak tam Åádek nechá15# => musÃm to obalit do dalÅ¡Ãho dotazu16print(staty[staty["population"] < 1000])17pidistaty = staty[staty["population"] < 1000]18print(pidistaty[["area", "population"]])19#lidnaté EV státy a podmÃnky (EV a vÃc jak 20 mil. ob), každý dotaz musà mÃt svou vlastnà ()20# | (alt + w) je nebo; & je a zároveÅ21lidnate_evropske_staty = staty[(staty["population"] > 20_000_000) & (staty["region"] == "Europe")]22print(lidnate_evropske_staty)23print(lidnate_evropske_staty["population"])24vyznamne_staty = staty[(staty["population"] > 1_000_000_000) | (staty["area"] > 3_000_000)]25print(vyznamne_staty)26#podmÃnka na seznam regionů27zap_vych_evropa = staty[staty["subregion"].isin(["Western Europe", "Eastern Europe"])]...
pro_data_1_zakladni_dotazy.py
Source:pro_data_1_zakladni_dotazy.py
1import pandas2import wget3#wget.download("https://kodim.cz/czechitas/progr2-python/python-pro-data-1/zakladni-dotazy/assets/staty.json")4staty = pandas.read_json("staty.json")5staty = staty.set_index("name")6#print(staty.info())7#print(staty.loc["Czech Republic":"Dominican Republic"])8#print(staty.loc["Uzbekistan":])9#print(staty.loc[["Czech Republic", "Slovakia"], "capital"])10#print(staty["population"])11#print(staty[["population", "area"]])12#populace = staty["population"]13#print(populace.sum())14#print(staty["population"] < 1000) // printuje False a True, nevymenuje staty15#pidistaty = staty[staty["population"] < 1000]16#print(pidistaty[["area", "population"]])17lidnate_evropske_staty = staty[(staty["population"] > 20_000_000) & (staty["region"] == "Europe")]18#print(lidnate_evropske_staty["population"])19vyznamne_staty = staty[(staty["population"] > 1_000_000_000) | (staty["area"] > 3_000_000)]20#print(vyznamne_staty[["population", "area"]])21zap_vych_evropa = staty[staty["subregion"].isin(["Western Europe", "Eastern Europe"])]...
zakladnidotazy.py
Source:zakladnidotazy.py
1import pandas2# import wget3# wget.download("https://kodim.cz/czechitas/progr2-python/python-pro-data-1/zakladni-dotazy/assets/staty.json")4#5staty = pandas.read_json("staty.json")6staty = staty.set_index("name")7#8#print(staty.info())9#print(staty.index)10#11# print (staty.loc["Czech Republic"]) #loc bude vypisovat radky ktere jsme si pojmenovali v set_index name12#13#print (staty.loc["Czech Republic":"Dominican Republic"]) #vypise vsechno od CZ po Dom, vcetne, to je jinak nez u ILOC, ktery posledni cislo nebere v potaz14#15#print (staty.loc["Czech Republic":])#od ceksa dal16# print (staty.loc[["Slovakia", "Austria", "Poland"], ["gini", "population"]]) #vybere zeme a sloupecky co ma vybrat17# populace = staty["population"]18# print(populace.sum())19#20# pidistaty = staty[staty["population"] < 1000]21# print(pidistaty[["area", "population"]])22lidnate_evropske_staty = staty [(staty["population"] > 20000000) & (staty["region"] == "Europe")]...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!