Sort Rows

Fri 14 November 2025

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


import pandas as pd
data = {
    'language' : [80, 67, 90],
    'maths' : [100, 78, 98],
    'science' : [98, 77, 56],
    'programming': [100, 100, 90]
}

index = ['chris', 'kevin', 'peter']
df = pd.DataFrame(data, index = index)
df

Category: data-wrangling

Read More

Space-Removal-Df

Fri 14 November 2025

import pandas as pd
FILEPATH = "../countries-of-the-world.csv"
df = pd.read_csv(FILEPATH)
df.head(2)
Country Region Population Area (sq. mi.) Pop. Density (per sq. mi.) Coastline (coast/area ratio) Net migration Infant …

Category: pandas

Read More

Spacey-Army-Questions

Fri 14 November 2025
!python --version
Python 3.12.4
from constants import OPENAI_API_KEY
!pip show langchain-openai | grep "Version:"
Version: 0.2.9
import os
os.environ["OPENAI_API_KEY"] = OPENAI_API_KEY
from langchain_openai import ChatOpenAI

model = ChatOpenAI(model="gpt-4o-mini")
# https://python.langchain.com/docs/how_to/passthrough/
content = """
In the distant future, a group of courageous …

Category: langchain

Read More

Specific Pattern 1

Fri 14 November 2025

title: "Specific Pattern 1" author: "Raja CSP Raman" date: 2019-04-20 description: "-" type: technical_note draft: false source: https://stackoverflow.com/questions/56232268/extract-word-form-string-using-regex-word-boundaries-in-python


import re
fn = "DC_QnA_bo_v.15.12.3_DE_duplicates.xlsx"
rgx = re.compile('\b_[A-Z]{2}\b')
print(re.findall(rgx, fn))
[]
rgx = re.compile('(?<=_)[A-Z]+(?=_)')
print …

Category: regex

Read More

Speech-2-Text

Fri 14 November 2025

title: "Speech 2 Text" author: "Rj" date: 2019-04-21 description: "-" type: technical_note draft: false


import speech_recognition as sr
def startpy():

    # obtain audio from the microphone
    r = sr.Recognizer()
    d= ''
    while (d!='exit' and d!='quit'):
        with sr.Microphone() as source:
            print("Say something!")
            audio = r.listen(source)

    # recognize speech using Google …

Category: textprocessing

Read More

Split-And-Get-First

Fri 14 November 2025

UNDERSCORE = "_"
feature_value_map_for_score = {
  "system_businessname_overlapLevenshtein": 0.5,
  "system_address_overlapLevenshtein": 1.0,
  "system_streetname_overlapLevenshtein": 1.0,
  "system_city_overlapLevenshtein": 1.0,
  "system_zipcode_overlapLevenshtein": 1.0,
  "system_businessname_sorensen": 0.56,
  "system_address_sorensen": 1.0,
  "system_streetname_sorensen": 1.0,
  "system_city_sorensen": 1.0,
  "system_region_sorensen": 1.0,
  "system_houseno_exactMatch": 1.0,
  "system_zipcode_ratcliff": 1.0,
  "system_suiteno_exactMatch": 1.0
}
individual_algo_feature_score_map = {
  "system_businessname": {
    "system_businessname_overlapLevenshtein": 0.5,
    "system_businessname_sorensen": 0.56 …

Category: basics

Read More

Split Frame

Fri 14 November 2025

title: "If Else Pandas" author: "Rj" date: 2019-04-24 description: "-" type: technical_note draft: false source: http://pandas.pydata.org/pandas-docs/version/0.24/user_guide/cookbook.html#idioms


import numpy as np
import pandas as pd
df = pd.DataFrame({
    'maths' : [80, 89, 90, 20],
    'science' : [40, 50, 90, 100],
    'language' : [20, 30 …

Category: data-wrangling

Read More

Split With Multiple Delim

Fri 14 November 2025

title: "Split with Multiple" author: "Rj" date: 2019-04-20 description: "List Test" type: technical_note draft: false


import re
content = "Hey, you - what are you doing here!?"
contents = re.findall(r"[\w']+", content)
contents
['Hey', 'you', 'what', 'are', 'you', 'doing', 'here']
for c in contents:
    print(c)
Hey
you
what
are
you …

Category: basics

Read More

Stack

Fri 14 November 2025

author: "Raja CSP Raman" date: 2019-05-07 description: "-" type: technical_note draft: false


import tensorflow as tf

import os

# Just disables the warning, doesn't enable AVX/FMA
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
a = tf.constant([1, 2])
b = tf.constant([3, 4])
c = tf.constant([10, 20])
a
<tf.Tensor 'Const_12:0 …

Category: tensorflow-work

Read More
Page 133 of 146

« Prev Next »