This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import azure.cognitiveservices.speech as speechsdk | |
import time | |
import pickle | |
subscription_key = "your_key" | |
speech_region = "your_region" | |
file_name = "your_audio.wav" | |
# Authenticate | |
speech_config = speechsdk.SpeechConfig(subscription_key, speech_region) | |
# Set up the file as the audio source |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import azure.cognitiveservices.speech as speechsdk | |
subscription_key = "your_key" | |
speech_region = "your_region" | |
speech_config = speechsdk.SpeechConfig(subscription_key, speech_region) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from moviepy.editor import VideoFileClip | |
video = VideoFileClip("your_video.mp4") | |
audio = video.audio | |
audio.write_audiofile("audio_only.wav") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
from os import getcwd, path | |
import plotly.express as px | |
import plotly.offline as pyo | |
pyo.init_notebook_mode() | |
path_to_data = path.join(getcwd(), "data", "survey_results_public.csv") | |
data = pd.read_csv(path_to_data) | |
data = data[["LanguageWorkedWith"]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
from os import getcwd, path | |
import plotly.express as px | |
import plotly.offline as pyo | |
pyo.init_notebook_mode() | |
path_to_data = path.join(getcwd(), "data", "survey_results_public.csv") | |
data = pd.read_csv(path_to_data) | |
data = data[["EdLevel"]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
from os import getcwd, path | |
import plotly.express as px | |
import plotly.offline as pyo | |
pyo.init_notebook_mode() | |
path_to_data = path.join(getcwd(), "data", "survey_results_public.csv") | |
data = pd.read_csv(path_to_data) | |
data = data[["ConvertedComp"]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
from os import getcwd, path | |
import plotly.express as px | |
import plotly.offline as pyo | |
pyo.init_notebook_mode() | |
path_to_data = path.join(getcwd(), "data", "survey_results_public.csv") | |
data = pd.read_csv(path_to_data) | |
data = data[["Age"]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from PIL import Image | |
# Create a blank grey image | |
wip_img = Image.new("RGBA", (550, 450), "#f2f2f2") | |
# Load the santa hat | |
santa_hat = Image.open("santa_hat.png") | |
# At first this is just a black rectangle of the same size as the hat | |
shadow = Image.new("RGBA", santa_hat.size, color="black") | |
# Coordinates at which to draw the hat and shadow |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
import numpy as np | |
def generate_random_dates(num_dates: int) -> np.array: | |
"""Generate a 1D array of `num_dates` random dates. | |
""" | |
start_date = "2020-01-01" | |
# Generate all days for 2020 | |
available_dates = [np.datetime64(start_date) + days for days in range(365)] | |
# Get `num_dates` random dates from 2020 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
import matplotlib.pyplot as plt | |
import numpy as np | |
# Load the CSV (load date data as proper date types) | |
df = pd.read_csv("page_views.csv") | |
df["date"] = pd.to_datetime(df["date"]) | |
# Sort the DF from oldest to most recent recordings | |
df.sort_values(by="date", inplace=True) | |
# Use the column of dates as the DF's index |