26
26
from tensorflow .python .training import coordinator
27
27
from tensorflow .python .training import queue_runner_impl
28
28
29
+
30
+ def print_debug_info (module_pd , has_pandas , msg ):
31
+ if module_pd is None :
32
+ print ('HAS_PANDAS {} and module pd is None. Msg {}' .format (has_pandas , msg ))
33
+ else :
34
+ has_data_frame = hasattr (module_pd , 'DataFrame' )
35
+ print ('HAS_PANDAS {} and hasattr(pd, "DataFrame") {}. Msg {}' .format (
36
+ has_pandas , has_data_frame , msg ))
37
+ if not has_data_frame :
38
+ print ('symbols in pd {}' .format (dir (module_pd )))
39
+
40
+
29
41
try :
30
42
# pylint: disable=g-import-not-at-top
31
43
import pandas as pd
32
44
HAS_PANDAS = True
45
+ print_debug_info (pd , HAS_PANDAS , 'import statement' )
33
46
except IOError :
34
47
# Pandas writes a temporary file during import. If it fails, don't use pandas.
35
48
HAS_PANDAS = False
49
+ print_debug_info (None , HAS_PANDAS , 'import statement' )
36
50
except ImportError :
37
51
HAS_PANDAS = False
52
+ print_debug_info (None , HAS_PANDAS , 'import statement' )
38
53
39
54
40
55
class PandasIoTest (test .TestCase ):
@@ -43,6 +58,7 @@ def makeTestDataFrame(self):
43
58
index = np .arange (100 , 104 )
44
59
a = np .arange (4 )
45
60
b = np .arange (32 , 36 )
61
+ print_debug_info (pd , HAS_PANDAS , 'in test case' )
46
62
x = pd .DataFrame ({'a' : a , 'b' : b }, index = index )
47
63
y = pd .Series (np .arange (- 32 , - 28 ), index = index )
48
64
return x , y
0 commit comments