lundi 10 août 2020

Fill in missing Data from csv

I am trying to compare two series. My problem is, that the series doesn't have the same length. There is some data missing. The cells in which I have no percentage value (Prozent) will completely overlook the wind speeds. For every not existing "Prozent" value I want to get a 'nv'.

The list I want to get (logifunclist):

    Wind
0   0.0
1   0.1
2   0.2
3   0.3
4   0.4
5   0.5
6   0.6
7   0.7
8   0.8
9   0.9
10  1.0
11  1.1
12  1.2
13  1.3
14  1.4
15  1.5
16  1.6
17  1.7
18  1.8
19  1.9
20  2.0
21  2.1
22  2.2
23  2.3
24  2.4
25  2.5
26  2.6
27  2.7
28  2.8
29  2.9
30  3.0

The list I have (MeppenRech):
    Windgeschwindigkeit
0   0.3
1   0.7
2   0.8
3   0.9
4   1.0
5   1.1
6   1.2
7   1.3
8   1.4
9   1.5
10  1.6
11  1.7
12  1.8
13  1.9
14  2.0
15  2.1
16  2.2
17  2.3
18  2.4
19  2.5
20  2.6
21  2.7
22  2.8
23  2.9
24  3.0
    
This is my attempt: 
if MeppenRech['Windgeschwindigkeit'] == logifunclist['Wind']:
    MeppenRech['Prozentneu'] = MeppenRech['Prozent']
else: 
    MeppenRech['Prozentneu'] = 'nv'

I tried to create two new columns with the wind speed and my percentage.

I get following Error: ValueError: Can only compare identically-labeled Series objects

Aucun commentaire:

Enregistrer un commentaire