ipython notebook pandas max allowable columns

后端 未结 3 1645
梦谈多话
梦谈多话 2020-12-24 03:17

I have a simple csv file with ten columns!

When I set the following option in the notebook and print my csv file (which is in a pandas dataframe) it doesn\'t print a

3条回答
  •  没有蜡笔的小新
    2020-12-24 03:53

    I assume you want to display your data in the notebook than the following options work fine for me (IPython 2.3):

    import pandas as pd
    from IPython.display import display
    data = pd.read_csv('yourdata.txt')
    

    Either directly set the option

    pd.options.display.max_columns = None
    display(data)
    

    Or, use the set_option method you showed actually works fine as well

    pd.set_option('display.max_columns', None)
    display(data)
    

    If you don't want to set this options for the whole script use the context manager

    with pd.option_context('display.max_columns', None):
        display(data)
    

    If this doesn't help, you might give a minimal example to reproduce your issue.

提交回复
热议问题