Skip to content

Commit d25dd52

Browse files
committed
fix imports
1 parent 804ed17 commit d25dd52

2 files changed

Lines changed: 9 additions & 7 deletions

File tree

histogram.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919

2020
import matplotlib.pyplot as plt
2121

22+
import pandas as pd
23+
2224
from krum import aggregators, tools
2325

2426
# Change common font for the default LaTeX one
@@ -62,7 +64,7 @@ def gtk_main():
6264
gtk_lazy_main = thread
6365
# Submit the job to the main loop
6466
GLib.idle_add(closure)
65-
except Exception:
67+
except Exception as err:
6668

6769
def gtk_run(closure):
6870
"""Sink in case GTK cannot be used.
@@ -220,7 +222,7 @@ def __init__(self, path_results):
220222
# Load training data
221223
path_study = path_results / "study"
222224
try:
223-
data_study = pandas.read_csv(
225+
data_study = pd.read_csv(
224226
path_study, sep="\t", index_col=0, na_values=" nan"
225227
)
226228
data_study.index.name = "Step number"
@@ -232,7 +234,7 @@ def __init__(self, path_results):
232234
# Load evaluation data
233235
path_eval = path_results / "eval"
234236
try:
235-
data_eval = pandas.read_csv(path_eval, sep="\t", index_col=0)
237+
data_eval = pd.read_csv(path_eval, sep="\t", index_col=0)
236238
data_eval.index.name = "Step number"
237239
except Exception as err:
238240
tools.warning(
@@ -457,7 +459,7 @@ def include(self, data, *cols, errs=None, lalp=1.0, ccnt=None):
457459
# Recover the dataframe if a session was given
458460
if isinstance(data, Session):
459461
data = data.data
460-
elif not isinstance(data, pandas.DataFrame):
462+
elif not isinstance(data, pd.DataFrame):
461463
raise RuntimeError(
462464
f"Expected a Session or DataFrame for 'data', got a {tools.fullqual(type(data))!r}"
463465
)
@@ -531,7 +533,7 @@ def include_single(self, data, key, col, err=None, lalp=1.0, ccnt=None):
531533
# Recover the dataframe if a session was given
532534
if isinstance(data, Session):
533535
data = data.data
534-
elif not isinstance(data, pandas.DataFrame):
536+
elif not isinstance(data, pd.DataFrame):
535537
raise RuntimeError(
536538
f"Expected a Session or DataFrame for 'data', got a {tools.fullqual(type(data))!r}"
537539
)
@@ -719,7 +721,7 @@ def include(self, data):
719721
self
720722
"""
721723
# Convert 'pandas.Series' to numpy
722-
if isinstance(data, pandas.Series):
724+
if isinstance(data, pd.Series):
723725
data = data.to_numpy()
724726
# Make the histogram
725727
self._ax.hist(data, bins=self._bins)

krum/experiments/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646

4747
import pathlib
4848

49-
import tools
49+
from krum import tools
5050

5151
# ---------------------------------------------------------------------------- #
5252
# Load all local modules

0 commit comments

Comments
 (0)