我df的其中一列主要包含datetime.time类型
all_cities['Result'].head()
0 02:19:53
1 02:20:10
2 02:20:52
3 02:37:19
4 02:38:05
Name: Result, dtype: object
但是all_cities ['Result'] [0]
datetime.time(2, 19, 53)
如何找到不同类型的单元格索引(不是datetime.time)?
答案 0 :(得分:0)
说你有
if/else
你可以
function playgame() {
const playNames = {
0: 'ROCK',
1: 'PAPER',
2: 'SCISSORS'
}
let userChoice = prompt("Rock, Paper, or Scissors?").toUpperCase();
let computerChoice = computerPlay();
console.log(computerChoice + ' aka ' + playNames[computerChoice]);
}
function computerPlay() {
return Math.floor(Math.random() * 3);
}
playgame();
获得
df = pd.DataFrame({'ex': [1, datetime.time(2,19,53), "string", [1,2,3]]})
ex
0 1
1 02:19:53
2 string
3 [1, 2, 3]
详细信息:
df[df.ex.transform(type) == datetime.time]
产生您的条目类型
ex
1 02:19:53
然后
transform(type)