Randomized-Search

Sun 29 June 2025
import pyutil as pyu
pyu.get_local_pyinfo()
'conda env: C:\\Users\\Afia Jahan\\anaconda3\\envs\\py312; pyv: 3.12.11 | packaged by Anaconda, Inc. | (main, Jun  5 2025, 12:58:53) [MSC v.1929 64 bit (AMD64)]'
import pandas as pd
from sklearn.ensemble import RandomForestClassifier
from sklearn.model_selection import train_test_split …

Category: basics

Read More

Read-From-Github-Live

Sun 29 June 2025
import requests
import pandas as pd
from io import BytesIO
FILEPATH = 'https://raw.githubusercontent.com/rajacsp/public-dataset/master/zynicide-wine-reviews/winemag-data-130k-v2.csv'
response = requests.get(FILEPATH)
data = response.content
onlinedata = BytesIO(data)
df = pd.read_csv(onlinedata, index_col=0)
df.head(2)

Category: basics

Read More

Reduce

Sun 29 June 2025
from functools import reduce
def add(a, b): 
    return a + b
add(10, 15)
25
reduce(add, [10, 20, 30, 40])
100


Score: 5

Category: basics

Read More

Remove-Item-On-Loop

Sun 29 June 2025
list = [
    1, 2, 3, 4, 5, 6
]
for i, j in enumerate(list):
    print(i, j)
0 1
1 2
2 3
3 4
4 5
5 6
for i, j in enumerate(list):
    if(j % 2 == 0):
        del list[i]
list
[1, 3, 5]
# Short form
new_list = [x for …

Category: basics

Read More

Remove-Num

Sun 29 June 2025
content = '15. TFRecord in Tensorflow'
content
'15. TFRecord in Tensorflow'
import re
result = re.sub(r'\d+\.', '', content)
result.strip()
'TFRecord in Tensorflow'
content2 = """1. Cross Entropy Loss Derivation

2. How to split a tensorflow model into two parts?

3. RNN Text Generation with Eager Execution

4. Softmax activation in …

Category: basics

Read More

Runnable-Lambda

Sun 29 June 2025
!pip install langchain langchain-openai
Collecting langchain
  Downloading langchain-0.3.26-py3-none-any.whl.metadata (7.8 kB)
Collecting langchain-openai
  Downloading langchain_openai-0.3.26-py3-none-any.whl.metadata (2.3 kB)
Collecting langchain-core<1.0.0,>=0.3.66 (from langchain)
  Downloading langchain_core-0 …

Category: basics

Read More

Scipy

Sun 29 June 2025
# 1. Import scipy
import scipy
print("SciPy version:", scipy.__version__)
SciPy version: 1.13.1
# 2. Use scipy.constants to get pi
from scipy.constants import pi
print("Value of pi:", pi)
Value of pi: 3.141592653589793
# 3. Speed of light
from scipy.constants import c
print("Speed of light …

Category: basics

Read More

Seaborn-Pynotes-Growth

Sun 29 June 2025
!pip install seaborn
Requirement already satisfied: seaborn in c:\users\afia jahan\anaconda3\envs\py312\lib\site-packages (0.13.2)
Requirement already satisfied: numpy!=1.24.0,>=1.20 in c:\users\afia jahan\anaconda3\envs\py312\lib\site-packages (from seaborn) (1.26.4)
Requirement already satisfied: pandas …

Category: basics

Read More

Seabornflightdataanalysis

Sun 29 June 2025
import seaborn as sns
import pandas as pd
import matplotlib.pyplot as plt
flights = sns.load_dataset("flights")
flights.head()
year month passengers
0 1949 Jan 112
1 1949 Feb 118
2 1949 …

Category: basics

Read More

Sentiment

Sun 29 June 2025
import nltk
nltk.download('vader_lexicon')
[nltk_data] Downloading package vader_lexicon to C:\Users\Afia
[nltk_data]     Jahan\AppData\Roaming\nltk_data...





True
from nltk.sentiment.vader import SentimentIntensityAnalyzer
sid = SentimentIntensityAnalyzer()
import json
from pprint import pprint
from nltk.sentiment.vader import SentimentIntensityAnalyzer
import numpy as np
import matplotlib.pyplot as plt
import pandas …

Category: basics

Read More
Page 6 of 7

« Prev Next »