Loading

8-LSTM多变量-预处理

import pandas as pd
import datetime

def parser(x):
    return datetime.datetime.strptime(x, '%Y %m %d %H')

dataset = pd.read_csv('../LSTM系列/LSTM多变量1/data_set/air_pollution.csv', 
                     parse_dates=[['year', 'month', 'day', 'hour']], index_col=0, date_parser=parser)

dataset.drop('No', axis=1, inplace=True)

dataset.columns = ['pollution', 'dew', 'temp', 'press', 'wnd_dir', 'wnd_spd', 'snow', 'rain']
dataset.index.name = 'date'

dataset['pollution'].fillna(0, inplace=True)

dataset = dataset[24:]
print(dataset.head())
posted @ 2023-02-08 23:56  lotuslaw  阅读(34)  评论(0编辑  收藏  举报