Python Code Samples



Filters


Draw a basic plot using matplotlib
harika | 7 years, 9 months
import matplotlib.pyplot as plt
import numpy as np
ar = np.arange(0, 5, 0.2)
python matplotlib
Create a line chart using python matplotlib
kishore_kumar | 7 years, 12 months
import matplotlib.pyplot as plt

t = ['12-03-18','12-04-18' , '12-05-18', '12-06-18', '12-07-18']
python matplotlib
convert string to python datetime object
kishore_kumar | 7 years, 3 months
import datetime

st = "2019-08-19 05:40"
python datetime
Generate Pie Chart in python using matplotlib
kishore_kumar | 8 years
import matplotlib.pyplot as plt

labels = 'Grapes', 'Oranges', 'Mangoes', 'Apples'
python matplotlib
Create a dataframe in pandas with lists
harika | 7 years, 9 months
import pandas as pd
data = [['Alex',10],['Bob',12],['Clarke',13]]
df = pd.DataFrame(data,columns=[
python pandas list
how to log full traceback using python logging
kishore_kumar | 7 years, 2 months
import logging
  
logging.basicConfig(format='%(asctime)s - %(levelname)s - %(message)s', datefmt=
python logging
Using python generator for finding factors
kishore_kumar | 7 years, 4 months
def get_factors(num):
    i = 1
    while i * i < num:
python generator factors
How to access django models in stand alone python script without manage.py
kishore_kumar | 7 years, 2 months
import os
import django

python django
Ramya
Indexed DataFrames using Arrays
Ramya | 7 years, 4 months
import pandas as pd
data = {'Subject':['Maths', 'Science', 'English'],'Marks':[70,80,90]}
df = pd.
python pandas dataframe
How to get Django avatar in views or models
kishore_kumar | 7 years, 10 months
django.contrib.auth.models import User
from avatar.templatetags.avatar_tags import avatar_url

python django-avatar
Prev Next