Skip to content

Tag: reshape

bypandas shape (n,1) to shape (n,)

I have a pandas dataframe and I want to convert it from (n,1) to shape (n,). Probably I have to use squeeze but can’t figure out, How to. squeeze documentation I also tried z[‘0’]=z[‘0’].squeeze() but it didn’t help. How can I convert? Answer z=z.squeeze() works the best an…

supposedly incorrect output np.reshape function

I have an array called “foto_dct” with shape (16,16,8,8) which means 16×16 matrices of 8×8. When I print foto_dct[0,15], being the last matrix of the first row I get: when i do foto_dct_big = np.reshape(foto_dct,(128,128)) and print foto_dct_big I get this: As you can see is the top righ…