Index对象是通过有序的,可切片的集合实现的。

Index

属性(Attributes)

Function Describe
Index.values 返回索引的值
Index.is_monotonic_increasing 是否是单调升的
Index.is_monotonic_decreasing 是否是单调减的
Index.is_unique 是否是唯一的
Index.has_duplicates
Index.dtype 索引类型
Index.inferred_type
Index.is_all_dates
Index.shape 索引的形状
Index.nbytes 返回字节数
Index.ndim 返回维度
Index.size 返回元素的个数
Index.strides return the strides of the underlying data
Index.itemsize return the size of the dtype of the item of the underlying data
Index.base return the base object if the memory of the underlying data is
Index.T return the transpose, which is by definition self
Index.memory_usage([deep]) Memory usage of my values

修改和计算(Modifying and Computations)

Function Describe
Index.all(*args,?**kwargs) Return whether all elements are True
Index.any(*args,?**kwargs) Return whether any element is True
Index.argmin([axis]) return a ndarray of the minimum argument indexer
Index.argmax([axis]) return a ndarray of the maximum argument indexer
Index.copy([name,?deep,?dtype]) 复制
Index.delete(loc) Make new Index with passed location(-s) deleted
Index.drop(labels[,?errors]) Make new Index with passed list of labels deleted
Index.drop_duplicates(*args,?**kwargs) Return Index with duplicate values removed
Index.duplicated(*args,?**kwargs) Return boolean np.ndarray denoting duplicate values
Index.equals(other) 是否含有相同的元素
Index.factorize([sort,?na_sentinel]) Encode the object as an enumerated type or categorical variable
Index.identical(other) Similar to equals, but check that other comparable attributes are
Index.insert(loc,?item) Make new Index inserting new item at location.
Index.min() 最小值
Index.max() 最大值
Index.reindex(target[,?method,?level,?…]) Create index with target’s values (move/add/delete values as necessary)
Index.repeat(n,?*args,?**kwargs) Repeat elements of an Index.
Index.where(cond[,?other]) 条件选取
Index.take(indices[, axis, allow_fill, …]) return a new %(klass)s of the values selected by the indices
Index.putmask(mask, value) return a new Index of the values set with the mask
Index.set_names(names[, level, inplace]) Set new names on index.
Index.unique() 返回唯一值
Index.nunique([dropna]) Return number of unique elements in the object.
Index.value_counts([normalize, sort, …]) 返回唯一值计数
Index.fillna([value, downcast]) 填充缺省值
Index.dropna([how]) Return Index without NA/NaN values

转换(Conversion)

Function Describe
Index.astype(dtype[,?copy]) Create an Index with values cast to dtypes.
Index.tolist() 转变为list
Index.to_series(**kwargs) Create a Series with both index and values equal to the index keys

排序(Sorting)

Function Describe
Index.argsort(*args, **kwargs) Returns the indices that would sort the index and its underlying data.
Index.sort_values([return_indexer, ascending]) Return sorted copy of Index

时间处理(Time-specific operations)

Function Describe
Index.shift([periods,?freq]) Shift Index containing datetime objects by input number of periods and

联表(Combining / joining / set operations)

Function Describe
Index.append(other) Append a collection of Index options together
Index.join(other[, how, level, return_indexers]) this is an internal non-public method
Index.intersection(other) Form the intersection of two Index objects.
Index.union(other) Form the union of two Index objects and sorts if possible.
Index.difference(other) Return a new Index with elements from the index that are not in other.
Index.symmetric_difference(other[, result_name]) Compute the symmetric difference of two Index objects.

选取(Selecting)

Function Describe
Index.get_indexer(target[, method, limit, …]) Compute indexer and mask for new index given the current index.
Index.get_indexer_non_unique(target) return an indexer suitable for taking from a non unique index
Index.get_level_values(level) Return vector of label values for requested level, equal to the length
Index.get_loc(key[, method, tolerance]) Get integer location for requested label
Index.get_value(series, key) Fast lookup of value from 1-dimensional ndarray.
Index.isin(values[, level]) Compute boolean array of whether each index value is found in the passed set of values.
Index.slice_indexer([start, end, step, kind]) For an ordered Index, compute the slice indexer for input labels and
Index.slice_locs([start, end, step, kind]) Compute slice locations for input labels.

分类索引CategoricalIndex

Function Describe
CategoricalIndex Immutable Index implementing an ordered, sliceable set.
CategoricalIndex.codes
CategoricalIndex.categories
CategoricalIndex.ordered
CategoricalIndex.rename_categories(*args, …) Renames categories.
CategoricalIndex.reorder_categories(*args, …) Reorders categories as specified in new_categories.
CategoricalIndex.add_categories(*args, **kwargs) Add new categories.
CategoricalIndex.remove_categories(*args, …) Removes the specified categories.
CategoricalIndex.remove_unused_categories(…) Removes categories which are not used.
CategoricalIndex.set_categories(*args, **kwargs) Sets the categories to the specified new_categories.
CategoricalIndex.as_ordered(*args, **kwargs) Sets the Categorical to be ordered
CategoricalIndex.as_unordered(*args, **kwargs) Sets the Categorical to be unordered

复合索引

Function Describe
MultiIndex.from_arrays(arrays[, sortorder, …]) Convert arrays to MultiIndex
MultiIndex.from_tuples(tuples[, sortorder, …]) Convert list of tuples to MultiIndex
MultiIndex.from_product(iterables[, …]) Make a MultiIndex from the cartesian product of multiple iterables
MultiIndex.set_levels(levels[, level, …]) Set new levels on MultiIndex.
MultiIndex.set_labels(labels[, level, …]) Set new labels on MultiIndex.
MultiIndex.to_hierarchical(n_repeat[, n_shuffle]) Return a MultiIndex reshaped to conform to the shapes given by n_repeat and n_shuffle.
MultiIndex.is_lexsorted() Return True if the labels are lexicographically sorted
MultiIndex.droplevel([level]) Return Index with requested level removed.
MultiIndex.swaplevel([i, j]) Swap level i with level j.
MultiIndex.reorder_levels(order) Rearrange levels using input order.

时间索引DatetimeIndex

属性

参考Series里面的Datetime类型的介绍
时间索引可以用字符串
“2011/01/01” 搜索某一天
“2011/01”搜索某一月,当月所有数据都会输出

Function Describe
DatetimeIndex.year The year of the datetime
DatetimeIndex.month The month as January=1, December=12
DatetimeIndex.day The days of the datetime
DatetimeIndex.hour The hours of the datetime
DatetimeIndex.minute The minutes of the datetime
DatetimeIndex.second The seconds of the datetime
DatetimeIndex.microsecond The microseconds of the datetime
DatetimeIndex.nanosecond The nanoseconds of the datetime
DatetimeIndex.date Returns numpy array of python datetime.date objects (namely, the date part of Timestamps without timezone information).
DatetimeIndex.time Returns numpy array of datetime.time.
DatetimeIndex.dayofyear The ordinal day of the year
DatetimeIndex.weekofyear The week ordinal of the year
DatetimeIndex.week The week ordinal of the year
DatetimeIndex.dayofweek The day of the week with Monday=0, Sunday=6
DatetimeIndex.weekday The day of the week with Monday=0, Sunday=6
DatetimeIndex.weekday_name The name of day in a week (ex: Friday)
DatetimeIndex.quarter The quarter of the date
DatetimeIndex.tz
DatetimeIndex.freq get/set the frequncy of the Index
DatetimeIndex.freqstr Return the frequency object as a string if its set, otherwise None
DatetimeIndex.is_month_start Logical indicating if first day of month (defined by frequency)
DatetimeIndex.is_month_end Logical indicating if last day of month (defined by frequency)
DatetimeIndex.is_quarter_start Logical indicating if first day of quarter (defined by frequency)
DatetimeIndex.is_quarter_end Logical indicating if last day of quarter (defined by frequency)
DatetimeIndex.is_year_start Logical indicating if first day of year (defined by frequency)
DatetimeIndex.is_year_end Logical indicating if last day of year (defined by frequency)
DatetimeIndex.is_leap_year Logical indicating if the date belongs to a leap year
DatetimeIndex.inferred_freq

选取Selecting

Function Describe
DatetimeIndex.indexer_at_time(time[, asof]) Select values at particular time of day (e.g.
DatetimeIndex.indexer_between_time(…[, …]) Select values between particular times of day (e.g., 9:00-9:30AM).

特定的时间方法

Function Describe
DatetimeIndex.normalize() Return DatetimeIndex with times to midnight.
DatetimeIndex.strftime(date_format) Return an array of formatted strings specified by date_format, which supports the same string format as the python standard library.
DatetimeIndex.snap([freq]) Snap time stamps to nearest occurring frequency
DatetimeIndex.tz_convert(tz) Convert tz-aware DatetimeIndex from one time zone to another (using
DatetimeIndex.tz_localize(*args, **kwargs) Localize tz-naive DatetimeIndex to given time zone (using
DatetimeIndex.round(freq, *args, **kwargs) round the index to the specified freq
DatetimeIndex.floor(freq) floor the index to the specified freq
DatetimeIndex.ceil(freq) ceil the index to the specified freq

转化Conversion

Function Describe
DatetimeIndex.to_datetime([dayfirst])
DatetimeIndex.to_period([freq]) Cast to PeriodIndex at a particular frequency
DatetimeIndex.to_perioddelta(freq) Calcuates TimedeltaIndex of difference between index values and index converted to PeriodIndex at specified freq.
DatetimeIndex.to_pydatetime() Return DatetimeIndex as object ndarray of datetime.datetime objects
DatetimeIndex.to_series([keep_tz]) Create a Series with both index and values equal to the index keys

Pandas Index对象相关推荐

  1. Pandas详解三之Index对象

    约定 import pandas as pd from pandas import DataFrame import numpy as np Index Index对象保存着索引标签数据,它可以快速找 ...

  2. pandas中的index对象详解

    欢迎关注"生信修炼手册"! 在pandas中,Series和DataFrame对象是介绍的最多的,Index对象作为其构成的一部分,相关的介绍内容却比较少.对于Index对象而言, ...

  3. python memory usage_Python Pandas Index.memory_usage()用法及代码示例

    Python是进行数据分析的一种出色语言,主要是因为以数据为中心的python软件包具有奇妙的生态系统. Pandas是其中的一种,使导入和分析数据更加容易. Pandas Index.memory_ ...

  4. Pandas index详解

    总括 pandas里对索引的操作主要有 DataFrame.rename DataFrame.rename_axis DataFrame.reindex DataFrame.reindex_axis ...

  5. 用Pandas Index高效比对百万级别文本

    前言 在Excel进行表表运算时,特别是以某表文本字段为关键字,查询另一表文本,即进行vlookup操作时,经常出现两边数据的不匹配.特别是如果数据量足够大,将产生较多的问题. 上述操作实际上是两集合 ...

  6. Pandas Index 更新和计算(Modifyingcomputations)

    In [1]: import pandas as pd...: df = pd.DataFrame({"学号": [1001,1002,1003,1004,1005],...: & ...

  7. Pandas Index 属性

    import pandas as pd df = pd.DataFrame({"学号": [1001,1002,1003,1004,1005],"name": ...

  8. Pandas GroupBy对象

    创建GroupBy对象 GroupBy对象可以通过pandas.DataFrame.groupby(), pandas.Series.groupby()来创建. GroupBy = DataFrame ...

  9. Pandas基本数据对象及操作

    # 基本数据对象及操作 ## 1. Series * 创建Series import pandas as pdcountries = ['中国', '美国', '澳大利亚'] countries_s ...

最新文章

  1. 2017-11-3—grow up
  2. 2017年06月07号课堂笔记
  3. 三张內存变化图揭秘基本类型数组的初始化
  4. (2)双机调试+符号文件
  5. linux5.8不能上网,Ubuntu 8.04不能上网的问题的解决方法
  6. PostgreSQL建表动作分析
  7. 被该死的Openssl编译嘲讽了一个下午
  8. Linux 的 diff 命令
  9. 3复数与复变函数(三)
  10. 使用ipmitool命令检测电源模块状态
  11. 七点建议帮助您部署云存储
  12. 图像融合(五)-- 梯度金字塔
  13. python生成器表达式yield,面向过程编程,部分内置函数
  14. Ubuntu 20.04桌面美化
  15. 销售管理系统c语言 总结报告,C语言课程设计报告-药品销售管理系统.doc
  16. 参数检验与非参数检验
  17. word转pdf excel转pdf ppt转pdf pdf转word pdf转excel pdf转ppt pdf转jpg
  18. 报告总监,他...在代码里面 “下毒” 了
  19. PAT-Head of Hangs
  20. python学生管理系统设计实验报告_学生成绩管理系统实验报告(新鲜出炉)

热门文章

  1. Python 3.6新特性(部分)
  2. android listview边框颜色,Android实现带有边框的ListView和item的方法
  3. java 正方形_java-确定正方形和矩形之间的关系的算法
  4. php-fpm进程的用户组,PHP中的“进程”系列1——PHP-FPM模型
  5. python定义一个字符串后怎么修改_python基础--字符串操作详解
  6. python多线程控制暂停_python多线程控制
  7. C++基础与深度解析第三章:数组、vector与字符串
  8. C++之继承探究(八):动态绑定
  9. charles抓包工具_HTTP协议抓包工具:Charles for Mac
  10. currenthashmap如何实现线程安全_Java的List如何实现线程安全?