Python Tutorial
Python is a verstile programming language that has gained a lot of attention and popularity. Using Python, you do things like develop web applications, desktop applications, task automation, artificial intelligence (AI), big data, data analytics, machine learning (ML), and many other things.
Python is really becoming as the leader in data science and data analytics. With so many open source libraries to choose from (Pandas, scikit-learn, NumPy, Matplotlib), learning data analysis in Python just got so much easier.
Source Code: google_apis.py
import os import datetime from google_auth_oauthlib.flow import InstalledAppFlow from googleapiclient.discovery import build from google.oauth2.credentials import Credentials from google.auth.transport.requests import Request def create_service(client_secret_file,...
Source Code: Export Salesforce Report To Excel With Python | Python Automation
query.py import os import httpx import pandas as pd from dotenv import load_dotenv load_dotenv() consumer_key = os.getenv('CONSUMER_KEY') consumer_secret = os.getenv('CONSUMER_SECRET') username = os.getenv('SFDC_USERNAME') password = os.getenv('SFDC_PASSWORD')...
Resource File: Create A Google Cloud Text-To-Speech Desktop App With Python
gcp.py from datetime import timedelta from google.cloud import speech from google.cloud import storage def transcribe_gcs_with_language_detection(gcs_uri): client = speech.SpeechClient() audio = speech.RecognitionAudio(uri=gcs_uri) config =...
Resource Files: Create A YouTube Video Summary API With Lambda & API Gateway & OpenAI API
OpenAI Layer Zip File: Download lambda_handler function Source Code: import json import os from openai import OpenAI from youtube_transcript_api import YouTubeTranscriptApi from youtube_transcript_api import CouldNotRetrieveTranscript, InvalidVideoId,...
Source Code: Getting Started With Azure Document AI Document Intelligence API In Python
example1 (W2 data extraction) """ example 1: W2 form data extraction """ import base64 from pathlib import Path from azure.ai.documentintelligence.models import AnalyzeDocumentRequest from utility import client, is_file_or_url, load_file_as_base64 document_dir =...
Resource files: Create An Ollama Desktop App With Python & PyQt6
pyollama.py import ollama # pip install ollama def convert_nanoseconds_to_seconds(nanoseconds): return nanoseconds / 1_000_000_000 def run_model(model, prompt, stream=False): res = ollama.generate( model=model, prompt=prompt, stream=stream ) return res def...
Source Code: openai_utility.py
openai_utility.py import os import pandas as pd # display all columns pd.set_option('display.max_columns', None) class FilesManager: def __init__(self, client): self.client = client def list_files(self): file_list = self.client.files.list() if file_list is None:...
Source Code: How To Make Multiple API Calls Concurrently With Asyncio In Python (Asynchronously Programming)
demo_async.py import asyncio from io import StringIO import httpx import pandas as pd from timer_functions import time_async async def download_data(ticker): async with httpx.AsyncClient(headers={'user-agent': 'firefox'}) as client: url =...
Resource: Build a YouTube Video Summarize GUI App With Python (And OpenAI API) For Beginners
transcriber.py import re import openai from youtube_transcript_api import YouTubeTranscriptApi, TranscriptsDisabled def get_video_transcript(video_id): pattern = r'\[.*?\]' response = YouTubeTranscriptApi.get_transcript(video_id) transcripts = [item['text'] for item...
Source Code: Python Data Visualization: Create A Stacked Bar Chart In Matplotlib (For Beginners)
Download Data File: Download import numpy as np import pandas as pd import matplotlib.pyplot as plt import matplotlib.ticker as ticker def millions_and_thousands_formatter(x, pos): if x >= 1_000_000: return f'{x/1_000_000:.1f} MM' elif x >= 1_000: return...
