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 pigpio | |
from time import sleep, strftime | |
from telegram.ext import Updater | |
BOT_TOKEN = "" | |
CHAT_ID = "" | |
# Pin | |
PIN = 17 |
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 # pylint: disable=import-error | |
import re | |
from pathlib import Path | |
import logging | |
import sys | |
import os | |
from urllib.error import HTTPError | |
# Set logging level | |
logging.basicConfig(stream=sys.stdout, | |
format="%(message)s", |
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
(#AndamanFightsCOVID19) (from:ChetanSanghi) | |
------------------------------ | |
(COVID-19 OR patients OR recovered OR discharged OR Active) (from:Andaman_admin) | |
------------------------------ | |
*** | |
http://twitter.com/Andaman_Admin/status/1287044453862055936 |
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 datetime import datetime | |
import pandas as pd | |
import numpy as np | |
# Read merged data | |
df = pd.read_csv('https://api.covid19india.org/csv/latest/raw_data.csv') | |
df.head() | |
df['Date Announced'] = pd.to_datetime(df['Date Announced']) | |
df = df[df['Date Announced'] <= '2020-04-26'] | |
df['District_Key'] = df['State code'] + "_" + df['Detected District'] |
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
label_annotations { | |
mid: "/m/0fbf1m" | |
description: "Terrestrial animal" | |
score: 0.993838369846344 | |
topicality: 0.993838369846344 | |
} | |
label_annotations { | |
mid: "/m/03bk1" | |
description: "Giraffe" | |
score: 0.9926815032958984 |
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 | |
import pandas as pd | |
r = requests.get("https://api.covid19india.org/raw_data.json") | |
pdb = r.json() | |
df = pd.DataFrame.from_dict(pdb['raw_data']) |
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
function time_wise_update(){ | |
var getSheet = SpreadsheetApp.getActive().getSheetByName("Sheet1"); | |
var setSheet = SpreadsheetApp.getActive().getSheetByName("Sheet2"); | |
var url = 'https://xxx/data.json'; | |
var response = UrlFetchApp.fetch(url, {'muteHttpExceptions': true}); | |
var json = response.getContentText(); | |
var data = JSON.parse(json); | |
var ss = data.ss; |
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
def rand_color_gen(n=1): | |
h_v = [] | |
for i in range(0,n): | |
i+=1 | |
r = lambda: random.randint(0,255) | |
h_v.append('#%02X%02X%02X' % (r(),r(),r())) | |
return h_v | |
# Just random colors. No guarantee of any sort. |
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 io | |
def load_vectors(fname): | |
fin = io.open(fname, 'r', encoding='utf-8', newline='\n', errors='ignore') | |
n, d = map(int, fin.readline().split()) | |
data = {} | |
for line in fin: | |
tokens = line.rstrip().split(' ') | |
data[tokens[0]] = list(map(float, tokens[1:])) | |
return n,d,data |
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
#### Function to validate classification models#### | |
accuracy_metrics <- function(y_actual, y_predicted) { | |
#Check if the input is factor | |
if(is.factor(y_actual)){ | |
print("Info : Actual values provided as factor. Factor converted to numeric. ") | |
#Convert to numeric |
NewerOlder