DataFrame Basic Functions

Source: Internet
Author: User
Keywords dataframe pandas dataframe pandas dataframe functions

Here intoduces some basic functions of DataFrame.


Constructor

DataFrame([data, index, columns, dtype, copy]) #Construct data frame


Properties and data
DataFrame.axes #index: row labels; columns: column labels
DataFrame.as_matrix([columns]) #Convert to matrix
DataFrame.dtypes #Return data types
DataFrame.ftypes #Return the data type float64:dense of each column
DataFrame.get_dtype_counts() #Return the number of data types in the data frame
DataFrame.get_ftype_counts() #Return the data frame data type float64: the number of dense
DataFrame.select_dtypes([include, include]) #Select sub-data frame according to data type
DataFrame.values #Numpy display method
DataFrame.axes #Return the label name of the horizontal and vertical coordinates
DataFrame.ndim #Return the latitude of the data frame
DataFrame.size #Return the number of data frame elements
DataFrame.shape #Return the shape of the data frame
DataFrame.memory_usage() #Storage of each column



Type conversion
DataFrame.astype(dtype[, copy, errors]) #Convert data type
DataFrame.copy([deep]) #deep deep copy data
DataFrame.isnull() #return null value in Boolean way
DataFrame.notnull() #return non-null value in Boolean way


Indexing and iteration
DataFrame.head([n]) #Return the first n rows of data
DataFrame.at #Quick label constant accessor
DataFrame.iat #Fast integer constant accessor
DataFrame.loc #label positioning, using the name
DataFrame.iloc #Integer positioning, using numbers
DataFrame.insert(loc, column, value) #In a special place loc[number] insert column[column name] a column of data
DataFrame.iter() #Iterate over infor axis
DataFrame.iteritems() #Iterator that returns column names and sequences
DataFrame.iterrows() #Iterator returning index and sequence
DataFrame.itertuples([index, name]) #Iterate over DataFrame rows as namedtuples, with index value as first element of the tuple.
DataFrame.lookup(row_labels, col_labels) #Label-based “fancy indexing” function for DataFrame.
DataFrame.pop(item) #Return deleted items
DataFrame.tail([n]) #Return the last n rows
DataFrame.xs(key[, axis, level, drop_level]) #Returns a cross-section (row(s) or column(s)) from the Series/DataFrame.
DataFrame.isin(values) #Whether contains elements in the data frame
DataFrame.where(cond[, other, inplace, …]) #conditional filter
DataFrame.mask(cond[, other, inplace, …]) #Return an object of same shape as self and whose corresponding entries are from self where cond is False and otherwise are from other.
DataFrame.query(expr[, inplace]) #Query the columns of a frame with a boolean expression.



Binary operation
DataFrame.add(other[,axis,fill_value]) #Addition, element pointing
DataFrame.sub(other[,axis,fill_value]) #Subtraction, element pointing
DataFrame.mul(other[, axis,fill_value]) #Multiplication, element pointing
DataFrame.div(other[, axis,fill_value]) #decimal division, element pointing
DataFrame.truediv(other[, axis, level, …]) #True division, element pointing
DataFrame.floordiv(other[, axis, level, …]) #Fall down to divide, element points
DataFrame.mod(other[, axis,fill_value]) #modulo operation, element pointing
DataFrame.pow(other[, axis,fill_value]) #Power operation, element pointing
DataFrame.radd(other[, axis,fill_value]) #Addition on the right, the element points to
DataFrame.rsub(other[, axis,fill_value]) #Subtraction on the right, element pointing
DataFrame.rmul(other[, axis,fill_value]) #right side multiplication, element pointing
DataFrame.rdiv(other[, axis,fill_value]) #Right decimal division on the right, element pointing
DataFrame.rtruediv(other[, axis, …]) #True division on the right, element pointing
DataFrame.rfloordiv(other[, axis, …]) #The right side is rounded down, the element points
DataFrame.rmod(other[, axis,fill_value]) #Modular operation on the right, element pointing
DataFrame.rpow(other[, axis,fill_value]) #right power operation, element pointing
DataFrame.lt(other[, axis, level]) #Similar to Array.lt
DataFrame.gt(other[, axis, level]) #Similar to Array.gt
DataFrame.le(other[, axis, level]) #Similar to Array.le
DataFrame.ge(other[, axis, level]) #Similar to Array.ge
DataFrame.ne(other[, axis, level]) #Similar to Array.ne
DataFrame.eq(other[, axis, level]) #Similar to Array.eq
DataFrame.combine(other,func[,fill_value, …]) #Add two DataFrame objects and do not propagate NaN values, so if for a
DataFrame.combine_first(other) #Combine two DataFrame objects and default to non-null values in frame calling the method.


Function Application & Grouping & Window
DataFrame.apply(func[, axis, broadcast, …]) #application function
DataFrame.applymap(func) #Apply a function to a DataFrame that is intended to operate elementwise, i.e.
DataFrame.aggregate(func[, axis]) #Aggregate using callable, string, dict, or list of string/callables
DataFrame.transform(func, *args, **kwargs) #Call function producing a like-indexed NDFrame
DataFrame.groupby([by, axis, level, …]) #Group
DataFrame.rolling(window[, min_periods, …]) #rolling window
DataFrame.expanding([min_periods, freq, …]) #Expand the window
DataFrame.ewm([com, span, halflife, …]) #exponential weight window

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.