equivalent of R's View for Python's pandas

A quicker option might be to set the pandas dataframe so it doesn't line wrap by putting this line of code:

import pandas
pandas.set_option('expand_frame_repr', False)

I'm using Sublime Text 2 and this is how it looks:

Before putting in option (Notice how the output wraps the text around) Before

After putting in option (Notice how the output continues) After

Also make sure that 'View' > 'Word Wrap' is not checked.

Additionally, you can print out more or less as you need by using head(#) like this:

mydf = pandas.DataFrame.from_csv('myfile.csv', header=1)
print mydf.head(20) # Prints first 20 lines

Here's some other pandas options:

pandas.set_option('display.max_columns', 0) # Display any number of columns
pandas.set_option('display.max_rows', 0) # Display any number of rows

Spyder within Anaconda (or R Studio for Python as I like to call it) gives you the ability to view and sort entire dataframes the same way you would in R using the variable explorer.

https://www.continuum.io/

enter image description here


If you are a regular R user and using python also and you like R studio more then I would recommend you to use R Studio to write python scripts. You can use the reticulate library for the same. reticulate::conda_python() will take you to the python console and to write a script, just create new python script from the menu. Next consider the following code written in python:

import pandas as pd
df_python = pd.DataFrame({'num_legs': [2, 4, 8, 0],
               'num_wings': [2, 0, 0, 0],
               'num_specimen_seen': [10, 2, 1, 8]},
              index=['falcon', 'dog', 'spider', 'fish'])

This will create a pandas dataframe df_python

enter image description here

Now exit from the python console using exit keyword. Now when you will use py$ then you can access python objects. This can let you use this dataframe in R as well and hence you can view the dataframe also using View(py$df_python) and you will have the following output.

enter image description here

Keep Coding!