Reputation: 26121
I have a dataset which looks like:
23.10.2019T09:07:20 0.158
23.10.2019T09:15:51 0.123
23.10.2019T09:18:34 0.140
23.10.2019T09:30:16 0.106
23.10.2019T09:30:59 0.123
23.10.2019T09:31:14 0.117
23.10.2019T09:32:49 0.155
23.10.2019T09:34:36 0.148
23.10.2019T09:36:51 0.132
23.10.2019T09:37:21 0.108
I want to calculate stats using only second column and I have no luck.
gnuplot> stats '~/work/logs/betd_log_SN0425/1066_duration.txt' u 2
Stats command not available in timedata mode
gnuplot> stats '~/work/logs/betd_log_SN0425/1066_duration.txt' u 2:2
Stats command not available in timedata mode
gnuplot> stats '~/work/logs/betd_log_SN0425/1066_duration.txt' u (1.0):2
Stats command not available in timedata mode
gnuplot> stats '~/work/logs/betd_log_SN0425/1066_duration.txt' u 2:(1.0)
Stats command not available in timedata mode
Upvotes: 2
Views: 743
Reputation: 26121
As theozh pointed out I have used set xdata time
previously for a plot
command. So it needs use set xdata
to reset xdata
mode.
Upvotes: 1
Reputation: 25724
Stats doesn't take time format. You have to convert it to seconds from 01.01.1970 via strptime(...)
. And then you might need to reconvert it to a readable date via strftime(...)
. Check help strptime
and help strftime
.
What exactly do you want to extract? Min, Max, ... extrapolation...?
Try the following.
Code:
### stats with datetime
reset session
$Data <<EOD
23.10.2019T09:07:20 0.158
23.10.2019T09:15:51 0.123
23.10.2019T09:18:34 0.140
23.10.2019T09:30:16 0.106
23.10.2019T09:30:59 0.123
23.10.2019T09:31:14 0.117
23.10.2019T09:32:49 0.155
23.10.2019T09:34:36 0.148
23.10.2019T09:36:51 0.132
23.10.2019T09:37:21 0.108
EOD
myTimeFmt = "%d.%m.%YT%H:%M:%S"
stats $Data u (strptime(myTimeFmt,strcol(1))):2
### end of code
Result:
* FILE:
Records: 10
Out of range: 0
Invalid: 0
Column headers: 0
Blank: 0
Data Blocks: 1
* COLUMNS:
Mean: 1.57182e+09 0.1310
Std Dev: 575.1860 0.0178
Sample StdDev: 606.2992 0.0187
Skewness: -0.9459 0.1355
Kurtosis: 2.5313 1.6792
Avg Dev: 492.0600 0.0156
Sum: 1.57182e+10 1.3100
Sum Sq.: 2.47063e+19 0.1748
Mean Err.: 181.8898 0.0056
Std Dev Err.: 128.6155 0.0040
Skewness Err.: 0.7746 0.7746
Kurtosis Err.: 1.5492 1.5492
Minimum: 1.57182e+09 [ 0] 0.1060 [ 3]
Maximum: 1.57182e+09 [ 9] 0.1580 [ 0]
Quartile: 1.57182e+09 0.1170
Median: 1.57182e+09 0.1275
Quartile: 1.57182e+09 0.1480
Linear Model: y = -1.178e-05 x + 1.852e+04
Slope: -1.178e-05 +- 1.009e-05
Intercept: 1.852e+04 +- 1.586e+04
Correlation: r = -0.3816
Sum xy: 2.059e+09
Upvotes: 1