-
-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Description
Code Sample, a copy-pastable example if possible
Sample (1)
import tensorflow as tf
import pandas as pd
with tf.gfile.GFile('test.csv') as f: pd.read_csv(f)
Sample (2)
import tensorflow as tf
import pandas as pd
with tf.gfile.GFile('test.csv.gz') as f: pd.read_csv(f, compression='gzip')
Problem description
I'm converting some code to run on Google Cloud, and in the process I'm changing the way my datasets are read. I started using tf.gfile.GFile implementation from Tensorflow, as it is portable and can read both local files and files from storage buckets.
Also in the process I'm changing my code to work with Python 2 instead of Python 3.
Not sure if it is a bug in Pandas or Tensorflow code, but this issue seems similar to #14222, so I'm opening an issue here first.
To reproduce, create two files: test.csv and test.csv.gz locally. Run both samples in python 2. The sample (1) works fine, but sample (2) crashes with an error: "AttributeError: 'NoneType' object has no attribute 'Tell'"
Strangely, both samples work fine in python 3. I'm using the same library versions in python 2 and 3: pandas 0.19.2 and tensorflow 1.0.
Expected Output
Both samples should work in python 2.
Output of pd.show_versions()
pandas: 0.19.2
nose: None
pip: 9.0.1
setuptools: 32.1.0
Cython: None
numpy: 1.12.0
scipy: 0.19.0
statsmodels: None
xarray: None
IPython: 5.3.0
sphinx: None
patsy: None
dateutil: 2.5.2
pytz: 2016.10
blosc: None
bottleneck: None
tables: None
numexpr: None
matplotlib: 2.0.0
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: None
httplib2: 0.10.3
apiclient: None
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: None
boto: None
pandas_datareader: None