Python是进行数据分析的一种出色语言,主要是因为以数据为中心的python软件包具有奇妙的生态系统。 Pandas是其中的一种,使导入和分析数据更加容易。
 Pandas  TimedeltaIndex.tolist()函数返回给定TimedeltaIndex对象中基础数据的python列表。
用法: TimedeltaIndex.tolist()
参数:没有
返回:清单
范例1:采用TimedeltaIndex.tolist()函数以python列表的形式返回给定TimedeltaIndex对象的数据。
# importing pandas as pd 
import pandas as pd 
  
# Create the TimedeltaIndex object 
tidx = pd.TimedeltaIndex(data =['06:05:01.000030', '+23:59:59.999999', 
                        '22 day 2 min 3us 10ns', '+23:29:59.999999', 
                        '+12:19:59.999999']) 
  
# Print the TimedeltaIndex object 
print(tidx)输出:

现在我们将使用TimedeltaIndex.tolist()函数以列表形式返回tidx对象的元素。
# return a list 
tidx.tolist()输出:

正如我们在输出中看到的,TimedeltaIndex.tolist()函数已返回一个包含TimedeltaIndex对象的数据的列表。
范例2:采用TimedeltaIndex.tolist()函数以python列表的形式返回给定TimedeltaIndex对象的数据。
# importing pandas as pd 
import pandas as pd 
  
# Create the TimedeltaIndex object 
tidx = pd.TimedeltaIndex(start ='1 days 02:00:12.001124',  
                        periods = 5, freq ='D', name ='Koala') 
  
# Print the TimedeltaIndex object 
print(tidx)输出:

现在我们将使用TimedeltaIndex.tolist()函数以列表形式返回tidx对象的元素。
# return a list 
tidx.tolist()输出:

正如我们在输出中看到的,TimedeltaIndex.tolist()函数已返回一个包含TimedeltaIndex对象的数据的列表。
相关用法
- Python pandas.map()用法及代码示例
 - Python Pandas Series.str.len()用法及代码示例
 - Python Pandas.factorize()用法及代码示例
 - Python Pandas TimedeltaIndex.name用法及代码示例
 - Python Pandas dataframe.ne()用法及代码示例
 - Python Pandas Series.between()用法及代码示例
 - Python Pandas DataFrame.where()用法及代码示例
 - Python Pandas Series.add()用法及代码示例
 - Python Pandas.pivot_table()用法及代码示例
 - Python Pandas Series.mod()用法及代码示例
 - Python Pandas Dataframe.at[ ]用法及代码示例
 - Python Pandas Dataframe.iat[ ]用法及代码示例
 - Python Pandas.pivot()用法及代码示例
 - Python Pandas dataframe.mul()用法及代码示例
 - Python Pandas.melt()用法及代码示例
 
注:本文由纯净天空筛选整理自Shubham__Ranjan大神的英文原创作品 Python | Pandas TimedeltaIndex.tolist()。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。
