Submit Search
Upload
reshape.pdf
•
0 likes
•
3 views
Jose Miguel Alves
Follow
Python Pandas Reshape
Read less
Read more
Data & Analytics
Report
Share
Report
Share
1 of 1
Download now
Download to read offline
Recommended
Mergesort
Mergesort
luzenith_g
Arithmetic and geometric_sequences
Arithmetic and geometric_sequences
Dreams4school
Natural and Clamped Cubic Splines
Natural and Clamped Cubic Splines
Mark Brandao
Chart parsing with features
Chart parsing with features
SRah Sanei
R Programming: Numeric Functions In R
R Programming: Numeric Functions In R
Rsquared Academy
Algorithim lec1.pptx
Algorithim lec1.pptx
rediet43
Exponent & Logarithm
Exponent & Logarithm
guest0ffcb4
Maths (2)
Maths (2)
Arjun kumar Malhi
Recommended
Mergesort
Mergesort
luzenith_g
Arithmetic and geometric_sequences
Arithmetic and geometric_sequences
Dreams4school
Natural and Clamped Cubic Splines
Natural and Clamped Cubic Splines
Mark Brandao
Chart parsing with features
Chart parsing with features
SRah Sanei
R Programming: Numeric Functions In R
R Programming: Numeric Functions In R
Rsquared Academy
Algorithim lec1.pptx
Algorithim lec1.pptx
rediet43
Exponent & Logarithm
Exponent & Logarithm
guest0ffcb4
Maths (2)
Maths (2)
Arjun kumar Malhi
QR Factorizations and SVDs for Tall-and-skinny Matrices in MapReduce Architec...
QR Factorizations and SVDs for Tall-and-skinny Matrices in MapReduce Architec...
Austin Benson
Algorithm.ppt
Algorithm.ppt
Tareq Hasan
Introduction to MatLab programming
Introduction to MatLab programming
Damian T. Gordon
C1 - Insertion Sort
C1 - Insertion Sort
Juan Zamora, MSc. MBA
Algebra 2 unit 12.2.12.4
Algebra 2 unit 12.2.12.4
Mark Ryder
Intoduction to numpy
Intoduction to numpy
Faraz Ahmed
Insersion & Bubble Sort in Algoritm
Insersion & Bubble Sort in Algoritm
Ehsan Ehrari
Bubble and-merge-sort
Bubble and-merge-sort
nikhilsh66131
4-Regular expression to Deterministic Finite Automata (Direct method)-05-05-2...
4-Regular expression to Deterministic Finite Automata (Direct method)-05-05-2...
venkatapranaykumarGa
Week-5-Inverse-Function-NGY.pptx
Week-5-Inverse-Function-NGY.pptx
ExtremelyDarkness2
Spiral array
Spiral array
Akhilesh Agrawal
Matlabch01
Matlabch01
Mohammad Ayyash
M.c.a (1)
M.c.a (1)
8930615208
07012023.pptx
07012023.pptx
NareshBopparathi1
Ch5b.ppt
Ch5b.ppt
MDSayem35
Barisan dan deret 1 bilingual
Barisan dan deret 1 bilingual
mentjirungkat
Dsp manual
Dsp manual
Vijendrasingh Rathor
Cpl
Cpl
Ayesha Shariff
Data structure 8.pptx
Data structure 8.pptx
SajalFayyaz
Set 1 mawar
Set 1 mawar
faazafauzana
Formulas dax para power bI de microsoft.pdf
Formulas dax para power bI de microsoft.pdf
RobertoOcampo24
Digital Marketing Demystified: Expert Tips from Samantha Rae Coolbeth
Digital Marketing Demystified: Expert Tips from Samantha Rae Coolbeth
Samantha Rae Coolbeth
More Related Content
Similar to reshape.pdf
QR Factorizations and SVDs for Tall-and-skinny Matrices in MapReduce Architec...
QR Factorizations and SVDs for Tall-and-skinny Matrices in MapReduce Architec...
Austin Benson
Algorithm.ppt
Algorithm.ppt
Tareq Hasan
Introduction to MatLab programming
Introduction to MatLab programming
Damian T. Gordon
C1 - Insertion Sort
C1 - Insertion Sort
Juan Zamora, MSc. MBA
Algebra 2 unit 12.2.12.4
Algebra 2 unit 12.2.12.4
Mark Ryder
Intoduction to numpy
Intoduction to numpy
Faraz Ahmed
Insersion & Bubble Sort in Algoritm
Insersion & Bubble Sort in Algoritm
Ehsan Ehrari
Bubble and-merge-sort
Bubble and-merge-sort
nikhilsh66131
4-Regular expression to Deterministic Finite Automata (Direct method)-05-05-2...
4-Regular expression to Deterministic Finite Automata (Direct method)-05-05-2...
venkatapranaykumarGa
Week-5-Inverse-Function-NGY.pptx
Week-5-Inverse-Function-NGY.pptx
ExtremelyDarkness2
Spiral array
Spiral array
Akhilesh Agrawal
Matlabch01
Matlabch01
Mohammad Ayyash
M.c.a (1)
M.c.a (1)
8930615208
07012023.pptx
07012023.pptx
NareshBopparathi1
Ch5b.ppt
Ch5b.ppt
MDSayem35
Barisan dan deret 1 bilingual
Barisan dan deret 1 bilingual
mentjirungkat
Dsp manual
Dsp manual
Vijendrasingh Rathor
Cpl
Cpl
Ayesha Shariff
Data structure 8.pptx
Data structure 8.pptx
SajalFayyaz
Set 1 mawar
Set 1 mawar
faazafauzana
Similar to reshape.pdf
(20)
QR Factorizations and SVDs for Tall-and-skinny Matrices in MapReduce Architec...
QR Factorizations and SVDs for Tall-and-skinny Matrices in MapReduce Architec...
Algorithm.ppt
Algorithm.ppt
Introduction to MatLab programming
Introduction to MatLab programming
C1 - Insertion Sort
C1 - Insertion Sort
Algebra 2 unit 12.2.12.4
Algebra 2 unit 12.2.12.4
Intoduction to numpy
Intoduction to numpy
Insersion & Bubble Sort in Algoritm
Insersion & Bubble Sort in Algoritm
Bubble and-merge-sort
Bubble and-merge-sort
4-Regular expression to Deterministic Finite Automata (Direct method)-05-05-2...
4-Regular expression to Deterministic Finite Automata (Direct method)-05-05-2...
Week-5-Inverse-Function-NGY.pptx
Week-5-Inverse-Function-NGY.pptx
Spiral array
Spiral array
Matlabch01
Matlabch01
M.c.a (1)
M.c.a (1)
07012023.pptx
07012023.pptx
Ch5b.ppt
Ch5b.ppt
Barisan dan deret 1 bilingual
Barisan dan deret 1 bilingual
Dsp manual
Dsp manual
Cpl
Cpl
Data structure 8.pptx
Data structure 8.pptx
Set 1 mawar
Set 1 mawar
Recently uploaded
Formulas dax para power bI de microsoft.pdf
Formulas dax para power bI de microsoft.pdf
RobertoOcampo24
Digital Marketing Demystified: Expert Tips from Samantha Rae Coolbeth
Digital Marketing Demystified: Expert Tips from Samantha Rae Coolbeth
Samantha Rae Coolbeth
Northern New England Tableau User Group (TUG) May 2024
Northern New England Tableau User Group (TUG) May 2024
patrickdtherriault
Jual Obat Aborsi Bandung (Asli No.1) Wa 082134680322 Klinik Obat Penggugur Ka...
Jual Obat Aborsi Bandung (Asli No.1) Wa 082134680322 Klinik Obat Penggugur Ka...
Klinik Aborsi
obat aborsi Bontang wa 081336238223 jual obat aborsi cytotec asli di Bontang6...
obat aborsi Bontang wa 081336238223 jual obat aborsi cytotec asli di Bontang6...
yulianti213969
Data Analytics for Digital Marketing Lecture for Advanced Digital & Social Me...
Data Analytics for Digital Marketing Lecture for Advanced Digital & Social Me...
Valters Lauzums
1:1原版定制利物浦大学毕业证(Liverpool毕业证)成绩单学位证书留信学历认证
1:1原版定制利物浦大学毕业证(Liverpool毕业证)成绩单学位证书留信学历认证
ppy8zfkfm
Sensing the Future: Anomaly Detection and Event Prediction in Sensor Networks
Sensing the Future: Anomaly Detection and Event Prediction in Sensor Networks
Boston Institute of Analytics
MATERI MANAJEMEN OF PENYAKIT TETANUS.ppt
MATERI MANAJEMEN OF PENYAKIT TETANUS.ppt
RachmaGhifari
Identify Customer Segments to Create Customer Offers for Each Segment - Appli...
Identify Customer Segments to Create Customer Offers for Each Segment - Appli...
ThinkInnovation
1:1原版定制伦敦政治经济学院毕业证(LSE毕业证)成绩单学位证书留信学历认证
1:1原版定制伦敦政治经济学院毕业证(LSE毕业证)成绩单学位证书留信学历认证
dq9vz1isj
如何办理(Dalhousie毕业证书)达尔豪斯大学毕业证成绩单留信学历认证
如何办理(Dalhousie毕业证书)达尔豪斯大学毕业证成绩单留信学历认证
zifhagzkk
Data Visualization Exploring and Explaining with Data 1st Edition by Camm sol...
Data Visualization Exploring and Explaining with Data 1st Edition by Camm sol...
ssuserf63bd7
Data Analysis Project Presentation : NYC Shooting Cluster Analysis
Data Analysis Project Presentation : NYC Shooting Cluster Analysis
Boston Institute of Analytics
如何办理(UPenn毕业证书)宾夕法尼亚大学毕业证成绩单本科硕士学位证留信学历认证
如何办理(UPenn毕业证书)宾夕法尼亚大学毕业证成绩单本科硕士学位证留信学历认证
acoha1
Predictive Precipitation: Advanced Rain Forecasting Techniques
Predictive Precipitation: Advanced Rain Forecasting Techniques
Boston Institute of Analytics
如何办理哥伦比亚大学毕业证(Columbia毕业证)成绩单原版一比一
如何办理哥伦比亚大学毕业证(Columbia毕业证)成绩单原版一比一
fztigerwe
社内勉強会資料_Object Recognition as Next Token Prediction
社内勉強会資料_Object Recognition as Next Token Prediction
NABLAS株式会社
如何办理(WashU毕业证书)圣路易斯华盛顿大学毕业证成绩单本科硕士学位证留信学历认证
如何办理(WashU毕业证书)圣路易斯华盛顿大学毕业证成绩单本科硕士学位证留信学历认证
acoha1
Audience Researchndfhcvnfgvgbhujhgfv.pptx
Audience Researchndfhcvnfgvgbhujhgfv.pptx
Stephen266013
Recently uploaded
(20)
Formulas dax para power bI de microsoft.pdf
Formulas dax para power bI de microsoft.pdf
Digital Marketing Demystified: Expert Tips from Samantha Rae Coolbeth
Digital Marketing Demystified: Expert Tips from Samantha Rae Coolbeth
Northern New England Tableau User Group (TUG) May 2024
Northern New England Tableau User Group (TUG) May 2024
Jual Obat Aborsi Bandung (Asli No.1) Wa 082134680322 Klinik Obat Penggugur Ka...
Jual Obat Aborsi Bandung (Asli No.1) Wa 082134680322 Klinik Obat Penggugur Ka...
obat aborsi Bontang wa 081336238223 jual obat aborsi cytotec asli di Bontang6...
obat aborsi Bontang wa 081336238223 jual obat aborsi cytotec asli di Bontang6...
Data Analytics for Digital Marketing Lecture for Advanced Digital & Social Me...
Data Analytics for Digital Marketing Lecture for Advanced Digital & Social Me...
1:1原版定制利物浦大学毕业证(Liverpool毕业证)成绩单学位证书留信学历认证
1:1原版定制利物浦大学毕业证(Liverpool毕业证)成绩单学位证书留信学历认证
Sensing the Future: Anomaly Detection and Event Prediction in Sensor Networks
Sensing the Future: Anomaly Detection and Event Prediction in Sensor Networks
MATERI MANAJEMEN OF PENYAKIT TETANUS.ppt
MATERI MANAJEMEN OF PENYAKIT TETANUS.ppt
Identify Customer Segments to Create Customer Offers for Each Segment - Appli...
Identify Customer Segments to Create Customer Offers for Each Segment - Appli...
1:1原版定制伦敦政治经济学院毕业证(LSE毕业证)成绩单学位证书留信学历认证
1:1原版定制伦敦政治经济学院毕业证(LSE毕业证)成绩单学位证书留信学历认证
如何办理(Dalhousie毕业证书)达尔豪斯大学毕业证成绩单留信学历认证
如何办理(Dalhousie毕业证书)达尔豪斯大学毕业证成绩单留信学历认证
Data Visualization Exploring and Explaining with Data 1st Edition by Camm sol...
Data Visualization Exploring and Explaining with Data 1st Edition by Camm sol...
Data Analysis Project Presentation : NYC Shooting Cluster Analysis
Data Analysis Project Presentation : NYC Shooting Cluster Analysis
如何办理(UPenn毕业证书)宾夕法尼亚大学毕业证成绩单本科硕士学位证留信学历认证
如何办理(UPenn毕业证书)宾夕法尼亚大学毕业证成绩单本科硕士学位证留信学历认证
Predictive Precipitation: Advanced Rain Forecasting Techniques
Predictive Precipitation: Advanced Rain Forecasting Techniques
如何办理哥伦比亚大学毕业证(Columbia毕业证)成绩单原版一比一
如何办理哥伦比亚大学毕业证(Columbia毕业证)成绩单原版一比一
社内勉強会資料_Object Recognition as Next Token Prediction
社内勉強会資料_Object Recognition as Next Token Prediction
如何办理(WashU毕业证书)圣路易斯华盛顿大学毕业证成绩单本科硕士学位证留信学历认证
如何办理(WashU毕业证书)圣路易斯华盛顿大学毕业证成绩单本科硕士学位证留信学历认证
Audience Researchndfhcvnfgvgbhujhgfv.pptx
Audience Researchndfhcvnfgvgbhujhgfv.pptx
reshape.pdf
1.
19 20 21 22
23 24 13 14 15 16 17 18 7 8 9 10 11 12 9 21 10 22 11 23 12 24 5 17 6 18 7 19 8 20 9 10 11 12 21 22 23 24 5 6 7 8 17 18 19 20 1 2 3 4 5 6 7 8 9 10 11 12 1 2 3 4 5 6 7 8 9 10 11 12 a1 = np.arange(1, 13) Python numpy reshape and stack cheatsheet a1.reshape(3, 4) a1.reshape(-1, 4) a1.reshape(3, -1) a1.ravel() # back to 1D a1.reshape(3, -1, order='F') a1.ravel(order='F') # back to 1D 1 4 7 10 2 5 8 11 3 6 9 12 Created by Hause Lin. Tutorial on Medium. reshape & ravel stack 1 2 3 4 5 6 7 8 9 10 11 12 a1 = np.arange(1, 13) 13 14 15 16 17 18 19 20 21 22 23 24 a2 = np.arange(13, 25) np.stack((a1, a2)) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 np.stack((a1, a2), axis=1) 1 13 2 14 3 15 4 16 … … 9 21 10 22 11 23 12 24 1 2 3 4 5 … 20 21 22 23 24 np.hstack((a1, a2) a1 = np.arange(1, 13).reshape(3, 4) a2 = np.arange(13, 25).reshape(3, -1) 1 2 3 4 5 6 7 8 9 10 11 12 3D array from 2D arrays 13 14 15 16 17 18 19 20 21 22 23 24 # stack along axis 0 a3_0 = np.stack((a1, a2)) a3_0.shape: (2, 3, 4) 13 14 15 16 17 18 19 20 21 22 23 24 1 2 3 4 5 6 7 8 9 10 11 12 # stack along axis 1 a3_1 = np.stack((a1, a2), axis=1) a3_1.shape: (3, 2, 4) # stack along axis 2 a3_2 = np.stack((a1, a2), axis=2) a3_2.shape: (3, 4, 2) 1 2 3 4 13 14 15 16 1 13 2 14 3 15 4 16 # retrieve a1 a3_0[0] a3_0[0, :, :] # retrieve a1 a3_1[:, 0, :] # retrieve a1 a3_2[:, :, 0] flatten 3D array 13 14 15 16 17 18 19 20 21 22 23 24 1 2 3 4 5 6 7 8 9 10 11 12 1 13 5 17 9 … 16 8 20 12 24 # flatten/ravel a3_0.ravel() # flatten/ravel a3_0.ravel(order='F') 1 2 3 4 5 … 20 21 22 23 24 reshape 3D array # reshape from (2, 3, 4) to (4, 2, 3) a3_0.reshape(4, 2, 3) 1 2 3 4 5 6
Download now