Text-To-Vector

Fri 14 November 2025

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


import nltk
content = "The Democrats — including more than 50 freshmen — are mindful that impeachment poses political risks that could endanger the seats of moderates and their majority, as well as strengthen Mr. Trump’s hand. "
content
'The …

Category: textprocessing

Read More

Textblob-Classifier-2

Fri 14 November 2025

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


from textblob.classifiers import NaiveBayesClassifier
from textblob import TextBlob
train = [
     ('I love this sandwich.', 'pos'),
     ('this is an amazing place!', 'pos'),
     ('I feel very good about these beers.', 'pos'),
     ('this is my best work.', 'pos'),
     ("what an …

Category: textprocessing

Read More

Three

Fri 14 November 2025
from IPython.display import Markdown, display

# Path to your PNG file
image_path = 'deer.jpg'

# Display the image inline
display(Markdown(f"![Image Description]({image_path})"))

Image Description



Score: 0

Category: one

Read More

Time With Periods

Fri 14 November 2025

title: "Time With Periods" author: "Rj" date: 2019-04-20 description: "-" type: technical_note draft: false


import pandas as pd
times = pd.date_range('2000-01-01', periods=4)

print(times)
DatetimeIndex(['2000-01-01', '2000-01-02', '2000-01-03', '2000-01-04'], dtype='datetime64[ns]', freq='D')
for time in times:
    print(time)
2000-01-01 00:00:00
2000-01-02 …

Category: basics

Read More

Timeit-Simple

Fri 14 November 2025

title: "Timeit Simple" author: "Rj" date: 2019-04-24 description: "-" type: technical_note draft: false


import timeit
import numpy as np
def add(x, y):
    return x + y
repeat_number = 100000
e = timeit.repeat(
    stmt='''add(a, b)''', 
    setup='''a=2; b=3;from __main__ import add''', 
    repeat=3,
    number=repeat_number)
print('Method: {}, Avg …

Category: basics

Read More

Timeit-Simple-2

Fri 14 November 2025

title: "Timeit Simple 2" author: "Rj" date: 2019-04-20 description: "-" type: technical_note draft: false


import timeit
def some_function():
    return map(lambda x: x^2, range(10))
time1 = timeit.timeit(some_function)
print(time1)
0.39235781200113706
print(time1)
0.39235781200113706

Score: 5

Category: basics

Read More

Tinkerball-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

Tips-Seaborn

Fri 14 November 2025
!python --version
Python 3.10.5
import seaborn as sns
import matplotlib.pyplot as plt
import pandas as pd
# Load the dataset
tips = sns.load_dataset("tips")
# Create a PairGrid with regression and histogram plots
g = sns.PairGrid(tips, diag_sharey=False, hue="sex", palette="Set2")
g.map_upper(sns.scatterplot, alpha=0 …

Category: seaborn

Read More

Titanic

Fri 14 November 2025
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.tree import DecisionTreeClassifier, export_graphviz
import pydotplus
from IPython.display import Image

# Load the Titanic dataset
url = "https://raw.githubusercontent.com/datasciencedojo/datasets/master/titanic.csv"
titanic = pd.read_csv(url)

# Preprocess the dataset
# Select features and target variable
features = ['Pclass …

Category: pydotplus

Read More

Titanic-Deepcheck-Analysis

Fri 14 November 2025
!python --version
Python 3.10.5
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.ensemble import RandomForestClassifier
from sklearn.preprocessing import LabelEncoder
from deepchecks.tabular import Dataset
from deepchecks.tabular.suites import full_suite
# Load the Titanic dataset
url = "https://raw.githubusercontent.com/datasciencedojo/datasets/master/titanic.csv …

Category: deepchecks

Read More
Page 138 of 146

« Prev Next »