The View
is a very useful function to allow me to see cross-section of large data frames in R.
Is there any equivalent of R's View
function for Python's pandas DataFrame
?
I use RStudio
for R and PyCharm
for Python.
Dplython. Package dplython is dplyr for Python users. It provide infinite functionality for data preprocessing.
Learn More. Heey great post, but pandas has very similar functions as dplyr. If you use those instead, you get statements very similar to your dplyr statements and you would get the same readability.
Developers describe Pandas as "High-performance, easy-to-use data structures and data analysis tools for the Python programming language".
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)
After putting in option (Notice how the output continues)
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/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With