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
| todo_lst = [(0, SEED)] | |
| todo_set = set(SEED) | |
| done_set = set() | |
| g = nx.DiGraph() | |
| layer, page = todo_lst[0] | |
| # a consulta será realizada até o nível 1 | |
| while layer < 2: | |
| # remove a página atual da lista de páginas pendentes |
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
| CREATE KEYSPACE cities WITH replication = {'class': 'SimpleStrategy', 'replication_factor' : 2}; | |
| CREATE TABLE IF NOT EXISTS city_per_country ( | |
| id uuid, | |
| name text, | |
| country text, | |
| state text, | |
| population int, | |
| PRIMARY KEY (country, population, id) | |
| ) WITH CLUSTERING ORDER BY (population DESC); |
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
| CREATE DATABASE IF NOT EXISTS cities_db; | |
| CREATE TABLE IF NOT EXISTS Countries ( | |
| id int NOT NULL AUTO_INCREMENT, | |
| name varchar(255) NOT NULL, | |
| PRIMARY KEY (id) | |
| ); | |
| CREATE TABLE IF NOT EXISTS States ( | |
| id int NOT NULL AUTO_INCREMENT, |
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
| version: "2.3" | |
| services: | |
| mysql1: | |
| image: mysql | |
| container_name: mysql1 | |
| hostname: mysql1 | |
| mem_limit: 6144M | |
| mem_reservation: 1536M | |
| ports: | |
| - "3306:3306" |
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
| version: "2.3" | |
| networks: | |
| cassandra-final: | |
| services: | |
| cass1: | |
| image: cassandra | |
| container_name: cass1 | |
| hostname: cass1 | |
| mem_limit: 2048M | |
| mem_reservation: 512M |
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
| fig, ax = plt.subplots(nrows=1,ncols=6,figsize=(25,4)) | |
| states = ['SP', 'RJ', 'AM', 'CE', 'BA', 'RN'] | |
| for i, state in enumerate(states): | |
| state_data = data_br_merged.loc[data_br_merged['state']==state] | |
| data_moving_average = state_data.rolling(window=7).mean().dropna() | |
| data_mean = data_moving_average.apply(normalize, df=data_moving_average, axis=1)[['residential_normalized', 'new_cases_normalized']] | |
| data_mean.plot(legend=True, ax=ax[i]) | |
| ax[i].set_title(state,fontsize=12,ha='right') | |
| ax[i].set_xticklabels(["", "Mar","", "", "", "Oct"]) |
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
| # iterate over the selected states and prepare the plot | |
| for i, state in enumerate(states): | |
| other_states = data_br_unstack[item].rolling(window=7).mean().dropna() | |
| # the dates must be converted to integers | |
| other_states.index = mdates.date2num(other_states.index) | |
| other_states.plot(legend=False,color=[(0.7,0.7,0.7)],linewidth=1, alpha=0.4, ax=ax[i]) | |
| selected_state = data_br_unstack[item][state].rolling(window=7).mean().dropna() | |
| # the dates must be converted to integers | |
| selected_state.index = mdates.date2num(selected_state.index) |