Skip to content

Commit

Permalink
fix: don't drop nans too aggressively
Browse files Browse the repository at this point in the history
Fixes #25
  • Loading branch information
kalekundert committed Mar 25, 2022
1 parent d109715 commit a001c8f
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 8 deletions.
7 changes: 7 additions & 0 deletions pyproject.toml
Expand Up @@ -46,6 +46,13 @@ wellmap = "wellmap.plot:main"
'Continuous Integration' = 'https://travis-ci.org/kalekundert/wellmap'
'Test Coverage' = 'https://coveralls.io/github/kalekundert/wellmap'

[tool.pytest.ini_options]
filterwarnings = [
'ignore::DeprecationWarning',
'ignore:A private pytest class or function was used.:pytest.PytestDeprecationWarning',
]
addopts = "--doctest-glob='*.rst'"

[tool.semantic_release]
build_command = 'python -m pip install flit && flit build'
version_variable = 'wellmap/__init__.py:__version__'
Expand Down
Binary file added tests/images/ref/nan_in_other_attr.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 0 additions & 5 deletions tests/pytest.ini

This file was deleted.

9 changes: 9 additions & 0 deletions tests/test_plot.nt
Expand Up @@ -166,6 +166,15 @@ test_show:
> x = 'a'
> y = 'c'
expected: nan_first.png
-
id: nan-in-other-attr
layout:
> [well]
> A1.x = 1
> A2.y = 2
> A3.x = 3
> A3.y = 4
expected: nan_in_other_attr.png
-
id: skip-wells
layout:
Expand Down
2 changes: 1 addition & 1 deletion wellmap/file.py
Expand Up @@ -275,7 +275,7 @@ def get_extras_kwarg():
for path in layout['path'].unique():
df = data_loader(path, **get_extras_kwarg())
df['path'] = path
data = data.append(df, sort=False)
data = pd.concat([data, df], sort=False)

## Merge the layout and the data into a single data frame:
if merge_cols is None:
Expand Down
4 changes: 2 additions & 2 deletions wellmap/plot.py
Expand Up @@ -455,8 +455,8 @@ class Colors:

def __init__(self, cmap, df, attr):
cols = ['plate', 'row_i', 'col_j']
labels = df\
.dropna()\
rows = df[attr].notna()
labels = df[rows]\
.sort_values(cols)\
.groupby(attr, sort=False)\
.head(1)
Expand Down

0 comments on commit a001c8f

Please sign in to comment.