min_row attribute of workbook unexpectedly changes value
up vote
0
down vote
favorite
I load excel workbook using openpyxl=2.5.8
, check it's dimensions to create a numpy array of same size. I have noticed very unusual behavior, min_row
attribute changes its value after list(worksheet.rows)
.
worksheet.rows
is a generator yielding rows, this behavior only occurs after dumping generator to a list.
How is it possible that min_row
changes?
File
from openpyxl import load_workbook
worksheet = load_workbook(file).worksheets[0]
worksheet.max_row # output: 14
worksheet.min_row # output: 2
worksheet.max_column # output: 20
worksheet.min_column # output: 1
list(worksheet.rows)
worksheet.max_row # output: 14
worksheet.min_row # output: 1
worksheet.max_column # output: 10
worksheet.min_column # output: 1
python excel openpyxl
add a comment |
up vote
0
down vote
favorite
I load excel workbook using openpyxl=2.5.8
, check it's dimensions to create a numpy array of same size. I have noticed very unusual behavior, min_row
attribute changes its value after list(worksheet.rows)
.
worksheet.rows
is a generator yielding rows, this behavior only occurs after dumping generator to a list.
How is it possible that min_row
changes?
File
from openpyxl import load_workbook
worksheet = load_workbook(file).worksheets[0]
worksheet.max_row # output: 14
worksheet.min_row # output: 2
worksheet.max_column # output: 20
worksheet.min_column # output: 1
list(worksheet.rows)
worksheet.max_row # output: 14
worksheet.min_row # output: 1
worksheet.max_column # output: 10
worksheet.min_column # output: 1
python excel openpyxl
Not really possible to say without the file. All boundaries are calculated on the fiy.
– Charlie Clark
Nov 7 at 12:40
I have uploaded the file and provided download link.
– dylan_fan
Nov 7 at 12:50
I can't replicate the behaviour with that file. You must be doing something else.
– Charlie Clark
Nov 7 at 13:23
weird, I just downloaded file on colleague's laptop and run the snippet, reproduced results from my local machine
– dylan_fan
Nov 7 at 13:46
1
Well I can reproduce this behaviour on min_row (i.stack.imgur.com/oV8Us.png) but I do not have any direct solution - the only thing I found is that it does not affect deep copy of the workbook, so maybe you can somehow solve this by copying workbook?
– Zak
Nov 8 at 9:55
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I load excel workbook using openpyxl=2.5.8
, check it's dimensions to create a numpy array of same size. I have noticed very unusual behavior, min_row
attribute changes its value after list(worksheet.rows)
.
worksheet.rows
is a generator yielding rows, this behavior only occurs after dumping generator to a list.
How is it possible that min_row
changes?
File
from openpyxl import load_workbook
worksheet = load_workbook(file).worksheets[0]
worksheet.max_row # output: 14
worksheet.min_row # output: 2
worksheet.max_column # output: 20
worksheet.min_column # output: 1
list(worksheet.rows)
worksheet.max_row # output: 14
worksheet.min_row # output: 1
worksheet.max_column # output: 10
worksheet.min_column # output: 1
python excel openpyxl
I load excel workbook using openpyxl=2.5.8
, check it's dimensions to create a numpy array of same size. I have noticed very unusual behavior, min_row
attribute changes its value after list(worksheet.rows)
.
worksheet.rows
is a generator yielding rows, this behavior only occurs after dumping generator to a list.
How is it possible that min_row
changes?
File
from openpyxl import load_workbook
worksheet = load_workbook(file).worksheets[0]
worksheet.max_row # output: 14
worksheet.min_row # output: 2
worksheet.max_column # output: 20
worksheet.min_column # output: 1
list(worksheet.rows)
worksheet.max_row # output: 14
worksheet.min_row # output: 1
worksheet.max_column # output: 10
worksheet.min_column # output: 1
python excel openpyxl
python excel openpyxl
edited Nov 7 at 13:50
asked Nov 7 at 12:23
dylan_fan
353212
353212
Not really possible to say without the file. All boundaries are calculated on the fiy.
– Charlie Clark
Nov 7 at 12:40
I have uploaded the file and provided download link.
– dylan_fan
Nov 7 at 12:50
I can't replicate the behaviour with that file. You must be doing something else.
– Charlie Clark
Nov 7 at 13:23
weird, I just downloaded file on colleague's laptop and run the snippet, reproduced results from my local machine
– dylan_fan
Nov 7 at 13:46
1
Well I can reproduce this behaviour on min_row (i.stack.imgur.com/oV8Us.png) but I do not have any direct solution - the only thing I found is that it does not affect deep copy of the workbook, so maybe you can somehow solve this by copying workbook?
– Zak
Nov 8 at 9:55
add a comment |
Not really possible to say without the file. All boundaries are calculated on the fiy.
– Charlie Clark
Nov 7 at 12:40
I have uploaded the file and provided download link.
– dylan_fan
Nov 7 at 12:50
I can't replicate the behaviour with that file. You must be doing something else.
– Charlie Clark
Nov 7 at 13:23
weird, I just downloaded file on colleague's laptop and run the snippet, reproduced results from my local machine
– dylan_fan
Nov 7 at 13:46
1
Well I can reproduce this behaviour on min_row (i.stack.imgur.com/oV8Us.png) but I do not have any direct solution - the only thing I found is that it does not affect deep copy of the workbook, so maybe you can somehow solve this by copying workbook?
– Zak
Nov 8 at 9:55
Not really possible to say without the file. All boundaries are calculated on the fiy.
– Charlie Clark
Nov 7 at 12:40
Not really possible to say without the file. All boundaries are calculated on the fiy.
– Charlie Clark
Nov 7 at 12:40
I have uploaded the file and provided download link.
– dylan_fan
Nov 7 at 12:50
I have uploaded the file and provided download link.
– dylan_fan
Nov 7 at 12:50
I can't replicate the behaviour with that file. You must be doing something else.
– Charlie Clark
Nov 7 at 13:23
I can't replicate the behaviour with that file. You must be doing something else.
– Charlie Clark
Nov 7 at 13:23
weird, I just downloaded file on colleague's laptop and run the snippet, reproduced results from my local machine
– dylan_fan
Nov 7 at 13:46
weird, I just downloaded file on colleague's laptop and run the snippet, reproduced results from my local machine
– dylan_fan
Nov 7 at 13:46
1
1
Well I can reproduce this behaviour on min_row (i.stack.imgur.com/oV8Us.png) but I do not have any direct solution - the only thing I found is that it does not affect deep copy of the workbook, so maybe you can somehow solve this by copying workbook?
– Zak
Nov 8 at 9:55
Well I can reproduce this behaviour on min_row (i.stack.imgur.com/oV8Us.png) but I do not have any direct solution - the only thing I found is that it does not affect deep copy of the workbook, so maybe you can somehow solve this by copying workbook?
– Zak
Nov 8 at 9:55
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53189425%2fmin-row-attribute-of-workbook-unexpectedly-changes-value%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Not really possible to say without the file. All boundaries are calculated on the fiy.
– Charlie Clark
Nov 7 at 12:40
I have uploaded the file and provided download link.
– dylan_fan
Nov 7 at 12:50
I can't replicate the behaviour with that file. You must be doing something else.
– Charlie Clark
Nov 7 at 13:23
weird, I just downloaded file on colleague's laptop and run the snippet, reproduced results from my local machine
– dylan_fan
Nov 7 at 13:46
1
Well I can reproduce this behaviour on min_row (i.stack.imgur.com/oV8Us.png) but I do not have any direct solution - the only thing I found is that it does not affect deep copy of the workbook, so maybe you can somehow solve this by copying workbook?
– Zak
Nov 8 at 9:55