1

entered:

train['brand_name'].unique()

get the result:

array([nan, 'Razer', 'Target', ..., 'Astroglide', 'Cumberland Bay',
   'Kids Only'], dtype=object)

I need to see every value. there are some values represented by .... i want to know how to show those too.

thanks!

jpp
  • 159,742
  • 34
  • 281
  • 339
WJ Zhao
  • 61
  • 1
  • 6
  • 1
    `train['brain_name'].unique().tolist()` – Scott Boston Feb 07 '18 at 22:36
  • 1
    Possible duplicate of [Is there a way to (pretty) print the entire Pandas Series / DataFrame?](https://stackoverflow.com/questions/19124601/is-there-a-way-to-pretty-print-the-entire-pandas-series-dataframe) – tozCSS Feb 07 '18 at 23:10
  • i don't know how to accept Scott's answer. it is a comment not an answer format. pls help. – WJ Zhao Feb 13 '18 at 03:18

2 Answers2

0

This should work:

print('\n'.join(map(str, train['brand_name'].unique().tolist())))

Explanation:

  • \n represents new line character for printing.
  • map(str, lst) maps to strings in case you have non-text data in your list.
jpp
  • 159,742
  • 34
  • 281
  • 339
0

If you want to display all the rows in an IPython console or Jupyter then you should set the pd.options.display.max_rows to a value no less than the length of the Pandas Series you want to print (like pd.options.display.max_rows = len(train)), or you can just set it to None. You can do it in a context --with allows your change to be temporary.

with pd.option_context('display.max_rows', None):
    print train['brand_name'].value_counts()
    #or, alternatively
    #print pd.Series(train['brand_name'].unique())

More on Pandas' display-related options: https://pandas.pydata.org/pandas-docs/stable/options.html

tozCSS
  • 5,487
  • 2
  • 34
  • 31