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









share|improve this question
























  • 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















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









share|improve this question
























  • 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













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









share|improve this question















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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


















  • 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

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














 

draft saved


draft discarded


















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






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















 

draft saved


draft discarded



















































 


draft saved


draft discarded














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





















































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







這個網誌中的熱門文章

Hercules Kyvelos

Tangent Lines Diagram Along Smooth Curve

Yusuf al-Mu'taman ibn Hud