官术网_书友最值得收藏!

Representing Univariate Data with the Series

The Series is the primary building block of pandas. It represents a one-dimensional array-like set of values of a single data type. It is often used to model zero or more measurements of a single variable. While it can appear like an array, a Series has an associated index that can be used to perform very efficient retrievals of values based upon labels.

A Series also performs automatic alignment of data between itself and other pandas objects. Alignment is a core feature of pandas where data is multiple pandas objects that are matched by label value before any operation is performed. This allows the simple application of operations without needing to explicitly code joins.

In this chapter, we will examine how to model measurements of a variable using a Series, including using an index to retrieve samples. This examination will include overviews of several patterns involved in index labeling, slicing and querying data, alignment, and re-indexing data.

Specifically, in this chapter we will cover the following topics:

  • Creating a series using Python lists, dictionaries, NumPy functions, and scalar values
  • Accessing the index and values properties of the Series
  • Determining the size and shape of a Series object
  • Specifying an index at the time of Series creation
  • Using heads, tails, and takes to access values
  • Value lookup by index label and position
  • Slicing and common slicing patterns
  • Alignment via index labels
  • Performing Boolean selection
  • Re-indexing a Series
  • In-place modification of values
主站蜘蛛池模板: 兴仁县| 固安县| 镇赉县| 福泉市| 云南省| 象州县| 徐汇区| 腾冲县| 龙门县| 鹤岗市| 泸定县| 瑞安市| 云南省| 定襄县| 石台县| 共和县| 遂川县| 榆中县| 嵊泗县| 西林县| 梨树县| 胶州市| 盖州市| 民权县| 晴隆县| 潮安县| 旺苍县| 云浮市| 盱眙县| 常州市| 新建县| 衡山县| 九寨沟县| 托克逊县| 谢通门县| 城口县| 夏河县| 青田县| 右玉县| 甘谷县| 怀远县|