Merge pull request #929 from paulromano/pandas-fix

Fix pandas issue related to MultiIndex conversion
This commit is contained in:
Sterling Harper 2017-11-09 23:26:25 -05:00 committed by GitHub
commit 0beb4cb937
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 3 deletions

View file

@ -1664,8 +1664,10 @@ class Tally(IDManagerMixin):
new_column.extend(['']*delta_len)
columns[i] = tuple(new_column)
# Create and set a MultiIndex for the DataFrame's columns
df.columns = pd.MultiIndex.from_tuples(columns)
# Create and set a MultiIndex for the DataFrame's columns, but only
# if any column actually is multi-level (e.g., a mesh filter)
if any(len(c) > 1 for c in columns):
df.columns = pd.MultiIndex.from_tuples(columns)
# Modify the df.to_string method so that it prints formatted strings.
# Credit to http://stackoverflow.com/users/3657742/chrisb for this trick

View file

@ -61,7 +61,7 @@ kwargs = {
# Required dependencies
'install_requires': [
'six', 'numpy>=1.9', 'h5py', 'scipy', 'ipython', 'matplotlib',
'pandas<0.21.0', 'lxml', 'uncertainties'
'pandas', 'lxml', 'uncertainties'
],
# Optional dependencies