Skip to content

TST: reverse hdf_fix #4490

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 7, 2013
Merged
Show file tree
Hide file tree
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
5 changes: 3 additions & 2 deletions pandas/io/pytables.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,11 +332,12 @@ def __len__(self):
def __unicode__(self):
output = '%s\nFile path: %s\n' % (type(self), pprint_thing(self._path))
if self.is_open:
if len(list(self.keys())):
lkeys = list(self.keys())
if len(lkeys):
keys = []
values = []

for k in self.keys():
for k in lkeys:
try:
s = self.get_storer(k)
if s is not None:
Expand Down
16 changes: 3 additions & 13 deletions pandas/io/tests/test_pytables.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

import pandas
from pandas import (Series, DataFrame, Panel, MultiIndex, bdate_range,
date_range, Index, DatetimeIndex)
date_range, Index, DatetimeIndex, isnull)
from pandas.io.pytables import (HDFStore, get_store, Term, read_hdf,
IncompatibilityWarning, PerformanceWarning,
AttributeConflictWarning, DuplicateWarning,
Expand Down Expand Up @@ -2404,14 +2404,11 @@ def test_frame_select(self):
def test_string_select(self):

# GH 2973

df = tm.makeTimeDataFrame()

with ensure_clean(self.path) as store:

df = tm.makeTimeDataFrame()

# test string ==/!=

df['x'] = 'none'
df.ix[2:7,'x'] = ''

Expand All @@ -2421,25 +2418,18 @@ def test_string_select(self):
expected = df[df.x == 'none']
assert_frame_equal(result,expected)

print("bogus test")
print(df)
print(store)
result = store.select('df',Term('x!=none'))
print(result)
expected = df[df.x != 'none']
print(expected)
assert_frame_equal(result,expected)

df2 = df.copy()
df2.x[df2.x==''] = np.nan
df2.loc[df2.x=='','x'] = np.nan

from pandas import isnull
store.append('df2',df2,data_columns=['x'])
result = store.select('df2',Term('x!=none'))
expected = df2[isnull(df2.x)]
assert_frame_equal(result,expected)


# int ==/!=
df['int'] = 1
df.ix[2:7,'int'] = 2
Expand Down