This file contains hidden or 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 os | |
# Modify this path as per the execution environment | |
os.environ['GIT_PYTHON_GIT_EXECUTABLE'] = r"C:\Program Files\Git\bin\git.exe" | |
import uuid | |
import git | |
import shutil | |
from git import RemoteProgress | |
from azure.storage.blob import BlobServiceClient | |
This file contains hidden or 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
# coding: utf-8 | |
import os | |
from azure.storage.blob import BlobServiceClient | |
class DownloadADLS: | |
def __init__(self, connection_string, container_name): | |
service_client = BlobServiceClient.from_connection_string(connection_string) | |
self.client = service_client.get_container_client(container_name) | |
This file contains hidden or 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 os | |
from azure.storage.blob import BlobServiceClient | |
# Install the following package before running this program | |
# pip install azure-storage-blob | |
def upload_data_to_adls(): | |
""" | |
Function to upload local directory to ADLS | |
:return: | |
""" |
This file contains hidden or 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 azure.storage.filedatalake import DataLakeServiceClient | |
# install the following package | |
# pip install azure-storage-file-datalake | |
# Get the below details from your storage account | |
storage_account_name = "" | |
storage_account_key = "" | |
container_name = "" | |
directory_name = "" |
This file contains hidden or 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 csv | |
import boto3 | |
client = boto3.client('sagemaker', region_name='us-east-1') | |
response = client.list_notebook_instances(MaxResults=100) | |
notebooks = response['NotebookInstances'] | |
print("Total Number of Notebook Instances ----->", len(notebooks)) | |
notebook_list = [] | |
for notebook in notebooks: | |
notebook_dict = dict() |
This file contains hidden or 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 pyspark.sql import SparkSession | |
# Author: Amal G Jose | |
# Reference: https://amalgjose.com | |
# prepare spark session | |
spark = SparkSession.builder.appName('filesystemoperations').getOrCreate() | |
# spark context | |
sc = spark.sparkContext | |
# set ADLS file system URI |
This file contains hidden or 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 boto3 | |
import requests | |
authentication = {"USER": "", "PASSWORD": ""} | |
payload = {"query": "some query"} | |
session = requests.Session() | |
response = session.post("URL", | |
data=payload, | |
auth=(authentication["USER"], |
This file contains hidden or 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 requests | |
session = requests.Session() | |
authentication = {"USER":"", "PASSWORD":""} | |
payload = {"query":"some query"} | |
local_file = "data.json" | |
# This is a dummy URL. You can replace this with the actual URL | |
URL = "https://sampledatadowload.com/somedata" |
This file contains hidden or 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 | |
# create a sample dataframe | |
df = pd.DataFrame({'emp_id': ['111', '112', '113'], 'salary': ['40000', '50000', '60000'], 'name':['amal', 'sabitha', 'edward']}) | |
# print the dataframe | |
print(df) | |
# print the datatypes in the dataframe | |
print(df.dtypes) | |
# now let us convert the data type of salary to integer | |
df = df.astype({'salary':'int'}) |
This file contains hidden or 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 time | |
import sqlite3 | |
import speedtest | |
from datetime import datetime, timedelta | |
class internet_speed_calculator(): | |
def __init__(self): |