Excellent narration. Your videos are so precise. Not beating around the bush as many RUclipsrs do. I start following your videos recently and I it gives me great results. In the summing up of rows I encounter a problem of which I am not able to figure out. I tried to do the same example of yours and it is frustrating that I don't get the result. The code I have written is: df['sums'] = df.sum(axis=1). and I keep getting the error message: TypeError: unsupported operand type(s) for +: 'int' and 'str' Please... can you help me.
Hi Bradon. May I ask how do I sum x amount of vertical rows together? Let say I have a 1 hour data of walked miles in every row and I want manipulate the df to show walked miles for every 8 hours in one row, esentially combining 8, 1hour rows together.
Hi Marcell, You can accomplish this with the following bit of code: N = 8 df['col_1'].groupby(df.index // N).sum() N = represents the number of rows you want to sum df = your dataframe // divide with no remainder (round down) (df.index // N) - returns unique groups of the first 8 values, 2nd 8 values, 3rd 8 values,… Use groupby to sum the groups you are making with (df.index//N) This works because 0 // 8 = 0 through 7 //8 = 0 (this is your first group of 8 values), the second group of values 8//8 through 15//8 = 1, that is your second group of values
@@ChartExplorers the playlist of which the original video was part of? honestly I only found this video because I was browsing the comments, and this one helped immensley. thanks !
@@richarda1630 Oh I see, thanks for the suggestion! This video is in the same playlist, but it was hidden in the middle of the playlist. I've moved it so it show up just after the original video.
How can I sort on a summed up column, for example i grouped on (COL1).[Col2].Sum () , How can i sort on the newly created column and make a new dataframe.
It's the same for floats and integers. You will want to check the data type of the column and make sure it is not an object. df['col_name'].dtype If it is an object .sum() will not work and you will need to first convert the data type to float or int. You can learn more about converting data types in this video ruclips.net/video/evKYySLSzyk/видео.html Let me know if you run into any problems.
Very clear. Great presentation.
Excellent narration. Your videos are so precise. Not beating around the bush as many RUclipsrs do. I start following your videos recently and I it gives me great results. In the summing up of rows I encounter a problem of which I am not able to figure out. I tried to do the same example of yours and it is frustrating that I don't get the result. The code I have written is:
df['sums'] = df.sum(axis=1).
and I keep getting the error message: TypeError: unsupported operand type(s) for +: 'int' and 'str'
Please... can you help me.
can you make a video on pandas real world projects? You described very well
Or you have any course?
Helpfull
Hi Bradon. May I ask how do I sum x amount of vertical rows together? Let say I have a 1 hour data of walked miles in every row and I want manipulate the df to show walked miles for every 8 hours in one row, esentially combining 8, 1hour rows together.
Hi Marcell,
You can accomplish this with the following bit of code:
N = 8
df['col_1'].groupby(df.index // N).sum()
N = represents the number of rows you want to sum
df = your dataframe
// divide with no remainder (round down)
(df.index // N) - returns unique groups of the first 8 values, 2nd 8 values, 3rd 8 values,…
Use groupby to sum the groups you are making with (df.index//N)
This works because 0 // 8 = 0 through 7 //8 = 0 (this is your first group of 8 values), the second group of values 8//8 through 15//8 = 1, that is your second group of values
Thanks! can you make this one as part of your set/series?
Which series?
@@ChartExplorers the playlist of which the original video was part of? honestly I only found this video because I was browsing the comments, and this one helped immensley. thanks !
@@richarda1630 Oh I see, thanks for the suggestion! This video is in the same playlist, but it was hidden in the middle of the playlist. I've moved it so it show up just after the original video.
How can I sort on a summed up column, for example i grouped on (COL1).[Col2].Sum () , How can i sort on the newly created column and make a new dataframe.
What if you want to specify rows to sum?
Thank you..
how to sum a column of float numbers?
It's the same for floats and integers. You will want to check the data type of the column and make sure it is not an object.
df['col_name'].dtype
If it is an object .sum() will not work and you will need to first convert the data type to float or int. You can learn more about converting data types in this video ruclips.net/video/evKYySLSzyk/видео.html
Let me know if you run into any problems.
@@ChartExplorers Thankyou!