• Jan 23, 2021 •asnark
0 likes • 1 view
""" Take screenshots at x interval - make a movie of doings on a computer. """ import time from datetime import datetime import ffmpeg import pyautogui while True: epoch_time = int(time.time()) today = datetime.now().strftime("%Y_%m_%d") filename = str(epoch_time) + ".png" print("taking screenshot: {0}".format(filename)) myScreenshot = pyautogui.screenshot() myScreenshot.save(today + "/" + filename) time.sleep(5) # # and then tie it together with: https://github.com/kkroening/ffmpeg-python/blob/master/examples/README.md#assemble-video-from-sequence-of-frames # """ import ffmpeg ( ffmpeg .input('./2021_01_22/*.png', pattern_type='glob', framerate=25) .filter('deflicker', mode='pm', size=10) .filter('scale', size='hd1080', force_original_aspect_ratio='increase') .output('movie.mp4', crf=20, preset='slower', movflags='faststart', pix_fmt='yuv420p') .run() ) """
• Oct 7, 2022 •KETRICK
0 likes • 5 views
x[cat_var].isnull().sum().sort_values(ascending=False)
• Jul 24, 2024 •AustinLeath
0 likes • 3 views
from statistics import median, mean, mode def print_stats(array): print(array) print("median =", median(array)) print("mean =", mean(array)) print("mode =", mode(array)) print() print_stats([1, 2, 3, 3, 4]) print_stats([1, 2, 3, 3])
• Nov 19, 2022 •CodeCatch
0 likes • 2 views
# Python program for Plotting Fibonacci # spiral fractal using Turtle import turtle import math def fiboPlot(n): a = 0 b = 1 square_a = a square_b = b # Setting the colour of the plotting pen to blue x.pencolor("blue") # Drawing the first square x.forward(b * factor) x.left(90) x.forward(b * factor) x.left(90) x.forward(b * factor) x.left(90) x.forward(b * factor) # Proceeding in the Fibonacci Series temp = square_b square_b = square_b + square_a square_a = temp # Drawing the rest of the squares for i in range(1, n): x.backward(square_a * factor) x.right(90) x.forward(square_b * factor) x.left(90) x.forward(square_b * factor) x.left(90) x.forward(square_b * factor) # Proceeding in the Fibonacci Series temp = square_b square_b = square_b + square_a square_a = temp # Bringing the pen to starting point of the spiral plot x.penup() x.setposition(factor, 0) x.seth(0) x.pendown() # Setting the colour of the plotting pen to red x.pencolor("red") # Fibonacci Spiral Plot x.left(90) for i in range(n): print(b) fdwd = math.pi * b * factor / 2 fdwd /= 90 for j in range(90): x.forward(fdwd) x.left(1) temp = a a = b b = temp + b # Here 'factor' signifies the multiplicative # factor which expands or shrinks the scale # of the plot by a certain factor. factor = 1 # Taking Input for the number of # Iterations our Algorithm will run n = int(input('Enter the number of iterations (must be > 1): ')) # Plotting the Fibonacci Spiral Fractal # and printing the corresponding Fibonacci Number if n > 0: print("Fibonacci series for", n, "elements :") x = turtle.Turtle() x.speed(100) fiboPlot(n) turtle.done() else: print("Number of iterations must be > 0")
from functools import partial def curry(fn, *args): return partial(fn, *args) add = lambda x, y: x + y add10 = curry(add, 10) add10(20) # 30
• Sep 9, 2023 •AustinLeath
0 likes • 24 views
print("test")