Skip to content
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

UnboundLocalError: local variable 'mask' referenced before assignment #12726

Closed
TurnaevEvgeny opened this issue Mar 28, 2016 · 1 comment
Closed
Labels
Bug Duplicate Report Duplicate issue or pull request Indexing Related to indexing on series/frames, not to indexes themselves

Comments

@TurnaevEvgeny
Copy link

Code Sample, a copy-pastable example if possible

pd.to_datetime(pd.Series(['Jul 31, 2009', '2010-01-10', None])).to_frame().replace('', np.nan)

File "/var/www/envs/fring_internal/local/lib/python2.7/site-packages/pandas/core/generic.py", line 3110, in replace
    inplace=inplace, regex=regex)
  File "/var/www/envs/fring_internal/local/lib/python2.7/site-packages/pandas/core/internals.py", line 2870, in replace
    return self.apply('replace', **kwargs)
  File "/var/www/envs/fring_internal/local/lib/python2.7/site-packages/pandas/core/internals.py", line 2823, in apply
    applied = getattr(b, f)(**kwargs)
  File "/var/www/envs/fring_internal/local/lib/python2.7/site-packages/pandas/core/internals.py", line 607, in replace
    if not mask.any():
UnboundLocalError: local variable 'mask' referenced before assignment

Expected Output

Not sure, raise a TypeError("datetime64[ns] is not coercible to string") probably.

output of pd.show_versions()

INSTALLED VERSIONS

commit: None
python: 2.7.6.final.0
python-bits: 64
OS: Darwin
OS-release: 14.3.0
machine: x86_64
processor: i386
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8

pandas: 0.17.1
nose: 1.3.7
pip: 7.0.3
setuptools: 17.0
Cython: 0.23.4
numpy: 1.8.2
scipy: 0.16.0
statsmodels: None
IPython: 3.2.0
sphinx: 1.3.1
patsy: None
dateutil: 1.5
pytz: 2013.7
blosc: None
bottleneck: None
tables: None
numexpr: None
matplotlib: 1.3.1
openpyxl: 2.3.0
xlrd: 0.9.4
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: None
httplib2: None
apiclient: None
sqlalchemy: 1.0.8
pymysql: None
psycopg2: 2.6.1 (dt dec pq3 ext lo64)
Jinja2: None

@jreback jreback added Bug Indexing Related to indexing on series/frames, not to indexes themselves Duplicate Report Duplicate issue or pull request labels Mar 29, 2016
@jreback
Copy link
Contributor

jreback commented Mar 29, 2016

dupe of #11698
closed by #11715 which is in 0.18.0

@jreback jreback closed this as completed Mar 29, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Duplicate Report Duplicate issue or pull request Indexing Related to indexing on series/frames, not to indexes themselves
Projects
None yet
Development

No branches or pull requests

2 participants