1
I have a dataframe with a column of hours and the other kind of relampago
.I’m making a value_counts
to count the amount of relampagos
every hour the day. The value_conts
is working, but there are a few hours of the day relampagos
, but ai is not appearing in the series. For example I wanted after q I gave a value_counts
, I wanted to show a series with the 24 hours and each hour the amount of relampagos
, and this appears, but the hours it has not had relampagos
, he jumps. But I wanted to show up every hour, and even the ones that didn’t relampago
, appeared the zero you know? Because I will need this, but I’m not getting. I tried to use np.arange
, sort_index(level=)
, .fillna(0)
. But it’s not working. My cell is like this:
quantidade_IC = IC["hor"].value_counts(ascending=True)
quantidade_IC.sort_index()
display(quantidade_IC.sort_index())
Ai the result (hours 11 and 12 do not appear with zero in front :/)
0 510
1 772
2 275
3 50
4 12
5 16
6 41
7 319
8 201
9 25
10 10
13 29
14 138
15 799
16 3619
17 9622
18 10935
19 13851
20 10928
21 6227
22 1500
23 594
makes a dictionary with all hours of the day as key and with 0 value for each one. Then update it with the return of q vc has the number of the rays at a given time. then just print this list.
– Jasar Orion
can provide an example dataset?
– Lucas
My dataframe has 72603 Rows 2 Columns
– Raquel