Skip to content

Tag: for-loop

Substract two row values in dataframe python

Currently I have a sort of dataframe where I want to substract value from current row from the previous one. example: df = pd.Datafame([1,4,3,5,6],columns = [“time”)]) left 1 4 3 5 6 I want to iterate over these rows and store it in a list. So the list will get like this [-3,1,-2,-1]. So far I have this Now the

how to write a conditional for loop in DAX?

I’m using PowerBI to create a dashboard that summarizes data from a train movements simulation. (I’m a psychologist with some basic understanding of python and currently learning DAX.) Here is some background: I use [index] to maintain the order of the rows [Notification] is a column that contains text [Train Nr] is a column that contains the ID of the

generated empty [i] in for loop

I want to create an empty set up to the value n entered by the user and assign the values in the for loop into this set. But for this, it is necessary to create as many for loops as the user inputs, it is not possible to do this. How can I do it? The code below works correctly,

Pandas appending dictionary values with iterrows row values

I have a dict of city names, each having an empty list as a value. I am trying to use df.iterrows() to append corresponding names to each dict key(city): Can somebody explain why the code above appends all possible ‘fullname’ values to each dict’s key instead of appending them to their respective city keys? I.e. instead of getting the result

For loop with lot of different Urls

totally novice in python, after many youtube videos and tutorial i’m trying to scrape basketball starting lineups from flashscore. Here’s an example of a link: https://www.flashscore.it/partita/6PN3pAhq/#informazioni-partita/formazioni As you can see in the middle there’s a code (6PN3pAhq) that corresponds to a particular match: every match has a different one, i scraped all the results (144 matches at the moment) and