Skip to content

Commit

Permalink
Upgrade Pandas and make a hack-y fix for pandas issue. Closes #67
Browse files Browse the repository at this point in the history
  • Loading branch information
Cindy committed Oct 24, 2017
1 parent 1134d6b commit 73c4171
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 9 deletions.
5 changes: 0 additions & 5 deletions onecodex/viz/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,4 @@
from onecodex.viz._distance import plot_distance
from onecodex.viz._metadata import plot_metadata

# If users want to put special characters in their plot labels
import sys
reload(sys)
sys.setdefaultencoding('utf-8')

__all__ = ['plot_heatmap', 'plot_pca', 'plot_distance', 'plot_metadata']
3 changes: 2 additions & 1 deletion onecodex/viz/_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ def plot_metadata(analyses, metadata='created_at', statistic=None, tax_id=None,
elif pd.api.types.is_bool_dtype(md[metadata]) or \
pd.api.types.is_categorical_dtype(md[metadata]) or \
pd.api.types.is_object_dtype(md[metadata]):
md.fillna(value='N/A', inplace=True)
na = {field: 'N/A' for field in md.columns}
md.fillna(value=na, inplace=True)
sns.boxplot(x=metadata, y='_data', data=md, palette='pastel', **kwargs)
else:
raise OneCodexException('Unplottable column type for metadata {}'.format(metadata))
Expand Down
3 changes: 2 additions & 1 deletion onecodex/viz/_pca.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ def plot_pca(analyses, threshold=None,
pca_vals = pd.DataFrame(pca_vals, index=df.index)
pca_vals.rename(columns=lambda x: "PCA{}".format(x + 1), inplace=True)
metadata.index = df.index
plot_data = pd.concat([pca_vals, metadata.fillna('N/A')], axis=1)
na = {field: 'N/A' for field in metadata.columns}
plot_data = pd.concat([pca_vals, metadata.fillna(na)], axis=1)

# Scatter plot of PCA
sns.set(style=kwargs.pop('style', 'darkgrid'))
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ requests_toolbelt>=0.7.0

# extensions
numpy>=1.11.0
pandas==0.19.2
pandas>=0.20.0,<0.21.0
matplotlib>=1.5.1
networkx>=1.11
seaborn==0.8
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
include_package_data=True,
zip_safe=False,
extras_require={
'all': ['numpy>=1.11.0', 'pandas>=0.18.1', 'matplotlib>1.5.1',
'all': ['numpy>=1.11.0', 'pandas>=0.20.0,<0.21.0', 'matplotlib>1.5.1',
'seaborn>=0.8', 'scikit-learn>=0.19.0', 'scikit-bio==0.4.2',
'networkx>=1.11'],
'testing': ['flake8', 'testfixtures', 'responses', 'coverage', 'pytest==3.0.5',
Expand Down

0 comments on commit 73c4171

Please sign in to comment.