Data analysis difficult python (3) pandas a basic function

table of Contents

  Here pandas common basic functions, and basic data types are compared python can see the advantages of working with large data sets pandas in.

1. Rebuild the index

(1) Function: REINDEX

(2) effect: Create a new object in line with the new index.

(3) Content:

  When calling Series reindex method, the array will be arranged according to the new index, if not previously exist, NaN missing values will be introduced.

  When you call reindex method DataFrame, it will change the row and column index. When only a passing sequence, line rebuild indexes; when keyword arguments passed columns, the column will rebuild the index.

(4) important parameters: ffill

  effect: when the index rebuild interpolation, in order to label the complementary data is not data.

(5) Examples

2. Delete the entry axial

(1) Function: drop

(2) action: remove one or more entries in the axial direction.

(3) Content:

  Returns the value of a new object is deleted from the indication value contained or axially.

  When you call drop method Series, string or sequence of strings passed as a parameter and returns a list of objects.

  DataFrame drop method is invoked, passing the string tag sequence listing delete rows based on the value (0 axis), the incoming axis = axis = 1 or column labels will delete the value 'columns' The.

(4) the important parameters: inplace

  role: clear the data to be deleted, and returns the data after deletion.

(5) Examples

3. index, selecting the filter

(1)索引
  Series的索引可以不只是整数,也可以是小数,字符串,切片,字符串索引列表,布尔值索引。还可以是字符串双向切片。
  DataFrame的索引可以是字符串,字符串索引列表选择列,切片和布尔值索引选择行。

Guess you like

Origin www.cnblogs.com/ITXiaoAng/p/12392342.html