# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3.8.6 64-bit
#     metadata:
#       interpreter:
#         hash: 767d51c1340bd893661ea55ea3124f6de3c7a262a8b4abca0554b478b1e2ff90
#     name: Python 3.8.6 64-bit
# ---

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt

# +
# id = db.Column("room_id", db.Integer, primary_key=True)
#     room = Column(db.Integer, nullable=False)
#     number_person = Column(db.Integer, nullable=False)
#     type_room = Column(String(250), nullable=False)
#     price_room = Column(db.Integer, nullable=False)
#     position_room = Column(String(250), nullable=False)
#     status_room = Column(String(250), nullable=False)
# -

room = []
for i in range(1,6):
    room+= [k for k in range(i*100+1, 100*i+30)] + [j for j in range(i*100+60,100*i+90)]

df = pd.DataFrame({'room':room})
df['price_room'] = 670
df['numberDomitory'] = 1
df['type_room'] = 'NORM'
df['number_person'] = df['room'].apply(lambda x: 2 if x%2 else 3)
df['gender'] = df['room'].apply(lambda x: 'MALE' if x%2 else 'FEMALE')
df['empty_position'] =  df['number_person']
df['status_room'] = 'OK'

df.head()

room = []
for i in range(1,6):
    room+= [k for k in range(1000+ i*100+1, 1000+100*i+30)] 

df_block = pd.DataFrame({'room':room})
df_block['price_room'] = 1200
df_block['numberDomitory'] = 1
df_block['type_room'] = 'BLOCK'
df_block['number_person'] = 2
df_block['gender'] = df_block['room'].apply(lambda x: 'MALE' if x%2 else 'FEMALE')
df_block['empty_position'] =  df_block['number_person']
df_block['status_room'] = 'OK'

df_block.head()

df = pd.concat([df, df_block])

# + tags=[]
df.sample(20)
# -

df2 = df.copy()
df2['numberDomitory'] = 2
df3 = df.copy()
df3['numberDomitory'] = 3

df = pd.concat([df, df2,df3])

df['room_id'] = range(len(df))

df.sample(20)

# +
from sqlalchemy import create_engine

disk_engine = create_engine('sqlite:///rooms.sqlite')
df.to_sql(name='rooms', con=disk_engine,if_exists='append',  index=False)
# -

# !pip install sqlalchemy



StarcoderdataJupyterScriptsDedupFiltered