Address-Classification

Fri 14 November 2025
from gliner import GLiNER
# Initialize GLiNER with a pre-trained model
model = GLiNER.from_pretrained("urchade/gliner_medium-v2.1")  # Adjust model as needed
Fetching 5 files:   0%|          | 0/5 [00:00<?, ?it/s]


/home/rajaraman/miniconda3/envs/ml312/lib/python3.12/site-packages/transformers/convert_slow_tokenizer.py:562: UserWarning: The sentencepiece tokenizer that you …

Category: gliner

Read More

Adjective-Collector

Fri 14 November 2025

title: "Adjective Collector" author: "Rj" date: 2019-04-20 description: "List Test" type: technical_note draft: false


import requests
from bs4 import BeautifulSoup
page = requests.get('https://www.enchantedlearning.com/wordlist/adjectivesforpeople.shtml')
soup = BeautifulSoup(page.text, 'html.parser') 
items = soup.select('div.wordlist-item')

item_list = ''
for item in items:
    #print(item.get_text())
    item_list …

Category: webreader

Read More

Advanced-Custom-Lambda

Fri 14 November 2025

title: "Advanced Custom Lambda" author: "Rj" date: 2019-04-22 description: "-" type: technical_note draft: false


import numpy as np
import pandas as pd
# Check the student passed either math or passed at least in 2 subjects. If no condidition matched, consider them as failed
def pass_math_or_two_subjects(row):
    if(row.maths > 34):
        return …

Category: data-wrangling

Read More

Age-Calculator

Fri 14 November 2025
from datetime import datetime
def get_age(d):
    d1 = datetime.now()
    months = (d1.year - d.year) * 12 + d1.month - d.month

    year = int(months / 12)
    return year
age = get_age(datetime(1991, 1, 1))
age
33


Score: 5

Category: basics

Read More

Append-To-Existing-Dictionary

Fri 14 November 2025

title: "Append To Existing Dictionary" author: "Raja CSP Raman" date: 2019-05-02 description: "-" type: technical_note draft: false


import gensim
from gensim import corpora
from pprint import pprint
# How to create a dictionary from a list of sentences?
documents = [
        """More than half of survey participants also reported clicking on a headline expecting …

Category: gensim-samples

Read More

Apply Custom Function

Fri 14 November 2025

title: "Apply Custom Function" author: "Rj" date: 2019-04-20 description: "List Test" type: technical_note draft: false


import pandas as pd
data = {
    'city' : ['Toronto', 'Montreal', 'Waterloo'],
    'points' : [80, 70, 90]
}
data
{'city': ['Toronto', 'Montreal', 'Waterloo'], 'points': [80, 70, 90]}
type(data)
dict
df = pd.DataFrame(data)
df

Category: data-wrangling

Read More

Apply-Custom-Lamdba-Function

Fri 14 November 2025
import numpy as np
import pandas as pd
data = {
    'city' : ['Toronto', 'Montreal', 'Waterloo'],
    'points' : [80, 70, 90]
}
data
{'city': ['Toronto', 'Montreal', 'Waterloo'], 'points': [80, 70, 90]}
type(data)
dict
df = pd.DataFrame(data)
df

Category: pandas

Read More

Apply-Function

Fri 14 November 2025
import pandas as pd
data = {
    'city' : ['Toronto', 'Montreal', 'Waterloo', 'Toronto', 'Waterloo', 'Toronto', 'Toronto'],
    'points' : [80, 70, 90, 85, 79, 82, 200]
}
data
{'city': ['Toronto',
  'Montreal',
  'Waterloo',
  'Toronto',
  'Waterloo',
  'Toronto',
  'Toronto'],
 'points': [80, 70, 90, 85, 79, 82, 200]}
type(data)
dict
df = pd.DataFrame(data)
df

Category: pandas

Read More

Apply Function-2933

Fri 14 November 2025

title: "Apply Function" author: "Rj" date: 2019-04-20 description: "List Test" type: technical_note draft: false


import pandas as pd
data = {
    'city' : ['Toronto', 'Montreal', 'Waterloo', 'Toronto', 'Waterloo', 'Toronto', 'Toronto'],
    'points' : [80, 70, 90, 85, 79, 82, 200]
}
data
{'city': ['Toronto',
  'Montreal',
  'Waterloo',
  'Toronto',
  'Waterloo',
  'Toronto',
  'Toronto'],
 'points': [80, 70, 90, 85, 79 …

Category: data-wrangling

Read More

Argotranslate-1

Fri 14 November 2025

import pyutil as pyu
pyu.get_local_pyinfo()
'conda env: ml311; pyv: 3.11.10 (main, Oct  3 2024, 07:29:13) [GCC 11.2.0]'
# !pip install argostranslate
print(pyu.ps2("argostranslate"))
argostranslate==1.9.6

import argostranslate.package
import argostranslate.translate

# Download and install the Finnish language package
from_code = "en …

Category: mythraki

Read More
Page 85 of 146

« Prev Next »