Args-Sample

Fri 14 November 2025

def print_everything(*args):
        for count, thing in enumerate(args):
            print( '{0}. {1}'.format(count, thing))
print_everything('apple', 'banana', 'cabbage', 'spinach')
0. apple
1. banana
2. cabbage
3. spinach


Score: 0

Category: basics

Read More

Argsmax

Fri 14 November 2025
import numpy as np
a = np.array(
    [
        [1,2,44,7], 
        [9,88,6,45], 
        [19,76,3,4]
    ]
)
a
array([[ 1,  2, 44,  7],
       [ 9, 88,  6, 45],
       [19, 76,  3,  4]])
a.size
12
a.shape
(3, 4)
a.ndim
2
np.argmax(a)
5
a.flatten()
array …

Category: numpy

Read More

Arima-1

Fri 14 November 2025
from pandas import read_csv
from datetime import datetime
from matplotlib import pyplot as plt
from pandas.plotting import autocorrelation_plot
from pandas import DataFrame
from statsmodels.tsa.arima.model import ARIMA

# Define the parser function
def parser(x):
    return datetime.strptime('190' + x, '%Y-%m')

# Read the dataset
series = read_csv(
    'shampoo-sales …

Category: arima

Read More

Arima-2

Fri 14 November 2025

https://machinelearningmastery.com/autoregression-models-time-series-forecasting-python/ https://datamarket.com/data/set/2324/daily-minimum-temperatures-in-melbourne-australia-1981-1990#!ds=2324&display=line https://stackoverflow.com/questions/31494870/pandas-dataframe-no-numeric-data-to-plot-error https://en.wikipedia.org/wiki/Pearson_correlation_coefficient

import pandas as pd
from matplotlib import pyplot as plt
from pandas.plotting import lag_plot

# Load the dataset using pandas.read_csv
series = pd …

Category: arima

Read More

Arnold-Cat-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

Array-2

Fri 14 November 2025

import numpy as np

x = np.array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
#print(x)

x = x[1:7:5]
#print(x)

x = np.array([
            [
                [1],[2],[3]
            ], 
            [
                [4],[5],[6]
            ]
        ])
#print(x)
print(x.shape)
(2, 3, 1)


Score: 0

Category: array

Read More

Array-Inverse

Fri 14 November 2025
import numpy as np
a = np.array([
    [1, 2],
    [3, 4]
])
a
array([[1, 2],
       [3, 4]])
inverse_a = np.linalg.inv(a)
print(inverse_a)
[[-2.   1. ]
 [ 1.5 -0.5]]


Score: 5

Category: numpy

Read More

Array-Sample

Fri 14 November 2025

import numpy as np

a = np.array([1, 2, 3])  # Create a rank 1 array

print (type(a))            # Prints "<type 'numpy.ndarray'>"
print (a.shape)           # Prints "(3,)"
print (a[0], a[1], a[2])   # Prints "1 2 3"
a[0] = 5                 # Change an element of the array
print (a)                  # Prints …

Category: array

Read More

Article-Reader

Fri 14 November 2025

import requests
from bs4 import BeautifulSoup
# Collect and parse first page
page = requests.get('https://www.wired.com/story/intel-great-american-microchip-mobilization/')
soup = BeautifulSoup(page.text, 'html.parser')    
content = soup.select('article.article-body-component')
content
[]


Score: 5

Category: basics

Read More

Assign-Three-2

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: assignments

Read More
Page 86 of 146

« Prev Next »