データ解析

傾向の可視化

pd.read_csvparse_dateに列を渡したら自動的に日付形式にしてくれるぞ

In [1]:
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
from plotly.offline import init_notebook_mode, iplot
import plotly.graph_objs as go
from plotly import tools
import plotly.plotly as py
from datetime import date
import random
import warnings
import gc
import math
import xgboost as xgb
from catboost import CatBoostRegressor
from sklearn.model_selection import train_test_split

warnings.filterwarnings("ignore")
init_notebook_mode()

train_df = pd.read_csv("input/train.csv", parse_dates=["activation_date"])
pr_train = pd.read_csv("input/periods_train.csv",
                       parse_dates=["activation_date", "date_from", "date_to"])
pr_test = pd.read_csv("input/periods_test.csv",
                       parse_dates=["activation_date", "date_from", "date_to"])
test_df = pd.read_csv('input/test.csv', parse_dates=["activation_date"])
C:\Users\tmy19\Miniconda3\envs\tensorflow\lib\site-packages\sklearn\cross_validation.py:41: DeprecationWarning:

This module was deprecated in version 0.18 in favor of the model_selection module into which all the refactored classes and functions are moved. Also note that the interface of the new CV iterators are different from that of this module. This module will be removed in 0.20.