Sine-Map
Fri 14 November 2025
from bokeh.plotting import figure, output_file, show
from bokeh.io import output_notebook
from bokeh.models import ColumnDataSource
# Set Bokeh output to notebook
output_notebook()
Category: bokeh
Read More
from bokeh.plotting import figure, output_file, show
from bokeh.io import output_notebook
from bokeh.models import ColumnDataSource
# Set Bokeh output to notebook
output_notebook()
Category: bokeh
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
from abc import ABC …Category: mythraki
Read Moretitle: "Skip a single row" author: "Rj" date: 2019-04-22 description: "-" type: technical_note draft: false
import numpy as np
import pandas as pd
df = pd.read_csv('abc.csv')
df
| student | language | science | maths … |
|---|
Category: data-wrangling
Read Moretitle: "Skip Multiple Rows" author: "Rj" date: 2019-04-22 description: "-" type: technical_note draft: false
import numpy as np
import pandas as pd
df = pd.read_csv('abc.csv')
df
| student | language | science | maths | history … |
|---|
Category: data-wrangling
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 Moretitle: "Snowball Stemmer" author: "Rj" date: 2019-04-21 description: "-" type: technical_note draft: false
from nltk.stem.snowball import SnowballStemmer
words = [
"hunting",
"bunnies",
"thinking"
]
words
['hunting', 'bunnies', 'thinking']
stemmer = SnowballStemmer("english")
result = [stemmer.stem(word) for word in words]
result
['hunt', 'bunni', 'think']
Score: 5
Category: textprocessing
Read Moretitle: "Sort Dictionary By Value" author: "Rj" date: 2019-04-20 description: "List Test" type: technical_note draft: false
dict = {
'one' : 8,
'two' : 1,
'three' : 12
}
dict
{'one': 8, 'three': 12, 'two': 1}
import operator
sorted_x = sorted(dict.items(), key=operator.itemgetter(1))
sorted_x
[('two', 1), ('one', 8), ('three', 12)]
type(sorted_x)
list …Category: basics
Read Moretitle: "Sort Map By Key" author: "Rj" date: 2019-04-20 description: "List Test" type: technical_note draft: false
print('Hello Toronto')
Hello Toronto
def sort_by_key(dict):
'''
::getRemotrAddr
'''
'''
for key, value in sorted(dict.iteritems(), key=lambda(k,v): (v,k)):
print("%s: %s" % (key, value))
'''
for key in sorted(dict.keys()):
print …Category: basics
Read Moretitle: "Sort Map by Value" author: "Rj" date: 2019-04-20 description: "List Test" type: technical_note draft: false
def sort_by_value(dict):
'''
'''
age_sorted = sorted(dict.items(), key=lambda x:x[1])
#print(age_sorted)
return age_sorted
age = {
'carl':40,
'alan':2,
'bob':1,
'danny':3
}
age_sorted = sort_by_value(age)
age_sorted
[('bob', 1), ('alan', 2), ('danny …Category: basics
Read More