Compare commits
No commits in common. "2a9ef9d991bea42782475d2dd70f35cad5e57a1e" and "8655255782a92a0e94df1398833064a89c098f0b" have entirely different histories.
2a9ef9d991
...
8655255782
|
@ -23,8 +23,10 @@ def region_capacities(id: int):
|
|||
# Merge Dataframe to generate indices
|
||||
df = df.join(datesDF, on='ScrapeDate')
|
||||
df = df.join(propIdDF, on='property_id')
|
||||
|
||||
# Drop now useless columns ScrapeDate and property_id
|
||||
df = df[['ScrapeDate', 'calendarBody', 'date_index', 'prop_index']]
|
||||
df = df[['calendarBody', 'date_index', 'prop_index']]
|
||||
|
||||
# Calculate grid values
|
||||
gridData = []
|
||||
for row in df.rows(named=True):
|
||||
|
@ -34,18 +36,13 @@ def region_capacities(id: int):
|
|||
sum_hor = calDF.sum_horizontal()[0]
|
||||
else:
|
||||
sum_hor = 0
|
||||
# With Index
|
||||
# gridData.append([row['prop_index'], row['date_index'], sum_hor])
|
||||
# With ScrapeDate
|
||||
gridData.append([row['ScrapeDate'], row['date_index'], sum_hor])
|
||||
|
||||
gridData.append([row['prop_index'], row['date_index'], sum_hor])
|
||||
gridData = np.array(gridData)
|
||||
|
||||
# get all values to calculate Max
|
||||
allValues = gridData[:, 2].astype(int)
|
||||
print(allValues)
|
||||
allValues = gridData[:, 2]
|
||||
maxValue = np.max(allValues)
|
||||
print(maxValue)
|
||||
gridData[:, 2] = (allValues*100)/maxValue
|
||||
gridData[:, 2] = (gridData[:, 2]*100)/maxValue
|
||||
|
||||
# Return back to list
|
||||
gridData = gridData.tolist()
|
||||
|
@ -58,6 +55,3 @@ def region_capacities(id: int):
|
|||
outDict = {'scrapeDates': listOfDates, 'property_ids': listOfPropertyIDs, 'values': gridData}
|
||||
|
||||
return outDict
|
||||
|
||||
out = region_capacities(1)
|
||||
print(out)
|
Loading…
Reference in New Issue