Remove Numbers
Sat 17 May 2025
title: "Remove Numbers" author: "Rj" date: 2019-04-20 description: "List Test" type: technical_note draft: false
Score: 0
Category: basics
Read Moretitle: "Remove Numbers" author: "Rj" date: 2019-04-20 description: "List Test" type: technical_note draft: false
Score: 0
Category: basics
Read Moretitle: "Remove th From Date" author: "Rj" date: 2019-04-20 description: "List Test" type: technical_note draft: false
from datetime import datetime
import re
content = 'Sunday, May 18th, 2019'
content
'Sunday, May 18th, 2019'
d = datetime.strptime(re.sub('(\d+)(st|nd|rd|th)', '\g<1>', content), '%A, %B %d, %Y')
d …Category: basics
Read Moreollama_host = "http://localhost:8080"
Score: 0
Category: basics
Read Moretitle: "Reverse User Input" author: "Rj" date: 2019-04-20 description: "-" type: technical_note draft: false
def reverse_string(content):
return content[::-1]
city = input("Enter Your City : ")
Enter Your City : Toronto
reverse_string(city)
'otnoroT'
Score: 0
Category: basics
Read More
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("haystack-ai ollama-haystack python-dotenv"))
haystack-ai==2.8.0
ollama-haystack is not installed in the current environment.
python-dotenv==0.21.0
def format_time(seconds):
hours …Category: basics
Read Moretitle: "Simple Entropy" author: "Rj" date: 2019-04-20 description: "-" type: technical_note draft: false
import math
from collections import Counter
import timeit
import numpy as np
def eta(data, unit='natural'):
base = {
'shannon' : 2.,
'natural' : math.exp(1),
'hartley' : 10.
}
if len(data) <= 1:
return 0
counts = Counter()
for d in data …Category: basics
Read Moretitle: "Simple Test" author: "Raja CSP Raman" date: 2019-04-20 description: "-" type: technical_note draft: false
print("This is simple test")
This is simple test
28
Score: 5
Category: basics
Read Moretitle: "Simple Test 2" author: "Raja CSP Raman" date: 2019-04-20 description: "-" type: technical_note draft: false
print("This is simple test 2")
This is simple test 2
Score: 0
Category: basics
Read Moretitle: "Sleep" author: "Rj" date: 2019-05-20 description: "-" type: technical_note draft: false
import time
print('One')
print('Waiting for 3 seconds')
time.sleep(3)
print('Two')
One
Waiting for 3 seconds
Two
Score: 0
Category: basics
Read Moretitle: "Slice Array" author: "Rj" date: 2019-04-20 description: "List Test" type: technical_note draft: false
a = [
10, 20, 30, 40, 50, 60, 70, 80, 90
]
a
[10, 20, 30, 40, 50, 60, 70, 80, 90]
type(a)
list
a[4:8]
[50, 60, 70, 80]
a[:4]
[10, 20, 30, 40 …Category: basics
Read More