@@ -84,8 +84,8 @@ def processAlgorithm(self, progress):
84
84
minValue = 0
85
85
maxValue = 0
86
86
meanValue = 0
87
- countEmpty = 0
88
- countFilled = 0
87
+ nullValues = 0
88
+ filledValues = 0
89
89
90
90
isFirst = True
91
91
values = []
@@ -94,7 +94,14 @@ def processAlgorithm(self, progress):
94
94
count = len (features )
95
95
total = 100.0 / count
96
96
for current , ft in enumerate (features ):
97
- length = float (len (ft .attributes ()[index ]))
97
+ value = ft [fieldName ]
98
+ if value :
99
+ length = float (len (value ))
100
+ filledValues += 1
101
+ else :
102
+ nullValues += 1
103
+ progress .setPercentage (int (current * total ))
104
+ continue
98
105
99
106
if isFirst :
100
107
minValue = length
@@ -106,11 +113,6 @@ def processAlgorithm(self, progress):
106
113
if length > maxValue :
107
114
maxValue = length
108
115
109
- if length != 0.00 :
110
- countFilled += 1
111
- else :
112
- countEmpty += 1
113
-
114
116
values .append (length )
115
117
sumValue += length
116
118
@@ -128,8 +130,8 @@ def processAlgorithm(self, progress):
128
130
data .append ('Minimum length: ' + unicode (minValue ))
129
131
data .append ('Maximum length: ' + unicode (maxValue ))
130
132
data .append ('Mean length: ' + unicode (meanValue ))
131
- data .append ('Filled: ' + unicode (countFilled ))
132
- data .append ('Empty : ' + unicode (countEmpty ))
133
+ data .append ('Filled values : ' + unicode (filledValues ))
134
+ data .append ('NULL (missed) values : ' + unicode (nullValues ))
133
135
data .append ('Count: ' + unicode (count ))
134
136
data .append ('Unique: ' + unicode (uniqueValues ))
135
137
@@ -138,8 +140,8 @@ def processAlgorithm(self, progress):
138
140
self .setOutputValue (self .MIN_LEN , minValue )
139
141
self .setOutputValue (self .MAX_LEN , maxValue )
140
142
self .setOutputValue (self .MEAN_LEN , meanValue )
141
- self .setOutputValue (self .FILLED , countFilled )
142
- self .setOutputValue (self .EMPTY , countEmpty )
143
+ self .setOutputValue (self .FILLED , filledValues )
144
+ self .setOutputValue (self .EMPTY , nullValues )
143
145
self .setOutputValue (self .COUNT , count )
144
146
self .setOutputValue (self .UNIQUE , uniqueValues )
145
147
0 commit comments