Python Code Samples



Filters


Ramya
DataFrame with dict of series
Ramya | 5 years, 3 months
import pandas as pd
d = {'One':pd.Series([1,2,3],index=['a','b','c']),'Two':pd.Series([4,5,6],index
python pandas dataframe
how to extract text content from pdf file using python
kishore_kumar | 5 years, 9 months
from tika import parser # pip install tika

process = parser.from_file('/path/to/my.pdf')
python tika
How to access django models in stand alone python script without manage.py
kishore_kumar | 5 years, 1 month
import os
import django

python django
Image labels detection using google Vision API in python
kishore_kumar | 5 years, 9 months
from google.cloud import vision
from google.cloud.vision import types

If you setup env variable with export GOOGLE_APPLICATION_CREDENTIALS="/file/creds.json" then you ca
python google vision
how to log full traceback using python logging
kishore_kumar | 5 years, 2 months
import logging
  
logging.basicConfig(format='%(asctime)s - %(levelname)s - %(message)s', datefmt=
python logging
How to dump data to a pickle file in python
harika | 5 years, 1 month
X_train = []
y_train = []
with open('train.pickle', 'wb') as f:
python pickle file
Ramya
While loop example in python
Ramya | 5 years, 4 months
i = 0
while (i < 3):     
    i = i+1
python
Ramya
Infinite While loop example in python
Ramya | 5 years, 4 months
i = 0
while (i < 3):     
    if(i==2):
python
Parsing JSON file
Reshma | 5 years, 3 months
import json
x='{"a":1,"b":2,"c":3}'
y=json.loads(x)
python json parsing
Python pickle load
Reshma | 4 years, 11 months
import pickle

# open a file,where we stored the pickle data
python load pickle
Prev Next