Python| Pandas DatetimeIndex.minute
Python是一种用于进行数据分析的出色语言,主要是因为以数据为中心的Python包的奇妙生态系统。 Pandas就是其中之一,它使导入和分析数据变得更加容易。
Pandas DatetimeIndex.minute
属性输出一个 Index 对象,其中包含 DatetimeIndex 对象的每个条目中存在的分钟值。
Syntax: DatetimeIndex.minute
Return: Index containing minutes.
示例 #1:使用DatetimeIndex.minute
属性查找存在于 DatetimeIndex 对象中的分钟值。
# importing pandas as pd
import pandas as pd
# Create the DatetimeIndex
# Here the 'T' represents minutely frequency
didx = pd.DatetimeIndex(start ='2000-01-10 06:30', freq ='T',
periods = 3, tz ='Asia/Calcutta')
# Print the DatetimeIndex
print(didx)
输出 :
现在我们要查找 DatetimeIndex 对象中存在的所有分钟值。
# find all the minute values present in the object
didx.minute
输出 :
正如我们在输出中看到的,该函数返回了一个 Index 对象,其中包含 DatetimeIndex 对象的每个条目中存在的分钟值。这里 30、31 和 32 是 DatetimeIndex 对象条目中的分钟值。示例 #2:使用DatetimeIndex.minute
属性查找 DatetimeIndex 对象中存在的分钟值。
# importing pandas as pd
import pandas as pd
# Create the DatetimeIndex
# Here the 'BH' represents business hour frequency
didx = pd.DatetimeIndex(start ='2014-08-01 10:05', freq ='BH',
periods = 5, tz ='Asia/Calcutta')
# Print the DatetimeIndex
print(didx)
输出 :
现在我们要查找 DatetimeIndex 对象中存在的所有分钟值。
# find all the minute values present in the object
didx.minute
输出 :
正如我们在输出中看到的,该函数返回了一个 Index 对象,其中包含 DatetimeIndex 对象的每个条目中存在的分钟值。