Comments (4)
Aggregations per Bratislava district
from climathon-fiit-re.
DB with columns
from climathon-fiit-re.
Create database (I made postgresql with 5555 port and default credentials - in code)
`
import pandas as pd
import sqlalchemy
from sqlalchemy.orm import declarative_base, sessionmaker
engine = sqlalchemy.create_engine("postgresql://postgres:postgres@localhost:5555/postgres")
Session = sessionmaker(bind=engine)
session = Session()
Base = declarative_base()
def fill_database() -> None:
cadastral_area = pd.read_csv("data/cadastral_area.csv", skiprows=1, encoding='Windows-1250 ', on_bad_lines='skip', delimiter=";")
cadastral_area = cadastral_area.loc[:, 'okres':'názov']
cadastral_area.columns = ['id_okres', 'skratka_okresu', 'kod', 'vymera', 'nazov_obce', 'kod_katastra', 'vymera_drop', 'nazov']
cadastral_area['skratka_okresu'] = cadastral_area.groupby('id_okres')['skratka_okresu'].transform(
lambda x: x.ffill().bfill())
cadastral_area = cadastral_area.drop(columns=['vymera_drop'])
cadastral_area.to_sql('cadastral_area', engine, if_exists='replace', index=False)
cadastral_metadata = pd.read_csv("data/cadastral_metadata.csv", encoding='Windows-1250 ', on_bad_lines='skip', delimiter=";")
replaced_columns = ['datum_aktualizacie_objectu', 'autor', 'horizontalna_presnost', 'aktualny_stav_objektu',
'kod_katastralneho_uzemia', 'nazov_katastralneho_uzemia', 'cislo_obce', 'nazov_obce',
'cislo_okresu', 'nazov_okresu', 'cislo_kraja', 'nazov_kraja', 'vymera', 'NUTS1', 'NUTS1_CODE',
'NUTS2', 'NUTS2_CODE', 'NUTS3', 'NUTS3_CODE', 'LAU1', 'LAU1_CODE', 'LAU2', 'LAU2_CODE']
cadastral_metadata.columns = replaced_columns
cadastral_metadata.to_sql('cadastral_metadata', engine, if_exists='replace', index=False)
if name=="main":
fill_database()
`
from climathon-fiit-re.
Data
cadastral_metadata.csv
cadastral_area.csv
Directory tree:
src/fill_database.py
data/*.csv
from climathon-fiit-re.
Related Issues (9)
- Solar panel providers and their stats iteration 1
- Calculation of returns and statistics of solar panel per solar radiance factor HOT 2
- aggregate catastral data to private/oraganisation/city_owned/country_owned lands, buildings....
- Flow iteration 1 HOT 1
- General elecricity consumption Statistics for households HOT 1
- answer: can a building become self sufficient with just solar panel HOT 2
- CO2 gather information HOT 3
- Implement first iteration with datasets (will be needeed for statistics and visualisations) HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from climathon-fiit-re.