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) | |
| df[(df['sepal length']>6) & (df['petal length']>5 )] | |
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,index_col="sepal length") | |
| #Lets see the dataframe with index as sepal length | |
| print(df.head()) | |
| #Lets verify indexes | |
| print(df.index) | |
| #This will return all rows with index -> sepal length 5.0 |
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) | |
| #This will return all rows with indexes 2-4 | |
| print(df.iloc[2:5,:].head()) |
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) | |
| #Creating the selected column list | |
| select_column_names=["sepal width","petal length"] | |
| #Printing selected columns by loc way |
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) | |
| print("The shape of dataframe is {0}".format(df.shape)) | |
| print("The dimension of dataframe is {0}".format(df.ndim)) | |
| print("The size of dataframe is {0}".format(df.size)) | |
| print("The dtype of data is {0}".format(df.dtypes)) | |
| print("The values of data is {0}".format(df.values)) |
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) | |
| df.shape |
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) | |
| df.describe() |
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) | |
| df.head() |
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 | |
| list_of_numbers1 = [100,200,300,400,500] | |
| index_number1 = [1,2,3,4,5] | |
| list_of_numbers2 = [200,300,400,500,600] | |
| index_number2 = [10,20,30,40,50] | |
| series1 = pd.Series(data=list_of_numbers1,index=index_number1) | |
| series2 = pd.Series(data=list_of_numbers2,index=index_number2) |
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 | |
| list_of_numbers1 = [100,200,300,400,500] | |
| index_number1 = [1,2,3,4,5] | |
| list_of_numbers2 = [200,300,400,500,600] | |
| index_number2 = [10,20,30,40,50] | |
| series1 = pd.Series(data=list_of_numbers1,index=index_number1) | |
| series2 = pd.Series(data=list_of_numbers2,index=index_number2) |