Python Code Samples



Filters


Get User Presence of Slack user with slack api and python
kishore_kumar | 5 years, 5 months
from slackclient import SlackClient

user_token = "xoxp-2284524168-327340147858-399021736478-b7ed2
python slack-api
Get system hostname using python
kishore_kumar | 3 years, 8 months
import socket
print(socket.gethostname())

python socket
Python pandas dataframe select two records for each value of a column using group by
kishore_kumar | 3 years, 4 months
df = pd.DataFrame({'id':[1,1,1,2,2,2,3,3,3,4,4,4], 'value': ['one','two','three','one','two','three'
python dataframe
convert all dataframe column names to lower case
kishore_kumar | 5 years, 2 months
import pandas as pd

data = [['Alex',10],['Bob',12],['Clarke',13]]
python pandas
conditional selection with numpy arrays
kishore_kumar | 6 years, 1 month
import numpy as np
ser_arr = np.arange(1,10)
mat1 = ser_arr.reshape(3,3)
numpy python
Create a dataframe in pandas with lists
harika | 5 years, 8 months
import pandas as pd
data = [['Alex',10],['Bob',12],['Clarke',13]]
df = pd.DataFrame(data,columns=[
python pandas list
Promise Chaining in nodejs
harika | 5 years, 1 month
const mul = (a, b) => {
  return new Promise((resolve, reject)=> {
    setTimeout(()=>{
nodejs python async
Create a dataframe in pandas with dictionary
harika | 5 years, 8 months
import pandas as pd
name_dataset = pd.DataFrame({
    "city": ["Bangalore", "Hyderabad", "Chennai"
python pandas
How to get full path of python module file and directory
kishore_kumar | 5 years, 2 months
import os

if __name__ == '__main__':
python python-os
Crating a bucket in S3 using boto3
Reshma | 5 years, 2 months
import boto3
sess = Session(aws_access_key_id='aws_key',
            aws_secret_access_key='aws_se
boto3 s3 create bucket
Prev Next