python - change pandas 0.13.0 "print dataframe" to print dataframe like in earlier versions -


in new version 0.13.0 of pandas, dataframe df printed in 1 long list of numbers using

df 

or

print df 

instead of overview, before, possible using

df.info() 

is possible change default 'df' or 'print df' command show :

in [12]: df.info() <class 'pandas.core.frame.dataframe'> datetimeindex: 4319 entries, 2010-02-18 00:00:00 2010-03-13 23:15:00 data columns (total 2 columns): qint    4319  non-null values qhea    4319  non-null values dtypes: float32(2) 

again instead of:

in [11]: df out[11]:                                   qint         qhea 2010-02-18 00:00:00         169.666672     0.000000 2010-02-18 00:15:00         152.000000    -0.000000 2010-02-18 00:15:00         152.000000    -0.000000 2010-02-18 00:30:00         155.000000    -0.000000 2010-02-18 00:30:04         155.063950    -0.000000 2010-02-18 00:30:04         155.063950 -1136.823364 2010-02-18 00:45:00         169.666672  4587.430176 2010-02-18 01:00:00         137.333328  4532.890137 2010-02-18 01:00:00         137.333328  4532.890137 2010-02-18 01:15:00         177.000000  4464.479980 2010-02-18 01:15:00         177.000000  4464.479980 2010-02-18 01:30:00         169.666672  4391.839844 2010-02-18 01:30:00         169.666672  4391.839844 2010-02-18 01:45:00         155.000000  4313.049805 2010-02-18 01:45:00         155.000000  4313.049805 2010-02-18 02:00:00         144.666672  4230.100098 2010-02-18 02:15:00         162.333328  4144.819824 2010-02-18 02:15:00         162.333328  4144.819824 2010-02-18 02:30:00         177.000000  4059.689941 2010-02-18 02:45:00         144.666672  3987.149902 2010-02-18 02:45:00         144.666672  3987.149902 2010-02-18 03:00:00         155.000000  3924.629883 2010-02-18 03:00:00         155.000000  3924.629883 2010-02-18 03:15:00         162.333328  3865.129883 2010-02-18 03:15:00         162.333328  3865.129883 2010-02-18 03:30:00         162.333328  3811.050049 2010-02-18 03:30:00         162.333328  3811.050049 2010-02-18 03:45:00         152.000000  3765.590088 2010-02-18 03:45:00         152.000000  3765.590088 2010-02-18 04:00:00         162.333328  3735.080078 2010-02-18 04:15:00         162.333328  3703.169922 2010-02-18 04:15:00         162.333328  3703.169922 2010-02-18 04:30:00         144.666672  3673.139893 2010-02-18 04:45:00         169.666672  3647.100098 2010-02-18 04:45:00         169.666672  3647.100098 2010-02-18 05:00:00         162.333328  3622.129883 2010-02-18 05:15:00         155.000000  3594.159912 2010-02-18 05:15:00         155.000000  3594.159912 2010-02-18 05:30:00         159.333328  3569.699951 2010-02-18 05:30:00         159.333328  3569.699951 2010-02-18 05:45:00         147.666672  3551.179932 2010-02-18 05:45:00         147.666672  3551.179932 2010-02-18 06:00:00         177.000000  3531.669922 2010-02-18 06:00:00         177.000000  3531.669922 2010-02-18 06:15:00         159.333328  3514.679932 2010-02-18 06:15:00         159.333328  3514.679932 2010-02-18 06:30:00         155.000000  3499.669922 2010-02-18 06:30:00         155.000000  3499.669922 2010-02-18 06:45:00         155.000000  3485.320068 2010-02-18 06:45:00         155.000000  3485.320068 2010-02-18 06:59:54.750000  162.291245    19.999992 2010-02-18 06:59:54.750000  162.291245     0.000000 2010-02-18 07:00:00         162.333328     0.000000 2010-02-18 07:00:00         162.333328     0.000000 2010-02-18 07:15:00         166.666672     0.000000 2010-02-18 07:15:00         166.666672     0.000000 2010-02-18 07:30:00         155.000000     0.000000 2010-02-18 07:30:00         155.000000     0.000000 2010-02-18 07:45:00         155.000000     0.000000 2010-02-18 07:45:00         155.000000     0.000000                                    ...          ...  [4319 rows x 2 columns] 

set

pd.options.display.large_repr = 'info' 

the default of v.0.13 'truncate'.

in [93]: df = pd.dataframe(np.arange(4319*2).reshape(4319,2))  in [94]: pd.options.display.large_repr = 'info'  in [95]: df out[95]:  <class 'pandas.core.frame.dataframe'> int64index: 4319 entries, 0 4318 data columns (total 2 columns): 0    4319 non-null int32 1    4319 non-null int32 dtypes: int32(2) 

i found searching string 'info()' in output of:

in [65]: pd.set_option? 

to make default behavior interactive sessions:

if haven't set already, define environment variable pythonstartup /home/user/bin/startup.py

then edit/create /home/user/bin/startup.py contain like

import pandas pd pd.options.display.large_repr = 'info' 

now, whenever start interactive python session, startup.py file executed, you'll have access pandas through pd variable, , large_repr default 'info'.


Comments

Popular posts from this blog

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -