New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Direct writes to cells yield weird results #140

Closed
Sweepi opened this Issue Jun 8, 2018 · 0 comments

Comments

Projects
None yet
2 participants
@Sweepi

Sweepi commented Jun 8, 2018

Hi,

sorry if I am missing sth. obvious, but accessing cells via rowID and columnID does not work as intended for me, the writes affects all-1 rows of a column.
Reproducer:

TestSheet0 = pyexcel.Sheet()
TestSheet0[6, 6] = "6x6" # For some reason, the first cell written to defines the dimension of the 2d array
for row in range(0,3):
  for col in range (0,3):
    TestSheet0[row, col] = "{}x{}".format(row, col)
print("")
print("Final TestSheet0: ")
print(TestSheet0.content)
print("")
print("")

TestSheet1 = pyexcel.Sheet()
TestSheet1[4, 4] = "4x4" # For some reason, the first cell written to defines the dimension of the 2d array
for row in range(0,2):
  for col in range (0,2):
    print(TestSheet1.content)
    print("Writing {}x{}".format(row, col))  
    TestSheet1[row, col] = "{}x{}".format(row, col)
print("")
print("Final TestSheet1: ")
print(TestSheet1.content)
print("")
print("")

Output:

Final TestSheet0:
+-----+-----+-----+---+---+---+-----+
| 2x0 | 2x1 | 2x2 |   |   |   |     |
+-----+-----+-----+---+---+---+-----+
| 2x0 | 2x1 | 2x2 |   |   |   |     |
+-----+-----+-----+---+---+---+-----+
| 2x0 | 2x1 | 2x2 |   |   |   |     |
+-----+-----+-----+---+---+---+-----+
| 2x0 | 2x1 | 2x2 |   |   |   |     |
+-----+-----+-----+---+---+---+-----+
| 2x0 | 2x1 | 2x2 |   |   |   |     |
+-----+-----+-----+---+---+---+-----+
| 2x0 | 2x1 | 2x2 |   |   |   |     |
+-----+-----+-----+---+---+---+-----+
|     |     |     |   |   |   | 6x6 |
+-----+-----+-----+---+---+---+-----+


+---+---+---+---+-----+
|   |   |   |   |     |
+---+---+---+---+-----+
|   |   |   |   |     |
+---+---+---+---+-----+
|   |   |   |   |     |
+---+---+---+---+-----+
|   |   |   |   |     |
+---+---+---+---+-----+
|   |   |   |   | 4x4 |
+---+---+---+---+-----+
Writing 0x0
+-----+---+---+---+-----+
| 0x0 |   |   |   |     |
+-----+---+---+---+-----+
| 0x0 |   |   |   |     |
+-----+---+---+---+-----+
| 0x0 |   |   |   |     |
+-----+---+---+---+-----+
| 0x0 |   |   |   |     |
+-----+---+---+---+-----+
|     |   |   |   | 4x4 |
+-----+---+---+---+-----+
Writing 0x1
+-----+-----+---+---+-----+
| 0x0 | 0x1 |   |   |     |
+-----+-----+---+---+-----+
| 0x0 | 0x1 |   |   |     |
+-----+-----+---+---+-----+
| 0x0 | 0x1 |   |   |     |
+-----+-----+---+---+-----+
| 0x0 | 0x1 |   |   |     |
+-----+-----+---+---+-----+
|     |     |   |   | 4x4 |
+-----+-----+---+---+-----+
Writing 1x0
+-----+-----+---+---+-----+
| 1x0 | 0x1 |   |   |     |
+-----+-----+---+---+-----+
| 1x0 | 0x1 |   |   |     |
+-----+-----+---+---+-----+
| 1x0 | 0x1 |   |   |     |
+-----+-----+---+---+-----+
| 1x0 | 0x1 |   |   |     |
+-----+-----+---+---+-----+
|     |     |   |   | 4x4 |
+-----+-----+---+---+-----+
Writing 1x1

Final TestSheet1:
+-----+-----+---+---+-----+
| 1x0 | 1x1 |   |   |     |
+-----+-----+---+---+-----+
| 1x0 | 1x1 |   |   |     |
+-----+-----+---+---+-----+
| 1x0 | 1x1 |   |   |     |
+-----+-----+---+---+-----+
| 1x0 | 1x1 |   |   |     |
+-----+-----+---+---+-----+
|     |     |   |   | 4x4 |
+-----+-----+---+---+-----+

@chfw chfw added the bug label Aug 29, 2018

@chfw chfw closed this in 93957e4 Aug 30, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment