mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
[PyTables] PY-81433 More cleanup; Added a new inspection (column with one value)
GitOrigin-RevId: 47bbbd38a606a580b53beb3bf6d467ec2cd49070
This commit is contained in:
committed by
intellij-monorepo-bot
parent
274731c1c6
commit
a3098cd206
@@ -194,6 +194,7 @@ def get_inspection_outliers(table):
|
||||
result = {}
|
||||
try:
|
||||
result[InspectionResultsDict.KEY_STATUS] = InspectionResultsDict.VALUE_STATUS_SUCCESS
|
||||
# TODO: old versions
|
||||
from pandas.api.types import is_numeric_dtype
|
||||
results_details_per_column = []
|
||||
for col in table.columns:
|
||||
@@ -228,6 +229,32 @@ def get_inspection_outliers(table):
|
||||
return __serialize_in_json(result, "Outliers")
|
||||
|
||||
|
||||
def get_inspection_constant_columns(table):
|
||||
result = {}
|
||||
try:
|
||||
result[InspectionResultsDict.KEY_STATUS] = InspectionResultsDict.VALUE_STATUS_SUCCESS
|
||||
results_details_per_column = []
|
||||
for col in table.columns:
|
||||
if table[col].nunique(dropna=False) == 1:
|
||||
results_details_per_column.append({
|
||||
"columnName": col,
|
||||
"value": str(table[col].iloc[0])
|
||||
})
|
||||
if len(results_details_per_column) == 0:
|
||||
result[InspectionResultsDict.KEY_IS_TRIGGERED] = InspectionResultsDict.VALUE_TRIGGERED_NO
|
||||
else:
|
||||
result[InspectionResultsDict.KEY_IS_TRIGGERED] = InspectionResultsDict.VALUE_TRIGGERED_YES
|
||||
result[InspectionResultsDict.KEY_DETAILS] = {
|
||||
InspectionResultsDict.KEY_DETAILS_TYPE: InspectionResultsDict.VALUE_DETAILS_TYPE_PER_COLUMN,
|
||||
InspectionResultsDict.KEY_DETAILS_VALUE: results_details_per_column
|
||||
}
|
||||
|
||||
except:
|
||||
result[InspectionResultsDict.KEY_STATUS] = InspectionResultsDict.VALUE_STATUS_FAILED
|
||||
result[InspectionResultsDict.KEY_IS_TRIGGERED] = InspectionResultsDict.VALUE_TRIGGERED_NO
|
||||
return __serialize_in_json(result, "Constant Columns")
|
||||
|
||||
|
||||
def __get_data_slice(table, start, end):
|
||||
return __convert_to_df(table).iloc[start:end]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user