标签:http use plot creat orange mes src str dmi
# -*- coding: utf-8 -*- """ Created on Fri Mar 22 21:03:34 2019 @author: Administrator """ import pandas as pd filenames = [] basepath = ‘D:\\pworkspace\\data\\Metro_train\\‘ for i in range(1, 26): if i < 10: filenames.append(basepath + ‘record_2019-01-0‘ + str(i) + ‘.csv‘) else: filenames.append(basepath + ‘record_2019-01-‘ + str(i) + ‘.csv‘) flag = True for filename in filenames: df = pd.read_csv(filename) df[‘time‘] = df[‘time‘].str[:-4] + ‘0:00‘ df[‘time‘] = pd.to_datetime(df[‘time‘]) df0 = df[df[‘stationID‘] == 0].copy() del df user_in = df0[df0[‘status‘] == 1] user_out = df0[df0[‘status‘] == 0] user_in = user_in.groupby(‘time‘) user_out = user_out.groupby(‘time‘) user_in = user_in.count() user_out = user_out.count() user_in[‘count‘] = user_in[‘userID‘] user_out[‘count‘] = user_out[‘userID‘] user_in = user_in.drop([‘lineID‘, ‘stationID‘, ‘deviceID‘, ‘status‘, ‘payType‘, ‘userID‘], axis=1) user_out = user_out.drop([‘lineID‘, ‘stationID‘, ‘deviceID‘, ‘status‘, ‘payType‘, ‘userID‘], axis=1) if flag: user_in_all = user_in user_out_all = user_out flag = False else: user_in_all = pd.concat([user_in_all,user_in], axis=0) user_out_all = pd.concat([user_out_all,user_out], axis=0) user_in_all.plot(figsize=(15,8)) user_out_all.plot(figsize=(15,8), color=‘orange‘)
?
?
标签:http use plot creat orange mes src str dmi
原文地址:https://www.cnblogs.com/coshaho/p/10581742.html