# Reshape array - Basic Python

**URL:** <https://community.deeplearning.ai/t/reshape-array-basic-python/21620>\
**Category:** Neural Networks and Deep Learning\
**Tags:** coursera-platform\
**Created:** [July 17, 2021, 12:42pm UTC](https://community.deeplearning.ai/t/reshape-array-basic-python/21620 "2021-07-17T12:42:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dinhngoc](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/dinhngoc/32/4541_2.png) [@dinhngoc](https://community.deeplearning.ai/u/dinhngoc)\
**Post date:** [July 17, 2021, 12:42pm UTC](https://community.deeplearning.ai/t/reshape-array-basic-python/21620/1 "2021-07-17T12:42:54Z")

</div>

H​i,

C​an anyone help me explain this:

`v = v.reshape(-1, 1)`

To reshape an 3D image → 2D image which its dimension will be (image.shape[0]\*image.shape[1], image.shape[2])

Can you give a general formula because I have seen this so far but not this case. using -1 in reshape but I don’t understand the principles like retain the last dimension ( by -1) how about 1 in (-1,1)?

---

<div class="post-metadata">

**Author:** ![paulinpaloalto](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/paulinpaloalto/32/187_2.png) [@paulinpaloalto](https://community.deeplearning.ai/u/paulinpaloalto)\
**Post date:** [July 18, 2021, 5:11am UTC](https://community.deeplearning.ai/t/reshape-array-basic-python/21620/2 "2021-07-18T05:11:29Z")

</div>

The use of -1 in that syntax does not mean “the last index”. It means “use whatever dimensions are left over here”. So saying _reshape(-1,1)_ just says that you want the result to be a column vector.

---

<div class="post-metadata">

**Author:** ![dinhngoc](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/dinhngoc/32/4541_2.png) [@dinhngoc](https://community.deeplearning.ai/u/dinhngoc)\
**Post date:** [July 18, 2021, 8:46am UTC](https://community.deeplearning.ai/t/reshape-array-basic-python/21620/3 "2021-07-18T08:46:29Z")

</div>

Thank you for your explaination
