Skip to content

Instantly share code, notes, and snippets.

View pygaurav's full-sized avatar
🎯
Focusing

Gaurav Bhardwaj pygaurav

🎯
Focusing
View GitHub Profile
@pygaurav
pygaurav / Pandas_series_wayone.py
Created June 24, 2019 13:49
Creating_Series_Pandas_Way1
import pandas as pd
list_of_names = ["Ron","Jeremy","Rohit","Brian","Rich"]
roll_number = [1,2,3,4,5]
series = pd.Series(data=list_of_names,index=roll_number)
series
@pygaurav
pygaurav / Pandas_series_waytwo.py
Created June 24, 2019 13:55
Pandas series waytwo
import pandas as pd
dict_of_information = {
1:"Ron",
2:"Jeremy",
3:"Rohit",
4:"Brian",
500:"Rich"
}
@pygaurav
pygaurav / Pandas_series_default_way.py
Created June 24, 2019 14:23
Pandas_series_default_way
import pandas as pd
list_of_names = ["Ron","Jeremy","Rohit","Brian","Rich"]
series = pd.Series(data=list_of_names)
series
@pygaurav
pygaurav / pandas_series_addition_tryout.py
Created June 24, 2019 14:29
Pandas Series Addition Tryout
import pandas as pd
list_of_names_1 = ["Ron","Jeremy","Rohit","Brian","Rich"]
list_of_names_l = ["Harris","Brack","Shetty","Van","Cherodio"]
series1 = pd.Series(data=list_of_names)
series2 = pd.Series(data=list_of_names)
finalseries = series1+" "+series2
finalseries
@pygaurav
pygaurav / pandas_series_index_dissimilar.py
Created June 24, 2019 14:36
Pandas Series: Different Indexes
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)
@pygaurav
pygaurav / pandas_dataframes_part1.py
Last active June 24, 2019 15:36
Pandas Dataframe Part1
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)
@pygaurav
pygaurav / pandas_iris_dataset_import.py
Created June 24, 2019 16:04
Pandas - Reading a Iris Dataset
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()
@pygaurav
pygaurav / iris_describe.py
Created June 26, 2019 17:56
Pandas Iris Describe
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()
@pygaurav
pygaurav / dimension_dataframe.py
Created June 26, 2019 18:07
dimension dataframe
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
@pygaurav
pygaurav / basic_functions_pandas.py
Created June 26, 2019 18:20
Basic Functions Pandas
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))