Python Code Samples



Filters


Create a line chart using python matplotlib
kishore_kumar | 7 years, 3 months
import matplotlib.pyplot as plt

t = ['12-03-18','12-04-18' , '12-05-18', '12-06-18', '12-07-18']
python matplotlib
Generate Pie Chart in python using matplotlib
kishore_kumar | 7 years, 3 months
import matplotlib.pyplot as plt

labels = 'Grapes', 'Oranges', 'Mangoes', 'Apples'
python matplotlib
How to combine two query sets in Django ORM
kishore_kumar | 6 years, 5 months
q1 = Task.objects.filter(id__lt=4)
q2 = Task.objects.filter(completed=True)

python django django-orm
Using python generator for finding factors
kishore_kumar | 6 years, 7 months
def get_factors(num):
    i = 1
    while i * i < num:
python generator factors
Python pickle dump
Reshma | 6 years, 2 months
import pickle

number_of_data = int(input('Enter the number of data : '))
python pickle dump
get time between dates for each day
kishore_kumar | 2 years, 4 months
from datetime import datetime, timedelta


python datetime
How to get Django avatar in views or models
kishore_kumar | 7 years, 1 month
django.contrib.auth.models import User
from avatar.templatetags.avatar_tags import avatar_url

python django-avatar
Ramya
Indexed DataFrames using Arrays
Ramya | 6 years, 7 months
import pandas as pd
data = {'Subject':['Maths', 'Science', 'English'],'Marks':[70,80,90]}
df = pd.
python pandas dataframe
how to log full traceback using python logging
kishore_kumar | 6 years, 5 months
import logging
  
logging.basicConfig(format='%(asctime)s - %(levelname)s - %(message)s', datefmt=
python logging
round a floating point number in python
kishore_kumar | 7 years, 3 months
my_number = 123.83725

print round(my_number, 2) # 123.84
python
Prev Next