7.7 파이썬 실습

    1. CSV 파일을 읽고 파티셔닝해보기

    >>> import numpy as np
    >>> import pandas as pd
    >>> from sklearn import linear_model
    >>> from sklearn import model_selection
    >>> from sklearn import metrics
    >>> from sklearn import preprocessing
    >>> from matplotlib import pyplot as plt
    
    # adv.csv 파일은 매체별 비용과 매출액에 대한 데이터다
    
    # 데이터 읽기
    >>> df_adv = pd.read_csv('c:/adv.csv', index_col=0)
    >>> print(df_adv.shape)
    (200, 4)
    
    # 플롯 그리기
    >>> plt.scatter(df_adv.TV, df_adv.sales)
    >>> plt.title('Scatter Plot')
    >>> plt.xlabel('TV')
    >>> plt.ylabel('sales')
    >>> plt.show()

     

    신간 소식 구독하기
    뉴스레터에 가입하시고 이메일로 신간 소식을 받아 보세요.