Testeado el batch de indices en dev.
This commit is contained in:
parent
d71b69a611
commit
c234679a10
7 changed files with 170 additions and 23 deletions
106
tests/index_batch_tests.py
Normal file
106
tests/index_batch_tests.py
Normal file
|
|
@ -0,0 +1,106 @@
|
|||
from analysis.market_snapshot import Market
|
||||
from analysis.index_batch import IndexMM
|
||||
import pandas as pd
|
||||
|
||||
sample_market = [
|
||||
{'tamano_categorico': 'coche pequeño',
|
||||
'tipo_anuncio': 1,
|
||||
'precio': 15000,
|
||||
'calle': 'B1',
|
||||
'telefono': 123,
|
||||
'latitud': 2.1,
|
||||
'longitud': 1.2},
|
||||
{'tamano_categorico': 'coche pequeño',
|
||||
'tipo_anuncio': 1,
|
||||
'precio': 20000,
|
||||
'calle': 'B2',
|
||||
'telefono': 321,
|
||||
'latitud': 2.1,
|
||||
'longitud': 1.2},
|
||||
{'tamano_categorico': 'coche grande',
|
||||
'tipo_anuncio': 1,
|
||||
'precio': 20000,
|
||||
'calle': 'B2',
|
||||
'telefono': 321,
|
||||
'latitud': 2.1,
|
||||
'longitud': 1.2},
|
||||
{'tamano_categorico': 'coche grande',
|
||||
'tipo_anuncio': 1,
|
||||
'precio': 25000,
|
||||
'calle': 'B2',
|
||||
'telefono': 123,
|
||||
'latitud': 2.1,
|
||||
'longitud': 1.2},
|
||||
{'tamano_categorico': 'coche y moto',
|
||||
'tipo_anuncio': 1,
|
||||
'precio': 22000,
|
||||
'calle': 'B1',
|
||||
'telefono': 456,
|
||||
'latitud': 2.1,
|
||||
'longitud': 1.2},
|
||||
{'tamano_categorico': 'coche y moto',
|
||||
'tipo_anuncio': 1,
|
||||
'precio': 26000,
|
||||
'calle': 'B3',
|
||||
'telefono': 789,
|
||||
'latitud': 2.1,
|
||||
'longitud': 1.2},
|
||||
{'tamano_categorico': None,
|
||||
'tipo_anuncio': 1,
|
||||
'precio': 15000,
|
||||
'calle': 'abc',
|
||||
'telefono': 456,
|
||||
'latitud': 2.1,
|
||||
'longitud': 1.2},
|
||||
{'tamano_categorico': 'moto',
|
||||
'tipo_anuncio': 1,
|
||||
'precio': 3000,
|
||||
'calle': 'B4',
|
||||
'telefono': 123,
|
||||
'latitud': 2.1,
|
||||
'longitud': 1.2},
|
||||
{'tamano_categorico': '2 coches o más',
|
||||
'tipo_anuncio': 1,
|
||||
'precio': 60000,
|
||||
'calle': 'B4',
|
||||
'telefono': 123,
|
||||
'latitud': 2.1,
|
||||
'longitud': 1.2},
|
||||
{'tamano_categorico': 'coche pequeño',
|
||||
'tipo_anuncio': 1,
|
||||
'precio': 20000,
|
||||
'calle': 'B2',
|
||||
'telefono': 321,
|
||||
'latitud': 2.1,
|
||||
'longitud': 1.2},
|
||||
{'tamano_categorico': 'coche pequeño',
|
||||
'tipo_anuncio': 2,
|
||||
'precio': 50,
|
||||
'calle': 'B4',
|
||||
'telefono': 123,
|
||||
'latitud': 2.1,
|
||||
'longitud': 1.2},
|
||||
{'tamano_categorico': 'moto',
|
||||
'tipo_anuncio': 1,
|
||||
'precio': 300000,
|
||||
'calle': 'B4',
|
||||
'telefono': 123,
|
||||
'latitud': 2.1,
|
||||
'longitud': 1.2}
|
||||
]
|
||||
date_range = {'start': '2018-01-01 00:00:00',
|
||||
'end': '2018-02-01 00:00:00'}
|
||||
|
||||
|
||||
market = Market()
|
||||
market.load_market(sample_market,
|
||||
date_range=date_range)
|
||||
market.market.fillna(value=pd.np.nan, inplace=True)
|
||||
print(market.market.to_string())
|
||||
market.clean_market('index')
|
||||
print(market.market.to_string())
|
||||
|
||||
index = IndexMM()
|
||||
index.calculate(market)
|
||||
index.get_data()
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue