Do some muggle things, good things tidy up a wave,, do some muggle things, good things tidy up a wave,, do some muggle things, good things tidy up a wave,,,
First, a dataframe and Matrix interchange, first of all, a D a T a F R a m E and m a T r I x interchange first dataframe and Matrix interchange
#coding =utf-8
Import pandas as PD
import numpy as NP
df = PD. DataFrame (Np.random.randn (3,4), columns=list (' ABCD '))
print DF
print df.values
print Df.as_matrix ( Columns=none)
One more Pandas translation handbook and a translation manual for p a n d a s and a pandas translation manual.
Customarily, we import as follows habitually, we do the following imports in [1]: Import pandas as PD in [2]: Import NumPy as NPS in [3]: Import MATPL Otlib.pyplot as Plt object Creation Create object see the Data Structure Intro section View data structure Introduction Creating a Series by passing a LIS T of values, letting pandas create a default integer index uses the passed value list sequence to create a sequence, letting pandas create the defaults for the integers indexed in [4]: s = PD. Series ([1,3,5,np.nan,6,8]) in [5]: s out[5]: 0 1 1 3 2 5 3 Nan 4 6 5 8 Dtype:float64 Creating a Da
Taframe by passing a numpy array, with a datetime index and labeled columns.
Creates a data frame using the passed NumPy array and uses the date index and tag columns. In [6]: Dates = pd.date_range (' 20130101 ', periods=6) in [7]: Dates out[7]: <class ' Pandas.tseries.index.DatetimeIndex ' > [2013-01-01, ..., 2013-01-06] length:6, Freq:d, Timezone:none in [8]: df = PD. DataFrame (Np.random.randn (6,4), index=dates,columns=list (' ABCD ')) in [9]: DF out[9]: A B C D 2013-01-01 0.469112-0.282863-1.509059-1.135632 2013-01-02 1.212112-0.173215 0.119209-1.044236 2013-01-03-0.861849-2.104569-0.494929 1.071804 2013-01-04 0.721555-0.706771-1.039575 0 .271860 2013-01-05-0.424972 0.567020 0.276232-1.087401 2013-01-06-0.673690 0.113648-1.478427 0.524988 Creating a D
Ataframe by passing a dict of objects so can be converted to series-like.
Creates a data frame using a Dictionary object that passes the convertible sequence. In [ten]: DF2 = PD. DataFrame ({' A ': 1., ....: ' B ': PD. Timestamp (' 20130102 '), ....: ' C ': PD. Series (1,index=list (range (4)), dtype= ' float32 '), ....: ' D ': Np.array ([3] * 4,dtype= ' int32 '),.. ..: ' E ': PD.
Categorical (["Test", "Train", "Test", "Train"]), ....: ' F ': ' foo '}) ....: in [all]: DF2 out[11]: A B C D E F 0 1 2013-01-02 1 3 Test foo 1 1 2013-01-02 1 3 train foo 2 1 2013-01-02 1 3 Test Foo 3 1 2013-01-02 1 3 train foo having specific dtypes all explicit types in []: Df2.dtypes out[12]: A Float64 B Datetime64[ns] C float32 D int32 E category F object Dtype: Object If you ' re using IPython, tab completion for column names (as-well-as public attributes) is automatically enabled. Here's a subset of the attributes that'll be completed: If you're using Ipython, the label complement column names (and public properties) are automatically enabled. Here is a subset of the properties that will be completed: in []: df2.<tab> DF2. A Df2.boxplot df2.abs df2. C df2.add df2.clip df2.add_prefix df2.clip_lower df2.add_suffix df2.clip_upper df2.align Df2.columns df2.all df2.combine df2.any df2.combineadd df2.append DF2 . Combine_first df2.apply df2.combinemult df2.applymap df2.compound df2.as_blocks Df2.conso Lidate df2.asfreq df2.convert_objects df2.as_matrix df2.copy df2.astype Df2.corr df2.at Df2.corrwith df2.at_time Df2.count df2.axes Df2.cov DF2. B Df2.cummax df2.between_time df2.cummin df2.bfill df2.cumprod df2.blocks Df2.cumsum Df2.bool DF2. D as can see, the columns A, B, C, and D is automatically tab completed. E is there as well;
The rest of the attributes has been truncated for brevity. As you can see, columns A, B, C, and D are also auto-complete labels. E is also available;
For simplicity, the subsequent properties display is truncated. Viewing Data View the Basics section refer to the basic part see the Top & bottom rows of the frame view frames top and bottom row in [+]: Df.head () O UT[14]: A B C D 2013-01-01 0.469112-0.282863-1.509059-1.135632 2013-01-02 1.212112-