Posts by Murgalha • 284 points
11 posts
-
4
votes2
answers260
viewsA: In Python, how do you remove specific characters from all the records of just one particular column?
Another way, besides using map (as pointed out in another reply), is to use the conversion and string methods provided by pandas, thus: raw_data['nome_arquivo'].str.rstrip('.txt') The above snippet…
-
0
votes1
answer227
viewsA: Dataframe Pandas - Apply the groupby of a column to other rows
Just filter the non-null elements from the 'Pico' column, like this: df = df[df['Pico'].notnull()] EDIT: If you only need to filter the repeated values, without any other type of operation involved,…
-
0
votes2
answers56
viewsA: Loop "while" ending earlier than expected
First of all, you’re not putting contador=1 within the while, but within the main. A simple way to do what you want is to use 2 nested loops, this way: #include <stdio.h> #include…
-
2
votes2
answers431
viewsA: I’m trying to write a program that calculates the monthly percentage of a distributor
Your problem is in the percentage formula. You must divide the value of a state by the total and not multiply it. Then multiply by 100% to find the percentage (you reversed the operators): sp =…
-
3
votes3
answers1578
viewsA: Separating numbers into even and odd lists - Python
The problem with your code is in valores = pares = impares = list() This generates only one list but with three variables referencing it. Thus, the odd-pair check loop never stops running as…
-
1
votes2
answers77
viewsA: How to delete repeated numbers within a Javascript array?
To do this, just check if the number already exists in the array numeros as follows: function adicionar () { if (numeros.length >= 10 ) { window.alert('Não é possível inserir mais números.') }…
-
0
votes3
answers381
viewsA: How to remove hours from a Datetime string
A possible solution is to use the class Date: const formatarData = (data) =>{ let d = new Date(data); // Month retorna entre 0 e 11, por isso a adição +1 return…
-
1
votes3
answers199
viewsA: Compare values of two arrays and generate a third with the unique javascript values
Your algorithm is wrong, it checks which elements in todos are also closed, when in fact should check which are NOT closed. function arrayabertas(){ var todos = [08072020105842, 08072020110953,…
javascriptanswered Murgalha 284 -
0
votes1
answer48
viewsA: I need help analyzing a list and printing which elements repeat equally in the list. PYTHON
You can use a dictionary to store the quantities of each element: def mais_requisitados(serv): dict_count = {} for elem in serv: # incrementa se a chave já existir # marca como 1 se for a primeira…
-
0
votes1
answer17
viewsA: HREF Setting Button Color
The icon turns blue because it is an already visited link. To keep the button white, simply force the style of visited links in a css file or tag <style> in html itself: a:visited { color:…
-
2
votes2
answers165
viewsA: Answer coming out only true for all elements, or false
Its function trueoufalse receives only 1 hour as argument, therefore the for will never execute. Just make the comparison between the numbers, since the function a already iterates for the elements:…