Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions dataprofiler/reports/graphs.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import math
import warnings
from typing import TYPE_CHECKING, Union, cast
from typing import TYPE_CHECKING

if TYPE_CHECKING:
from ..profilers.float_column_profile import FloatColumn
Expand Down Expand Up @@ -74,7 +74,8 @@ def plot_histograms(
if not column_names and not column_inds:
inds_to_graph = list(range(len(profile_list)))
elif not column_inds:
for column in cast(list[Union[str, int]], column_names):
assert column_names is not None
for column in column_names:
col = column
if isinstance(col, str):
col = col.lower()
Expand All @@ -97,9 +98,8 @@ def is_index_graphable_column(ind_to_graph: int) -> bool:
"""
col_profiler = profile_list[ind_to_graph]
data_compiler = col_profiler.profiles["data_type_profile"]
if cast(
ColumnPrimitiveTypeProfileCompiler, data_compiler
).selected_data_type not in ["int", "float"]:
assert isinstance(data_compiler, ColumnPrimitiveTypeProfileCompiler)
if data_compiler.selected_data_type not in ["int", "float"]:
return False
return True

Expand Down Expand Up @@ -127,9 +127,8 @@ def is_index_graphable_column(ind_to_graph: int) -> bool:
for col_ind, ax in zip(inds_to_graph, axs):
col_profiler = profile_list[col_ind]
data_compiler = col_profiler.profiles["data_type_profile"]
data_type = cast(
ColumnPrimitiveTypeProfileCompiler, data_compiler
).selected_data_type
assert isinstance(data_compiler, ColumnPrimitiveTypeProfileCompiler)
data_type = data_compiler.selected_data_type
data_type_profiler = data_compiler._profiles[data_type]
ax = plot_col_histogram(
data_type_profiler, ax=ax, title=str(data_type_profiler.name)
Expand Down Expand Up @@ -266,7 +265,8 @@ def plot_col_missing_values(
is_own_fig = True
# in case user passed their own axes
else:
fig = cast(Figure, ax.figure)
assert ax.figure is not None
fig = ax.figure

# loop through eac column plotting their null values
for col_id, col_profiler in enumerate(col_profiler_list):
Expand Down