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
license: mit |
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
license: mit |
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
license: mit |
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
Sub workbookcreator() | |
Dim MyPath As String, FilesInPath As String, Outputpath As String | |
Dim MyFiles() As String, dd() As String, columnsname As String | |
Dim FNum As Long, kk As Long, no_ent As Long | |
Dim mybook As Workbook | |
Dim sheetsname As Variant, ee() As Variant | |
Application.AskToUpdateLinks = False | |
' Change this to the path\folder location of your files. | |
MyPath = "path to data files\data" | |
Outputpath = "path to output folder\output" |
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 | |
import tkinter as tk | |
from tkinter import filedialog | |
import os | |
def analysis(): | |
path = filedialog.askopenfilename() | |
data = pandas.read_excel(path) | |
groups = data.groupby('Group') | |
table = groups.agg({'Revenue':sum, 'Group': len}) |
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 requests | |
import pandas | |
import matplotlib.pyplot as plt | |
import json | |
html = requests.get('https://api.covid19india.org/state_test_data.json') | |
state_json_data = json.loads(html.text) |
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
states = [] | |
totaltested= [] | |
positive = [] | |
dates= [] | |
for state in state_json_data['states_tested_data']: | |
states.append(state['state']) | |
totaltested.append(state['totaltested']) | |
positive.append(state['positive']) | |
dates.append(state['updatedon']) |
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
data['Dates']= pandas.to_datetime(data['Dates'], format = '%d/%m/%Y') | |
data.loc[data['positive']=='','positive'] = None | |
data['positive'] =data['positive'].fillna(method='ffill') | |
data['positive'] = data['positive'].astype(int) | |
data.loc[data['totaltested']=='','totaltested'] = None | |
data['totaltested'] =data['totaltested'].fillna(method='ffill') | |
data['totaltested'] = data['totaltested'].astype(int) |
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
data = data.sort_values(by=['state', 'Dates']) | |
data['dailypositive'] = data['positive'].diff() | |
data['dailytested'] = data['totaltested'].diff() | |
data.loc[data['state']!=data['state'].shift(1), 'dailytested'] = data['totaltested'] | |
data.loc[data['state']!=data['state'].shift(1), 'dailypositive'] = data['positive'] |
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
stateslist = ['Maharashtra', 'Gujarat', 'Delhi', 'Karnataka', 'Kerala', 'West Bengal'] | |
for state in stateslist: | |
statedata = data[data['state']==state] | |
plt.plot(statedata['Dates'], statedata['positive']/statedata['totaltested'], label=state) | |
plt.title('Test Positive Rate: Cumulative cases/Total tests ') | |
plt.legend() | |
plt.show() |
OlderNewer