Skip to content

Tag: python

Groupby mean doesn’t display all data

I want to see all the means of the numerical columns, grouped by position, using When I do this I only get 3 of the many columns The other columns are all integers or floats, and they have no NAs. If I do Then I get the correct output. How can I display weight using groupby? Thanks for any help

Numpy matrix multiplication with scalar results in negative zeros

I have a random nxn matrix A with floating points, then I call matrix nxn which has diagonal values (0 elsewhere) now I want to multiply every even row with -2 so I do however it returns Why do the zeroes have negative sign? Does this matter at all and if so is it possible to avoid having that? Thank

Django change upgrade MSSQL database

I have a Django app that was running without any problem with SQL server 2008, I have an issue like this after I upgraded the MS SQL server 2008 into 2019. I didn’t change anything in the code but when I’m calling the DB, I face this error: 42000′, ‘[42000] [Microsoft][ODBC Driver 17 f…

time complexity of concatenating strings in python

What is is the time complexity for the following function in Python? The function takes two inputs, string1 and string2, concatenates them together using “+” and returns the concatenated string. is it O(n + m) where n is the length of string1 and m is the length of string2? thanks! Answer Yes, it …

Mutiplying dataframe by -1 loses data

I have an issue and I have no idea what is causing it.. I have a very very simply dataframe which looks like the following; I simply need to convert this dataframe to positive numbers. When I do this with a simple; A column multiples but the B column loses its’ data to the following; I assume this is so…