Display() in Python

后端 未结 2 1177
天命终不由人
天命终不由人 2021-02-18 18:37

I\'m trying to get my data head to display but I get an error message: NameError: name \'display\' undefined

import pandas as pd
data = pd.Data         


        
相关标签:
2条回答
  • 2021-02-18 19:15

    display is a function in the IPython.display module that runs the appropriate dunder method to get the appropriate data to ... display. If you really want to run it

    from IPython.display import display
    import pandas as pd
    
    data = pd.DataFrame(data=[tweet.text for tweet in tweets], columns=['Tweets'])
    
    display(data.head(10))
    

    But don't. IPython is already doing that for you. Just do:

    data.head(10)
    

    You even might have IPython uninstalled, try:

    pip install IPython
    

    or if running pip3:

    pip3 install IPython
    
    0 讨论(0)
  • 2021-02-18 19:22

    To solve the problem on pycaret, you have to open the below file -

    ..\env\Lib\site-packages\pycaret\datasets.py
    

    and add the line of code -

    from IPython.display import display
    
    0 讨论(0)
提交回复
热议问题