Python Code Samples



Filters


Python pandas dataframe select two records for each value of a column using group by
kishore_kumar | 5 years, 2 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
get all meta tags content from a url using python
kishore_kumar | 7 years, 6 months
#This can be done using BeautifulSoup package
import requests
from bs4 import BeautifulSoup
python bs4 beautifulsoup
Listing contents of a bucket with boto3
Reshma | 7 years
import boto3

_BUCKET_NAME = 'Bucket_name'
boto3 files s3 bucket
Matplotlib create a bar chart in python
kishore_kumar | 7 years, 10 months
import matplotlib.pyplot as plt

categories = ['Student', 'FreeLancer', 'Employee', 'Others']
python matplotlib
Python get last working day of the month
kishore_kumar | 4 years, 10 months
from datetime import datetime
import calendar

python datetime
How to get image width and height using python
kishore_kumar | 7 years, 1 month
from PIL import Image

im = Image.open('my_image.png')
python python-pil
How to get first day of the month in python
kishore_kumar | 4 years, 8 months
from datetime import datetime

first_day = datetime.today().date().replace(day=1)
python datetime
Threading in python basic example - create a Thread
kishore_kumar | 7 years, 9 months
import threading
import time

python threading
Promise Chaining in nodejs
harika | 6 years, 12 months
const mul = (a, b) => {
  return new Promise((resolve, reject)=> {
    setTimeout(()=>{
nodejs python async
How to get full path of python module file and directory
kishore_kumar | 7 years, 1 month
import os

if __name__ == '__main__':
python python-os
Prev Next