This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Simple Decorator Code Starts | |
| # a = {"isAdmin":True} | |
| # def custom_decorators(func): | |
| # def inner_function(): | |
| # if a["isAdmin"]: | |
| # return func() | |
| # return inner_function |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pandas as pd | |
| import numpy as np | |
| dataframe1 = pd.DataFrame({"Class_ID":[1,2,3,4], | |
| "Name":["Adam","Jack","Ram","Krishna"]}) | |
| dataframe2 = pd.DataFrame({"Class_ID":[2,3,4,10,11], | |
| "Marks":[20,30,40,60,70]}) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pandas as pd | |
| import numpy as np | |
| dataframe1 = pd.DataFrame({"Class_ID":[1,2,3,4], | |
| "Name":["Adam","Jack","Ram","Krishna"]}) | |
| dataframe2 = pd.DataFrame({"Class_ID":[2,3,4,10,11], | |
| "Marks":[20,30,40,60,70]}) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pandas as pd | |
| import numpy as np | |
| dataframe1 = pd.DataFrame({"Class_ID":[1,2,3,4], | |
| "Name":["Adam","Jack","Ram","Krishna"]}) | |
| dataframe2 = pd.DataFrame({"Class_ID":[2,3,4,10,11], | |
| "Marks":[20,30,40,60,70]}) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pandas as pd | |
| import numpy as np | |
| dataframe1 = pd.DataFrame({"Class_ID":[1,2,3,4], | |
| "Name":["Adam","Jack","Ram","Krishna"]}) | |
| dataframe2 = pd.DataFrame({"Class_ID":[2,3,4,10,11], | |
| "Marks":[20,30,40,60,70]}) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pandas as pd | |
| import numpy as np | |
| dataframe1 = pd.DataFrame({"Class_ID":[1,2,3,4], | |
| "Name":["Adam","Jack","Ram","Krishna"]}) | |
| dataframe2 = pd.DataFrame({"Class_ID":[2,3,4,10,11], | |
| "Marks":[20,30,40,60,70]}) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pandas as pd | |
| import numpy as np | |
| #Get the mean of the group less than 5 | |
| def get_mean_group_lessthan_five(arr): | |
| return arr[(arr<5)].mean() | |
| column_names = ["sepal length","sepal width","petal length","petal width","Type of flower"] | |
| df = pd.read_csv("https://archive.ics.uci.edu/ml/machine-learning-databases/iris/iris.data", | |
| names=column_names) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pandas as pd | |
| import numpy as np | |
| column_names = ["sepal length","sepal width","petal length","petal width","Type of flower"] | |
| df = pd.read_csv("https://archive.ics.uci.edu/ml/machine-learning-databases/iris/iris.data", | |
| names=column_names) | |
| #Check the mean sepal length, sepal width, petal length, petal width on the | |
| #basis of type of flower | |
| abc = df.groupby('Type of flower').mean() | |
| print(abc) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pandas as pd | |
| import numpy as np | |
| # Method for Ranking the Category | |
| # if the mean is less than 4 it will return 1 category else 2 | |
| def category_name(arr): | |
| mean = arr.mean() | |
| if mean>4: | |
| return 1 | |
| else: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pandas as pd | |
| column_names = ["sepal length","sepal width","petal length","petal width","Type of flower"] | |
| df = pd.read_csv("https://archive.ics.uci.edu/ml/machine-learning-databases/iris/iris.data", | |
| names=column_names) | |
| abc = df.agg(["mean","sum","std"]) | |
| print(abc) |
NewerOlder