Find Two Digits With Spaces

Fri 14 November 2025

title: "Find Two Digits with Spaces" author: "Raja CSP Raman" date: 2019-04-20 description: "-" type: technical_note draft: false


import re
text = "It happened on Feb 21 at 3:30"

answer= re.findall(r'\b\d{2}\b', text)
print(answer)
['21', '30']
# To match only two digits with spaces
answers = re …

Category: regex

Read More

Finnish-Translator

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]'
print(pyu.ps2("translate"))
translate==3.6.1
# !pip install translate==3.6.1
from translate import Translator

# Your contents
contents = [
    "Hello, how are you?",
    "I …

Category: mythraki

Read More

First-Four-Rows-Of-Csv

Fri 14 November 2025

title: "First Four Rows of CSV" author: "Rj" date: 2019-04-22 description: "-" type: technical_note draft: false


import numpy as np
import pandas as pd
df = pd.read_csv('data1.csv')
df
capacity score length …

Category: data-wrangling

Read More

Float-Error

Fri 14 November 2025
try:
    "soemthing".toFloat
except (ValueError, KeyError, AttributeError) as e:
    print('error : ', str(e))
    print(getattr(e, 'message', repr(e)))
error :  'str' object has no attribute 'toFloat'
AttributeError("'str' object has no attribute 'toFloat'")


Score: 0

Category: game20241121

Read More

Food-Csv-Github-Live

Fri 14 November 2025

# https://github.com/rajacsp/public-dataset/blob/master/food.csv
from io import BytesIO
import requests
import pandas as pd
FILEPATH = 'https://raw.githubusercontent.com/rajacsp/public-dataset/master/food.csv'
r = requests.get(FILEPATH)
data = r.content
data
b'Food_ID,Food_Name,Category,Price,Calories,Available\n1,Pizza,Fast Food,8.99 …

Category: pandas

Read More

Food-Plot

Fri 14 November 2025

title: "Food Plot" author: "Rj" date: 2019-05-06 description: "List Test" type: technical_note draft: false


import pandas as pd
import numpy as np
abc = np.array([
    [9, 13, 10],
    [7, 12, 9],
    [19, 11, 8],
    [12, 10, 11]
])
abc
array([[ 9, 13, 10],
       [ 7, 12,  9],
       [19, 11,  8],
       [12, 10 …

Category: plot

Read More

Food Points

Fri 14 November 2025

title: "Food Points" author: "Rj" date: 2019-04-24 description: "-" type: technical_note draft: false


import numpy as np
import pandas as pd
data = {
    'dinner' : ['chicken wrap', 'stake', 'rudy burger', 'sushi', 'chicken teriyaki', 'caesar salad']
}
df = pd.DataFrame(data)
df

Category: data-wrangling

Read More

Fourier-Transform

Fri 14 November 2025

title: "Fourier Transform" author: "Raja CSP Raman" date: 2019-05-06 description: "-" type: technical_note draft: false


from scipy.fftpack import fft
import numpy as np
x = np.array([1, 2, 3, 4])
x
array([1, 2, 3, 4])
y = fft(x)
y
array([10.+0.j, -2.+2.j, -2.+0.j …

Category: scipy

Read More

Frequency-Distribution

Fri 14 November 2025

title: "Frequeyncy Distribution" author: "Rj" date: 2019-04-29 description: "-" type: technical_note draft: false


# https://www.azlyrics.com/lyrics/fifthharmony/worthit.html
lyrics = """
Give it to me, I'm worth it
Baby, I'm worth it
Uh huh I'm worth it
Gimme gimme I'm worth it
Give it to me …

Category: textprocessing

Read More

Fspath Sample

Fri 14 November 2025

import os

class MyPath:
    def __init__(self, path):
        self.path = path

    def __fspath__(self):
        return self.path
p = MyPath("example.txt")

# Python will call __fspath__ internally
print(os.fspath(p))   # Output: example.txt

# You can now use it directly with file operations
# with open(p, "w") as f:
#     f.write …

Category: dunder_methods

Read More
Page 103 of 146

« Prev Next »