country_grp['Salary'].median().loc['Germany'] Germany country looking for the Salary
country_uses_python = country_grp['LanguageWorkedWith'].apply(lambda x: x.str.contains('Python').sum())
where Python word contains
where Python word contains
df.apply(len, axis='columns')
df['email'].apply(len)
len(df['email'])
df['email'].apply(len)
len(df['email'])
df['full_name'] = df['first'] + '' + df['last']
adding columsn
adding columsn
df.drop(columns = ['first', ' last'], inplace = True)
removing column
removing column
df[['first', 'last']] = df['full_name'].str.split(' ', expand = True)
mergin two columns as one
mergin two columns as one
df.dropna(axis ='index', how ='all', subset=['last', 'email'])
droping null values with specfiying indexes
droping null values with specfiying indexes
df['age'] = df['age'].astype(float)
working with missing values
working with missing values
Forwarded from Khafizullo
and I used my date column to united to seconds because what it was needed then decided to use what columns need i
Forwarded from Khafizullo
when using groupby do not forget to use as_index
df['date'] = pd.to_datetime(df.date, dayfirst=True)
# df['month'] = df['date'].dt.month
# df['month_year'] = df['full_datetime'].dt.strftime('%m-%Y')
# df['date'] = df['date'].dt.to_period('M')
when working with dates
# df['month'] = df['date'].dt.month
# df['month_year'] = df['full_datetime'].dt.strftime('%m-%Y')
# df['date'] = df['date'].dt.to_period('M')
when working with dates
x = np.array([-1,0,1.4],dtype='bool')
y = np.array([-1,0,1.4],dtype='int16')
z = np.array([-1,0,1.4],dtype='float64')
it says boolean works faster
y = np.array([-1,0,1.4],dtype='int16')
z = np.array([-1,0,1.4],dtype='float64')
it says boolean works faster
x = np.array([0,0,0],dtype='uint8')
x[0] = 255
x[1] = x[0] + 1
x[2] = x[1] + 1
print(x)
it means uint8 contains only 255 character
x[0] = 255
x[1] = x[0] + 1
x[2] = x[1] + 1
print(x)
it means uint8 contains only 255 character
x = np.array([-1,0,1,10],dtype='float64')
print( x / 0 )
y = 10 / 0 # core Python
-inf nan inf inf it says when dividing 0 to 0
print( x / 0 )
y = 10 / 0 # core Python
-inf nan inf inf it says when dividing 0 to 0