<jupyter_start><jupyter_text>**PANDAS**<jupyter_code>import numpy as np
import pandas as pd
dict1={
    "name":['rohan','pooja','diya','abhi'],
    "marks":[25,45,78,39],
    "city":['delhi','mumbai','chennai','goa']
}
df=pd.DataFrame(dict1)
df
df.to_csv('friends.csv')
df.to_csv('friends_index_false.csv',index=False)
df.head(2)
df.tail(1)
df.describe()
train=pd.read_csv('train_details.csv')

train
train['speed']
train['speed'][0]
train['speed'][0]=48
train
train.to_csv('train_details.csv',index=False)
train.index=['a','b','c','d','e']
train
ser=pd.Series(np.random.rand(20))
ser
type(ser)
df1=pd.DataFrame(np.random.rand(150,4))
df1
type(df1)
df1.describe()
df1.dtypes
df1[0][0]='hello'
df1.dtypes
df1.head()
df1.index
df1.columns
df1.to_numpy()
df1.T
df1.head()
df1.sort_index(axis=0,ascending=False)
df1.sort_index(axis=1,ascending=False)
df1.head()
df1[0]
type(df1[0])
df2=df1
df1[0][0]=64

df1
df1.loc[0,0]=456
df1
df1.drop(3 ,axis=1)
df1.loc[[145,146],[0,1]]
df1.loc[[0,1],:]
df1.loc[(df1[0]>0.6 )& (df1[0]<0.8)]
df1.head(2)
df1.iloc[1,2]
df1.iloc[[0,1],[1,2]]
df1.head(5)
df1.drop([3],axis=1)
df1
df1.drop([3],axis=1,inplace=True)
df1
df1.head(5)
df1.drop([2])
df1.reset_index(drop=True,inplace=True)
df1.head(3)
df1[1].isnull()
df1.loc[2]=None
df1
df1.loc[:,[2]]=46
df1
df = pd.DataFrame({"name": ['Alfred', 'Batman', 'Batman'],
                   "toy": [np.nan, np.nan, np.nan],
                   "born": [pd.NaT, pd.Timestamp("1940-04-25"),
                            pd.NaT]})
df.head()
df.dropna(how='all',axis=1)
df.drop_duplicates(subset='name')
df.shape
df.info()
df['name'].value_counts(dropna=False)
df.notnull()
df.isnull()
data = pd.read_excel('newtraindetals.xlsx')
data
data1=pd.read_excel('newtraindetals.xlsx',sheet_name='Sheet2')
data1
data1.iloc[0,2]='london'
data1
data.to_excel('Workbook.xlsx', sheet_name="work1")
with pd.ExcelWriter('Workbook.xlsx') as writer:  
    data.to_excel(writer, sheet_name='Sheet_1')
    data1.to_excel(writer, sheet_name='Sheet_2')<jupyter_output><empty_output>
StarcoderdataJupyterStructuredCleanDedup