Repository navigation
Expand file tree
/
Copy pathBLS_json.py
More file actions
52 lines (44 loc) · 1.63 KB
/
Copy pathBLS_json.py
File metadata and controls
52 lines (44 loc) · 1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import json
import numpy as np
import pandas as pd
import os
import csv
import azure.storage.blob
from azure.storage.blob import BlobServiceClient, ContainerClient
def delta_json_format():
with open('Delta_log_2.json', 'r')as d_in:
dt = json.load(d_in)
with open('delta_log_11-23.json', 'w') as d_format:
json.dump(d_format, indent=4)
def js():
with open('CPI_QA.json', 'r')as f:
dt = json.load(f)
print(dt)
with open('CPI_OUT.json', 'w') as f1:
json.dump(dt, f1,indent=4)
def rd_fl():
f_out = open('test.csv', 'w')
with open('CPI_Data_ML.csv')as f:
header = next(f)
reader = csv.DictReader(f, fieldnames=header)
for row in reader:
print(row)
def rd():
fout = open('CPI_OUT.csv', 'w')
wtr = csv.writer(fout, lineterminator='\n')
lst = []
with open('CPI_Data_ML.csv', 'r') as f:
for i, row in enumerate(f):
row.split(',')[1]
wtr.writerow([row.split(',')[1],row.split(',')[2]])
fout.close()
def read_blob():
blob_path = "abfss://bronze@greedysotre.dfs.core.windows.net/"
blob_token = "sp=rcw&st=2025-11-30T14:42:15Z&se=2025-11-30T22:57:15Z&sv=2024-11-04&sr=c&sig=sENzYgcCYxggpsFBCkjxxudQCN2GXGYPJZJTjhEOweg%3D"
blob_url= "https://greedystore.blob.core.windows.net/bronze?sp=rcw&st=2025-11-30T14:42:15Z&se=2025-11-30T22:57:15Z&sv=2024-11-04&sr=c&sig=sENzYgcCYxggpsFBCkjxxudQCN2GXGYPJZJTjhEOweg%3D"
bronze = BlobServiceClient(blob_url)
bronze_client = bronze.get_blob_client(container='bronzze', blob='greedystore')
print(bronze_client)
#rd()
read_blob()
#delta_json_format()