Skip to content

nicer error message on duplicate columns names #118

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
jreback opened this issue Mar 29, 2017 · 1 comment
Closed

nicer error message on duplicate columns names #118

jreback opened this issue Mar 29, 2017 · 1 comment

Comments

@jreback
Copy link

jreback commented Mar 29, 2017

pandas-dev/pandas#15838 (comment)

In [9]: fastparquet.__version__
Out[9]: '0.0.5'

In [10]: fastparquet.write?

In [11]: df = pd.DataFrame(np.arange(12).reshape(4, 3), columns=list('aaa'))

In [13]: fastparquet.write('foo', df)
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-13-030e6747feb8> in <module>()
----> 1 fastparquet.write('foo', df)

/Users/jreback/miniconda3/envs/pandas/lib/python3.6/site-packages/fastparquet/writer.py in write(filename, data, row_group_offsets, compression, file_scheme, open_with, mkdirs, has_nulls, write_index, partition_on, fixed_text, append, object_encoding, times)
    747     fmd = make_metadata(data, has_nulls=has_nulls, ignore_columns=ignore,
    748                         fixed_text=fixed_text, object_encoding=object_encoding,
--> 749                         times=times)
    750 
    751     if file_scheme == 'simple':

/Users/jreback/miniconda3/envs/pandas/lib/python3.6/site-packages/fastparquet/writer.py in make_metadata(data, has_nulls, ignore_columns, fixed_text, object_encoding, times)
    608                      object_encoding.get(column, None))
    609         fixed = None if fixed_text is None else fixed_text.get(column, None)
--> 610         if str(data[column].dtype) == 'category':
    611             se, type = find_type(data[column].cat.categories,
    612                                  fixed_text=fixed, object_encoding=oencoding)

/Users/jreback/pandas/pandas/core/generic.py in __getattr__(self, name)
   2888             if name in self._info_axis:
   2889                 return self[name]
-> 2890             return object.__getattribute__(self, name)
   2891 
   2892     def __setattr__(self, name, value):

AttributeError: 'DataFrame' object has no attribute 'dtype'
@jreback
Copy link
Author

jreback commented Mar 29, 2017

you can do df.columns.is_unique to check this FYI

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant