Tesla의 이익 예측
이전 연습 문제와 마찬가지로, Tesla 손익계산서 데이터셋의 이름은 income_statement입니다.
방금 배운 내용을 활용해 2018년 예측(2018 Forecast) 데이터를 담은 새 열을 추가하고, 이 열의 헤더는 "Forecast"로 지정하겠습니다.
이번 연습에서는 filtered_income_statement가 'Revenue' 행만 보이도록 설정해 주세요.
참고로, TTM 열은 2018년 예측에 활용할 가장 최근 12개월 값을 의미합니다. 현재 2018년에 대해 다음과 같은 정보가 주어져 있습니다:
- 시장 수요 분석에 따르면 Model 3 판매 증가로 2018년 매출이 13,000까지 증가할 것으로 예상됩니다.
이 연습은 강의의 일부입니다
Python으로 하는 Financial Forecasting
연습 안내
revenue_metric행만 포함하도록 손익계산서를 필터링하세요.columns속성의 길이(len())를 사용해filtered_income_statement의 열 개수를 구하세요.filtered_income_statement에 새 열을 삽입하세요.- 행의 끝에 위치시키세요(
location으로n_cols사용). - 열 이름은
'Forecast'로 하세요. - 값은
13000을 삽입하세요.
- 행의 끝에 위치시키세요(
- 결과를 출력하세요.
실습형 인터랙티브 연습
이 예제를 이 샘플 코드를 완성하여 풀어보세요.
revenue_metric = ['Revenue']
# Filter for rows containing the revenue metric
filtered_income_statement = ____[____.____.____(____)]
# Get the number of columns in filtered_income_statement
n_cols = ____(filtered_income_statement.____)
# Insert a column in the correct position containing the column 'Forecast'
filtered_income_statement.insert(____, '____', ___)
# See the result
print(filtered_income_statement)