In [5]:
import pandas as pd
import numpy as np
import csv
import matplotlib as plt
c_names = ['vID', 'frID', 'tFr','Timestamp', 'localX', 'localY', 'globalX','globalY', 'vLenght', 'vWidth', 'vType', 'veloc','accel', 'line', 'pred', 'foll', 'spac', 'headway', 'dateTime']
data = pd.read_table('D:\\zzzLola\\PhD\\DataSet\\US101\\test\\portion1Set2DT.txt', sep='\t', header=None, names=c_names)
# Stast description of the whole dataset.
desc = data.describe()
##++++++++++++Example
# data.groupby(['col5', 'col2']).size().groupby(level=1).max()
#Mean of values by vehicle Id and DataTime
mean = data.groupby(['vID', 'dateTime']).mean()
#Number of vehicles
num_v = data.groupby(['vID']).size()
#Number of registers by timestamp
ts_match = data.groupby(['Timestamp']).size()
ts_match_max = data.groupby(['Timestamp']).size().max()
ts_match_min = data.groupby(['Timestamp']).size().min()
ts_match_mean = data.groupby(['Timestamp']).size().mean()
#number of register by dataTime
dt_match = data.groupby(['dateTime']).size()
dt_match_max = data.groupby(['dateTime']).size().max()
dt_match_min = data.groupby(['dateTime']).size().min()
dt_match_mean = data.groupby(['dateTime']).size().mean()
#print (desc)
#print (mean [:10])
data.plot(kind='barh', stacked=True)
#print(num_v)
#print (ts_match_max, ts_match_min, ts_match_mean)
#print (dt_match_max, dt_match_min, dt_match_mean)
Out[5]:
In [6]:
df = pd.DataFrame(np.random.randn(1000, 4), index=ts.index, columns=list('ABCD'))
df = df.cumsum()
plt.figure(); df.plot();
In [7]:
import pandas as pd
import numpy as np
import csv
import matplotlib as plt
df = pd.DataFrame(np.random.randn(1000, 4), index=ts.index, columns=list('ABCD'))
df = df.cumsum()
plt.figure(); df.plot();
In [9]:
import pandas as pd
import numpy as np
import csv
import matplotlib as plt
ts = pd.Series(np.random.randn(1000), index=pd.date_range('1/1/2000', periods=1000))
ts = ts.cumsum()
ts.plot()
df = pd.DataFrame(np.random.randn(1000, 4), index=ts.index, columns=list('ABCD'))
df = df.cumsum()
In [10]:
import pandas as pd
import numpy as np
import csv
import matplotlib as plt
ts = pd.Series(np.random.randn(1000), index=pd.date_range('1/1/2000', periods=1000))
ts = ts.cumsum()
ts.plot()
Out[10]:
In [11]:
%matplotlib inline
import pandas as pd
import numpy as np
import csv
import matplotlib as plt
ts = pd.Series(np.random.randn(1000), index=pd.date_range('1/1/2000', periods=1000))
ts = ts.cumsum()
ts.plot()
Out[11]:
In [19]:
%matplotlib inline
import pandas as pd
import numpy as np
import csv
import matplotlib as plt
from pandas.tools.plotting import andrews_curves
c_names = ['vID', 'frID', 'tFr','Timestamp', 'localX', 'localY', 'globalX','globalY', 'vLenght', 'vWidth', 'vType', 'veloc','accel', 'line', 'pred', 'foll', 'spac', 'headway', 'dateTime']
data = pd.read_table('D:\\zzzLola\\PhD\\DataSet\\US101\\test\\dataset1DT.txt', sep='\t', header=None, names=c_names)
# Stast description of the whole dataset.
desc = data.describe()
##++++++++++++Example
# data.groupby(['col5', 'col2']).size().groupby(level=1).max()
#Mean of values by vehicle Id and DataTime
mean = data.groupby(['vID', 'dateTime']).mean()
#Number of vehicles
num_v = data.groupby(['vID']).size()
#Number of registers by timestamp
ts_match = data.groupby(['Timestamp']).size()
ts_match_max = data.groupby(['Timestamp']).size().max()
ts_match_min = data.groupby(['Timestamp']).size().min()
ts_match_mean = data.groupby(['Timestamp']).size().mean()
#number of register by dataTime
dt_match = data.groupby(['dateTime']).size()
dt_match_max = data.groupby(['dateTime']).size().max()
dt_match_min = data.groupby(['dateTime']).size().min()
dt_match_mean = data.groupby(['dateTime']).size().mean()
#print (desc)
#print (mean [:10])
num_v.plot(kind='barh', stacked=True)
#print(num_v)
#print (ts_match_max, ts_match_min, ts_match_mean)
#print (dt_match_max, dt_match_min, dt_match_mean)
Out[19]:
In [3]:
%matplotlib inline
import pandas as pd
import numpy as np
import csv
import matplotlib as plt
from pandas.tools.plotting import andrews_curves
c_names = ['vID', 'frID', 'tFr','Timestamp', 'localX', 'localY', 'globalX','globalY', 'vLenght', 'vWidth', 'vType', 'veloc','accel', 'line', 'pred', 'foll', 'spac', 'headway', 'dateTime']
data = pd.read_table('D:\\zzzLola\\PhD\\DataSet\\US101\\test\\portion1Set2DT.txt', sep='\t', header=None, names=c_names)
# Stast description of the whole dataset.
desc = data.describe()
##++++++++++++Example
# data.groupby(['col5', 'col2']).size().groupby(level=1).max()
#Mean of values by vehicle Id and DataTime
mean = data.groupby(['vID', 'dateTime']).mean()
#Number of vehicles
num_v = data.groupby(['vID']).size()
#Number of registers by timestamp
ts_match = data.groupby(['Timestamp']).size()
ts_match_max = data.groupby(['Timestamp']).size().max()
ts_match_min = data.groupby(['Timestamp']).size().min()
ts_match_mean = data.groupby(['Timestamp']).size().mean()
#number of register by dataTime
dt_match = data.groupby(['dateTime']).size()
dt_match_max = data.groupby(['dateTime']).size().max()
dt_match_min = data.groupby(['dateTime']).size().min()
dt_match_mean = data.groupby(['dateTime']).size().mean()
#print (desc)
#print (mean [:10])
num_v.plot(kind='barh', stacked=True)
print (data.groupby(['vID']).count())
#ts_match.plot(kind='barh', stacked=True)
#dt_match.plot(kind='barh', stacked=True)
#print(num_v)
#print (ts_match_max, ts_match_min, ts_match_mean)
#print (dt_match_max, dt_match_min, dt_match_mean)
In [4]:
ts_match.plot(kind='barh', stacked=True)
Out[4]:
In [5]:
dt_match.plot(kind='barh', stacked=True)
Out[5]:
In [7]:
%matplotlib inline
import pandas as pd
import numpy as np
import csv
import matplotlib as plt
from pandas.tools.plotting import andrews_curves
c_names = ['vID', 'frID', 'tFr','Timestamp', 'localX', 'localY', 'globalX','globalY', 'vLenght', 'vWidth', 'vType', 'veloc','accel', 'line', 'pred', 'foll', 'spac', 'headway', 'dateTime']
data = pd.read_table('D:\\zzzLola\\PhD\\DataSet\\US101\\test\\dataset1DT.txt', sep='\t', header=None, names=c_names)
# Stast description of the whole dataset.
desc = data.describe()
##++++++++++++Example
# data.groupby(['col5', 'col2']).size().groupby(level=1).max()
#Mean of values by vehicle Id and DataTime
mean = data.groupby(['vID', 'dateTime']).mean()
#Number of vehicles
num_v = data.groupby(['vID']).size()
#Number of registers by timestamp
ts_match = data.groupby(['Timestamp', 'vID']).size()
ts_match_max = data.groupby(['Timestamp']).size().max()
ts_match_min = data.groupby(['Timestamp']).size().min()
ts_match_mean = data.groupby(['Timestamp']).size().mean()
#number of register by dataTime
dt_match = data.groupby(['dateTime', 'vID']).size()
dt_match_max = data.groupby(['dateTime']).size().max()
dt_match_min = data.groupby(['dateTime']).size().min()
dt_match_mean = data.groupby(['dateTime']).size().mean()
In [8]:
print (data.groupby(['vID']).count())
In [9]:
num_v.plot(kind='barh', stacked=True)
Out[9]:
In [10]:
ts_match.plot(kind='barh', stacked=True)
Out[10]:
In [11]:
dt_match.plot(kind='barh', stacked=True)
Out[11]:
In [12]:
print (ts_match_max, ts_match_min, ts_match_mean)
print (dt_match_max, dt_match_min, dt_match_mean)
In [13]:
print (mean [:10])
In [14]:
print (mean [:50])
In [15]:
#Number of registers by timestamp
ts_match = data.groupby(['Timestamp', 'vID']).size()
ts_match_max = ts_match.max()
ts_match_min = ts_match.min()
ts_match_mean = ts_match.mean()
#number of register by dataTime
dt_match = data.groupby(['dateTime', 'vID']).size()
dt_match_max = dt_match.max()
dt_match_min = dt_match.min()
dt_match_mean = dt_match.mean()
In [16]:
print (ts_match [:50])
In [17]:
print (ts_match.count())
In [18]:
print (dt_match [:50])
In [19]:
print (dt_match.count())
In [20]:
print (ts_match_max)
In [2]:
print(dt_match_max)
In [1]:
dt_match
In [ ]: