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
city_list = df.values.tolist() | |
geo_list = [] | |
lat_list = [] | |
lon_list = [] | |
for i in city_list: | |
location = geolocator.geocode(i[0], i[1]) | |
lat_list.append(location.latitude) | |
lon_list.append(location.longitude) |
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 geopy.geocoders import Nominatim | |
geolocator = Nominatim(user_agent="yourmail@mail.com") | |
import pandas as pd | |
url="https://pkgstore.datahub.io/core/world-cities/world-cities_csv/data/6cc66692f0e82b18216a48443b6b95da/world-cities_csv.csv" | |
df=pd.read_csv(url) | |
df=df[['name', 'country']] | |
df = df.loc[df['country'] == 'Poland'] | |
df = df.rename(columns = {'name':'city'}) |
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 | |
start_time = datetime.now() | |
from itertools import combinations | |
input_txt = 'aabchit' | |
# input_sort = ''.join(sorted(input_txt)) | |
import string | |
alphabet = list('aąbcćdeęfghijklłmnńoóprsśtuwyzźż') |
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 pickle | |
# load pickle | |
start_time = datetime.now() | |
with gzip.open(r'C:\your_path_here\slowa_dict.pickle', 'rb') as f: | |
word_dict = pickle.load(f) | |
time_elapsed = datetime.now() - start_time |
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 pickle | |
import gzip | |
df_sort = pd.read_csv(r'C:\your_path_here\slowa_sort.txt.gz') | |
merged = pd.merge(df_sort, df, left_index=True, right_index=True) | |
grouped = merged.groupby('sorted').agg(list) | |
grouped = grouped.reset_index() | |
word_dict = grouped.set_index('sorted')['words'].to_dict() | |
with gzip.open(r'C:\your_path_here\slowa_dict.pickle', 'wb') as f: |
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 matplotlib.pyplot as plt | |
import matplotlib.patches as mpatches | |
import numpy as np | |
x_labels = single_yr_list | |
y_temp_year = temp_year | |
plt.plot(x_labels, y_temp_year, color = 'crimson') | |
for a,b in zip(x_labels, y_temp_year): | |
plt.text(a, b, str(b)) |
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
single_yr_list = df_dynow["Rok"].drop_duplicates().tolist() | |
single_yr_list = single_yr_list[:-1] | |
print(single_yr_list) |
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
temp_year = df_dynow['Średnia dobowa temperatura'].tolist() | |
temp_year = temp_year[:-1] # no 2019 cause no Dec data for 2019 | |
print(temp_year) |
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
file_name = r'C:\your_path_here\imgw_grouped.xlsx' | |
df_grouped = pd.read_excel(file_name, encoding='utf-8') | |
df_dynow = df_grouped[df_grouped['Nazwa stacji'] == 'DYNÓW'] | |
df_dynow = df_dynow.reset_index(drop=True) | |
print(df_dynow.shape) | |
df_dynow.head() |
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
file_name = r'C:\your_path_here\imgw_grouped.xlsx' | |
df_grouped.to_excel(file_name, encoding='utf-8', index=False) |