Skip to content

Commit

Permalink
Fixed Calculation of MinMax
Browse files Browse the repository at this point in the history
LuxDataframe now correctly gets the yMinMax for quantitative variables when connected to a database
  • Loading branch information
19thyneb committed Jun 1, 2020
1 parent 623582f commit 5be1b9b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lux/luxDataFrame/LuxDataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ def computeStats(self):
self.cardinality[dimension] = len(self.uniqueValues[dimension])
if self.dtypes[dimension] == "float64" or self.dtypes[dimension] == "int64":
self.xMinMax[dimension] = (min(self.uniqueValues[dimension]), max(self.uniqueValues[dimension]))
self.yMinMax[dimension] = (self[dimension].min(), self[dimension].max())
self.yMinMax[dimension] = (min(self.uniqueValues[dimension]), max(self.uniqueValues[dimension]))
# print(self.xMinMax[dimension])

#######################################################
Expand All @@ -189,6 +189,7 @@ def setSQLConnection(self, connection, t_name):
if self.toggleBenchmarking == True:
toc = time.perf_counter()
print(f"Extracted Metadata from SQL Database in {toc - tic:0.4f} seconds")
self.setExecutorType("SQL")

def computeSQLDatasetMetadata(self):
self.getSQLAttributes()
Expand All @@ -215,7 +216,7 @@ def computeSQLStats(self):
for dimension in self.columns:
if self.dataTypeLookup[dimension] == 'quantitative':
self.xMinMax[dimension] = (min(self.uniqueValues[dimension]), max(self.uniqueValues[dimension]))
self.yMinMax[dimension] = (self[dimension].min(), self[dimension].max())
self.yMinMax[dimension] = (min(self.uniqueValues[dimension]), max(self.uniqueValues[dimension]))

def getSQLAttributes(self):
if "." in self.table_name:
Expand Down

0 comments on commit 5be1b9b

Please sign in to comment.