커뮤니티
포인트
쿠폰
내 강의실
국비 신청 내역
증명서
계정
로그아웃
학습 질문
개발 일지
나의 활동
답변 완료
[청년층]신입사원 필수 입문, 실무형 AI - 문서·보고서·업무자동화
챕터 2
북마크
이*라
댓글
4
추천
0
조회수
4
조회수
4
답변 완료

지난 강의 기획서 초안 복사 후, 첫번째 파일 (market_trend.csv)첨부하고 캔버스로 엔터 눌렀더니 다음과 같은 코드가 나옵니다. 어떻게 해야할까요?

import pandas as pd

# Load the CSV file

file_path = '/mnt/data/market_trend.csv'

df = pd.read_csv(file_path)

# Display structure (info)

print("=== DataFrame Info ===")

print(df.info())

# Display first 5 rows

print("\n=== Top 5 Rows ===")

print(df.head())

# Attempt to calculate growth rate statistics

# Assuming there is a column related to growth rate

possible_growth_cols = [col for col in df.columns if 'growth' in col.lower() or 'rate' in col.lower()]

if possible_growth_cols:

growth_col = possible_growth_cols[0]

print(f"\nUsing column '{growth_col}' for growth rate calculations.")

print("Average Growth Rate:", df[growth_col].mean())

print("Maximum Growth Rate:", df[growth_col].max())

print("Minimum Growth Rate:", df[growth_col].min())

else:

print("\nNo obvious growth rate column found. Please check column names.")


CSV 파일을 분석하는 Python 스크립트를 캔버스에 생성했습니다.

해당 코드를 실행하면 다음을 확인할 수 있습니다:

  1. 데이터 구조(df.info())

  2. 상위 5개 행(df.head())

  3. 성장률 관련 컬럼 자동 탐색 후

    • 평균 성장률

    • 최대 성장률

    • 최소 성장률

만약 성장률 컬럼명이 명확하다면(예: growth_rate, annual_growth 등), 그 컬럼명을 지정해 보다 정확하게 계산하도록 수정해 드릴 수 있습니다.

취소
 공유
취소
댓글 0
댓글 알림
나의얼굴