Pandas Code Samples



Filters


Ramya
DataFrame Row Selection, Addition,Slicing and Deletion
Ramya | 4 years, 8 months
import pandas as pd
d = {'One':pd.Series([1,2,3],index=['a','b','c']),'Two':pd.Series([4,5,6],index
python pandas dataframe
Rename columns in pandas python dataframe
kishore_kumar | 3 years, 5 months
import pandas as pd

data = [['Alex',10],['Bob',12],['Clarke',13]]
python pandas
convert all dataframe column names to lower case
kishore_kumar | 4 years, 7 months
import pandas as pd

data = [['Alex',10],['Bob',12],['Clarke',13]]
python pandas
Create a dataframe in pandas with lists
harika | 5 years, 1 month
import pandas as pd
data = [['Alex',10],['Bob',12],['Clarke',13]]
df = pd.DataFrame(data,columns=[
python pandas list
Create a dataframe in pandas with dictionary
harika | 5 years, 1 month
import pandas as pd
name_dataset = pd.DataFrame({
    "city": ["Bangalore", "Hyderabad", "Chennai"
python pandas
Ramya
Indexed DataFrames using Arrays
Ramya | 4 years, 8 months
import pandas as pd
data = {'Subject':['Maths', 'Science', 'English'],'Marks':[70,80,90]}
df = pd.
python pandas dataframe
Ramya
DataFrame with dict of series
Ramya | 4 years, 8 months
import pandas as pd
d = {'One':pd.Series([1,2,3],index=['a','b','c']),'Two':pd.Series([4,5,6],index
python pandas dataframe
Ramya
Indexed DataFrame using list of dictionaries
Ramya | 4 years, 8 months
import pandas as pd
data = [{'Python': 90, 'C': 84,'java':65},{'Python': 78, 'C': 90, 'java': 65}]
python pandas dataframe