Python Code Samples



Filters


Generate Pie Chart in python using matplotlib
kishore_kumar | 6 years, 2 months
import matplotlib.pyplot as plt

labels = 'Grapes', 'Oranges', 'Mangoes', 'Apples'
python matplotlib
Draw a basic plot using matplotlib
harika | 6 years
import matplotlib.pyplot as plt
import numpy as np
ar = np.arange(0, 5, 0.2)
python matplotlib
Ramya
Indexed DataFrames using Arrays
Ramya | 5 years, 6 months
import pandas as pd
data = {'Subject':['Maths', 'Science', 'English'],'Marks':[70,80,90]}
df = pd.
python pandas dataframe
Text identification in the image using google vision API with python
kishore_kumar | 5 years, 10 months
from google.cloud import vision
from google.cloud.vision import types

python google vision
How to combine two query sets in Django ORM
kishore_kumar | 5 years, 5 months
q1 = Task.objects.filter(id__lt=4)
q2 = Task.objects.filter(completed=True)

python django django-orm
convert string to python datetime object
kishore_kumar | 5 years, 6 months
import datetime

st = "2019-08-19 05:40"
python datetime
round a floating point number in python
kishore_kumar | 6 years, 2 months
my_number = 123.83725

print round(my_number, 2) # 123.84
python
Python logging basic example to print from debug
kishore_kumar | 5 years, 5 months
import logging
logging.basicConfig(level=logging.DEBUG)

python logging
unzip file from gz files using python
kishore_kumar | 5 years, 4 months
import gzip
import shutil
with gzip.open('my_file.gz', 'rb') as f_in:
python gzip
Ramya
Indexed DataFrame using list of dictionaries
Ramya | 5 years, 6 months
import pandas as pd
data = [{'Python': 90, 'C': 84,'java':65},{'Python': 78, 'C': 90, 'java': 65}]
python pandas dataframe
Prev Next