Python 時系列分析 1,000本ノック
– ノック32: 時系列データの和 –

Python 時系列分析 1,000本ノック– ノック32: 時系列データの和 –
次の Python コードの出力はどれでしょうか?

Python コード:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
import pandas as pd
dates = pd.date_range(
start='2023-01-01',
periods=5, freq='D')
data = [1, 2, 3, 4, 5]
df = pd.DataFrame(
data,
index=dates,
columns=['A'])
print(df.cumsum())
import pandas as pd dates = pd.date_range( start='2023-01-01', periods=5, freq='D') data = [1, 2, 3, 4, 5] df = pd.DataFrame( data, index=dates, columns=['A']) print(df.cumsum())
import pandas as pd

dates = pd.date_range(
    start='2023-01-01', 
    periods=5, freq='D')
data = [1, 2, 3, 4, 5]
df = pd.DataFrame(
    data, 
    index=dates, 
    columns=['A'])
    
print(df.cumsum())

 

回答の選択肢:

(A) 各日の値
(B) 各日の値の和
(C) 各日の値の累積和
(D) 各日の値の二乗和