# my_lambdata/my_script import pandas from my_lambdata.my_mod import enlarge print("Happy Tuesday Night") df = pandas.DataFrame({"x": [1, 2, 3], "y": [4, 5, 6]}) print(df.head()) x = 5 print("ENLARGE", x, "TO", enlarge(x))
def test_enlarge(): #self.assertEqual(enlarge(5),500) assert enlarge(5) == 500
def test_enlarge(self): self.assertEqual(enlarge(5), 500)
import pandas as pd from my_lambdata.my_mod import enlarge print("HELLO") df = pd.DataFrame({"a": [1, 2, 3], "b": [4, 5, 6]}) print(df.head()) print(enlarge(df["a"].sum()))
# my_script.py from pandas import DataFrame from my_lambdata.my_mod import enlarge print('Hello World') df = DataFrame({'a': [1, 2, 3], 'b': [4, 5, 6]}) print(df.head()) x = 11 print('Number', x) print('Enlarged number', enlarge(x)) # df = pandas.DataFrame({'state':['CT', 'CO', 'CA', 'CA', 'TX']}) # print(df.head()) # print("--------------")
def test_enlarge(self): """ Unit test that the enlarge function in the my_mod file is working properly """ self.assertEqual(enlarge(5), 500)
# my_lambdata/my_script.py import pandas from my_lambdata.my_mod import enlarge print("HELLO WORLD") df = pandas.DataFrame({"state": ["CT", "CO", "CA", "TX"]}) print(df.head()) print("-----------------") x = 5 print("NUMBER", x) print("ENLARGED NUMBER", enlarge(x)) # invoking our function!!
def test_enlarge(self): self.assertEqual(enlarge(9), 900)
def test_upper(self): self.assertEqual(enlarge(4), 400)
import pandas from my_lambdata.my_mod import enlarge print('Hello world uWu') df = pandas.DataFrame({"state": ['CT', 'CO', 'CA', 'TX']}) print(df.head()) print(enlarge(9))
# my_lambdata/my_script.py import pandas from my_lambdata.my_mod import enlarge print("Happy Whatever Day") df = pandas.DataFrame({"x": [1, 2, 3], "y": [4, 5, 6]}) print(df.head()) x = 5 print("Enlarge", x, "TO", enlarge(x))
def test_upper(self): self.assertEqual(enlarge(3), 300)
import pandas from my_lambdata.my_mod import enlarge print('HAPPY TUESDAY NIGHT.') df = pandas.DataFrame({'x': [1, 2, 3], 'y': [4, 5, 6]}) print(df.head()) x = 5 print('ENLARGE', x, 'TO', enlarge(x))
def test_upper(): assert enlarge(3) == 300
from my_lambdata.my_mod import enlarge print("Hello") print(enlarge(8)) y = (enlarge(8))
from my_lambdata.my_mod import enlarge print('Hello World.') x = 100 print('x: ', x) print('Enlarged x: ', enlarge(x))
# my_script.py from pandas import DataFrame #from my_mod import enlarge # this works from my_lambdata.my_mod import enlarge print("HELLO") df = DataFrame({"a": [1, 2, 3], "b": [4, 5, 6]}) print(df.head()) x = 11 print(enlarge(x))
import unittest from my_lambdata.my_mod import enlarge x = 5 print(x, "Enlarge", enlarge(x)) class TestMyMod(unittest.TestCase): def test_enlarge(self): self.assertEqual(enlarge(5), 500) if __name__ == '__main__': unittest.main()
#from my_mod import enlarge from pandas import DataFrame from my_lambdata.my_mod import enlarge print("HELLO") print(enlarge(8)) df = DataFrame({"state": ["CT", "CO", "CA", "TX"]}) print(df.head())
# Import enlarge and invoke enlarge # Do not import the entire script (if __name__ == "__main__"...) # from my_mod import enlarge # Sometimes you may need this # Will need an init file AND # Run as '''python -m my_lambdata.hello''' (modular approach) from my_lambdata.my_mod import enlarge print('HELLO!') print(enlarge(10))
# my_lambdata/my_script.py from my_lambdata.my_mod import enlarge import pandas print("Hello") df = pandas.DataFrame({"state": ["CT", "CO", "AZ"]}) print(df.head()) print("---------") x = 5 print("num", x) print("enlarged num", enlarge(x))
import pandas #import my_mod #from my_mod import enlarge # works from my_lambdata.my_mod import enlarge print("HELLO WORLD") print(2+2) df = pandas.DataFrame({"a":[1,2,3],"b":[4,5,6]}) print(df.head()) y = 9 print(enlarge(y))
import pandas from my_lambdata.my_mod import enlarge, fib, fib2 from my_lambdata print("HELLO WORLD") df = pandas.DataFrame({"state": ["CT", "CO", "CA", "TX"]}) print (df.head()) print("-------------") x = 5 print("NUMBER", x) print("ENLARGED NUMBER", enlarge(x))
from pandas import DataFrame from my_lambdata.my_mod import enlarge #this works print('Hello') df = DataFrame({'a': [1, 2, 3], 'b': [4, 5, 6]}) print(df.head()) x = 11 print(enlarge(x)) #importing only enlarge function #if we use from my_mod import enlarge without "if __name__ == "__main__":" # then the entire file my_mod will be executed