午夜精品久久久久久久99老熟妇,天堂中文www官网,未满十八18勿进黄网站,太粗太深了太紧太爽了,天天爽夜夜爽夜夜爽

考試報(bào)名
考試報(bào)名
考試內(nèi)容
考試大綱
在線客服
返回頂部

備考刷題,請到

CDA認(rèn)證小程序

假如我們導(dǎo)入了數(shù)據(jù)庫,但沒有對其值和日期建立索引,那么如何創(chuàng)建一個?
A. df.set_index('Date' = True)
B. df.set_index('Date'= true, in place = True)
C. df.set_index('Date', in place = True)
D. df.set_index(in_place=True)
上一題
下一題
收藏
點(diǎn)贊
評論
題目解析
題目評論(0)

正確答案是:C: `df.set_index('Date', inplace=True)`

分析:
- `df.set_index()` 是 Pandas 中用于設(shè)置 DataFrame 索引的方法。
- 選項(xiàng) A 中 `'Date' = True` 是錯誤的語法,`'Date'` 應(yīng)該是一個參數(shù)而非賦值操作。
- 選項(xiàng) B 中的 `in place = True` 語法錯誤,正確的寫法應(yīng)該是 `inplace=True`,沒有空格。
- 選項(xiàng) D 中缺少必要的參數(shù) `'Date'`,因此無法指定哪一列作為索引。

選項(xiàng) C 正確地使用了 `df.set_index('Date', inplace=True)`,其中:
- `'Date'` 是要設(shè)置為索引的列名稱。
- `inplace=True` 表示直接在原 DataFrame 上進(jìn)行修改,而不是返回一個新的 DataFrame。