Adding more folders to chapter 2

This commit is contained in:
muassif
2021-01-16 15:06:16 +04:00
committed by GitHub
parent 55e9ad0515
commit abab477fe1
9 changed files with 140 additions and 0 deletions
+15
View File
@@ -0,0 +1,15 @@
import mypanda
def my_main():
dict = {"country": ["Brazil", "Russia", "India", "China", "South Africa"],
"capital": ["Brasilia", "Moscow", "New Dehli", "Beijing", "Pretoria"],
"area": [8.516, 17.10, 3.286, 9.597, 1.221],
"population": [200.4, 143.5, 1252, 1357, 52.98]}
mypanda.print_dataframe (dict)
""" This is executed only if the special variable '__name__' is set as main"""
if __name__ == "__main__":
my_main()
+9
View File
@@ -0,0 +1,9 @@
# mypanda.py with default and custom random functions
import pandas
def print_dataframe(dict):
"""This function output a dictionary as a data frame """
brics = pandas.tDataFrame(dict)
print(brics)
+15
View File
@@ -0,0 +1,15 @@
# myrandomv2.py with default and custom random functions
import random
#random = __import__('random')
#random = importlib.import_module('random')
print (globals())
def random_1d():
"""This function get a random number between 0 and 9"""
return random.randint(0,9)
def random_2d():
"""This function get a random number between 10 and 99"""
return random.randint(10,99)