4
我有一個使用Date作爲索引的Pandas DataFrame。如何刪除所有具有日期「2000-01-06」的行?如何刪除熊貓數據框中特定日期的行?
示例代碼:
import numpy as np
import pandas as pd
dates = pd.date_range('1/1/2000', periods=8)
df = pd.DataFrame(np.random.randn(8, 3), index=dates, columns=['A', 'B', 'C'])
df.index.name = 'Date'
實例數據框:
A B C
Date
2000-01-01 -0.501547 -0.227375 0.275931
2000-01-02 0.994459 1.266288 -0.178603
2000-01-03 -0.982746 -0.339685 0.157390
2000-01-04 -1.013987 -1.074076 -2.346117
2000-01-05 -0.101157 -0.698663 1.025318
2000-01-06 -1.697615 -0.081638 1.075712
2000-01-07 0.617587 -1.561204 -1.685774
2000-01-08 0.049115 0.579139 -1.036961
優秀,太感謝你了! – omkar