Skip to content

Series.str.zfill() doesn't check type #13598

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

Closed
toobaz opened this issue Jul 9, 2016 · 6 comments
Closed

Series.str.zfill() doesn't check type #13598

toobaz opened this issue Jul 9, 2016 · 6 comments
Labels
Bug Error Reporting Incorrect or improved errors from pandas Strings String extension data type and string data
Milestone

Comments

@toobaz
Copy link
Member

toobaz commented Jul 9, 2016

Code Sample, a copy-pastable example if possible

In [5]: pd.Series(['a', 'b']).str.zfill('hi')
Out[5]: 
0   NaN
1   NaN
dtype: float64

Expected Output

A ValueError.

output of pd.show_versions()


In [3]: pd.show_versions()

INSTALLED VERSIONS
------------------
commit: a63bd12529ff309d957d714825b1753d0e02b7fa
python: 3.5.1.final.0
python-bits: 64
OS: Linux
OS-release: 4.5.0-2-amd64
machine: x86_64
processor: 
byteorder: little
LC_ALL: None
LANG: it_IT.utf8
LOCALE: it_IT.UTF-8

pandas: 0.18.1+174.ga63bd12
nose: 1.3.7
pip: 1.5.6
setuptools: 18.4
Cython: 0.23.4
numpy: 1.10.4
scipy: 0.16.0
statsmodels: 0.8.0.dev0+111ddc0
xarray: None
IPython: 5.0.0.dev
sphinx: 1.3.1
patsy: 0.3.0-dev
dateutil: 2.2
pytz: 2012c
blosc: None
bottleneck: 1.1.0dev
tables: 3.2.2
numexpr: 2.5
matplotlib: 1.5.1
openpyxl: None
xlrd: 0.9.4
xlwt: 1.1.2
xlsxwriter: 0.7.3
lxml: None
bs4: 4.4.0
html5lib: 0.999
httplib2: 0.9.1
apiclient: 1.5.0
sqlalchemy: 1.0.11
pymysql: None
psycopg2: None
jinja2: 2.8
boto: 2.38.0
pandas_datareader: 0.2.1

@jreback
Copy link
Contributor

jreback commented Jul 9, 2016

yep that's an error

@jreback jreback added Bug Error Reporting Incorrect or improved errors from pandas Strings String extension data type and string data Difficulty Novice labels Jul 9, 2016
@jreback jreback added this to the Next Major Release milestone Jul 9, 2016
@sinhrks
Copy link
Member

sinhrks commented Jul 12, 2016

Rather than adding type check logics on everywhere, adding a dummy call (like " ".zfill(width) may be easier.

@jreback
Copy link
Contributor

jreback commented Jul 12, 2016

not sure about that. Most strings can only accept string-likes, OR integers. Having a couple of common routines might help readablity.

_assure_string, _assure_integer

@sahildua2305
Copy link
Contributor

@jreback I'd like to fix this one as well. Can I go ahead and put a check in zfill or should I create separate routine as you mentioned?

@jreback
Copy link
Contributor

jreback commented Jul 13, 2016

I think make a separate check

@sahildua2305
Copy link
Contributor

Is there any place where such common routines are kept? If not, where should I keep this one?

@jreback jreback modified the milestones: 0.19.0, Next Major Release Jul 19, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Error Reporting Incorrect or improved errors from pandas Strings String extension data type and string data
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants