Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
Post History
I found a way how to fix it after I debug. It was only using the last used row because there was nothing to check that I want to edit only the current row. That's why I decide to use at for index,...
Answer
#4: Post edited
Hi, I have one more question, because I do something wrong. If you notice the last column new Value is getting only from the last row. Which is ending with 416. Somehow I want inside of this for to update and create the new column to contain for each row the updated pattern.![Image alt text](https://software.codidact.com/uploads/1CxdEXsPMXCqH8HGU9aPAJLF)**[EDIT]**I found a way how to fix it after I debug. It was only using the last used row, because there was nothing to check that I want to edit only the current row. That's why I decide to use `at`- ```Python
- for index, row in priceListTest.iterrows():
- #print(index,row)
- def get_slices(n, sizes, n_digits=11):
- for size in sizes:
- n_digits -= size
- val, n = divmod(n, 10 ** n_digits)
- yield f'{val:0{size}}'
- n = row['Парт номер']
- newVar = (' '.join(get_slices(n, [2, 2, 1, 3, 3])))
- priceListTest.at[index,['New Value']] = newVar
- print("after changes")
- print(priceListTest)
- I found a way how to fix it after I debug. It was only using the last used row because there was nothing to check that I want to edit only the current row. That's why I decide to use `at`
- ```Python
- for index, row in priceListTest.iterrows():
- #print(index,row)
- def get_slices(n, sizes, n_digits=11):
- for size in sizes:
- n_digits -= size
- val, n = divmod(n, 10 ** n_digits)
- yield f'{val:0{size}}'
- n = row['Парт номер']
- newVar = (' '.join(get_slices(n, [2, 2, 1, 3, 3])))
- priceListTest.at[index,['New Value']] = newVar
- print("after changes")
- print(priceListTest)
#3: Post edited
- Hi, I have one more question, because I do something wrong. If you notice the last column new Value is getting only from the last row. Which is ending with 416. Somehow I want inside of this for to update and create the new column to contain for each row the updated pattern.
- ![Image alt text](https://software.codidact.com/uploads/1CxdEXsPMXCqH8HGU9aPAJLF)
- I found a way how to fix it after I debug. It was only using the last used row, because there was nothing to check that I want to edit only the current row. That's why I decide to use `at`
- ```Python
- for index, row in priceListTest.iterrows():
- #print(index,row)
- def get_slices(n, sizes, n_digits=11):
- for size in sizes:
- n_digits -= size
- val, n = divmod(n, 10 ** n_digits)
- yield f'{val:0{size}}'
- n = row['Парт номер']
- newVar = (' '.join(get_slices(n, [2, 2, 1, 3, 3])))
- priceListTest.at[index,['New Value']] = newVar
- print("after changes")
- print(priceListTest)
- Hi, I have one more question, because I do something wrong. If you notice the last column new Value is getting only from the last row. Which is ending with 416. Somehow I want inside of this for to update and create the new column to contain for each row the updated pattern.
- ![Image alt text](https://software.codidact.com/uploads/1CxdEXsPMXCqH8HGU9aPAJLF)
- **[EDIT]**
- I found a way how to fix it after I debug. It was only using the last used row, because there was nothing to check that I want to edit only the current row. That's why I decide to use `at`
- ```Python
- for index, row in priceListTest.iterrows():
- #print(index,row)
- def get_slices(n, sizes, n_digits=11):
- for size in sizes:
- n_digits -= size
- val, n = divmod(n, 10 ** n_digits)
- yield f'{val:0{size}}'
- n = row['Парт номер']
- newVar = (' '.join(get_slices(n, [2, 2, 1, 3, 3])))
- priceListTest.at[index,['New Value']] = newVar
- print("after changes")
- print(priceListTest)
#2: Post edited
- Hi, I have one more question, because I do something wrong. If you notice the last column new Value is getting only from the last row. Which is ending with 416. Somehow I want inside of this for to update and create the new column to contain for each row the updated pattern.
![Image alt text](https://software.codidact.com/uploads/1CxdEXsPMXCqH8HGU9aPAJLF)
- Hi, I have one more question, because I do something wrong. If you notice the last column new Value is getting only from the last row. Which is ending with 416. Somehow I want inside of this for to update and create the new column to contain for each row the updated pattern.
- ![Image alt text](https://software.codidact.com/uploads/1CxdEXsPMXCqH8HGU9aPAJLF)
- I found a way how to fix it after I debug. It was only using the last used row, because there was nothing to check that I want to edit only the current row. That's why I decide to use `at`
- ```Python
- for index, row in priceListTest.iterrows():
- #print(index,row)
- def get_slices(n, sizes, n_digits=11):
- for size in sizes:
- n_digits -= size
- val, n = divmod(n, 10 ** n_digits)
- yield f'{val:0{size}}'
- n = row['Парт номер']
- newVar = (' '.join(get_slices(n, [2, 2, 1, 3, 3])))
- priceListTest.at[index,['New Value']] = newVar
- print("after changes")
- print(priceListTest)
#1: Initial revision
Hi, I have one more question, because I do something wrong. If you notice the last column new Value is getting only from the last row. Which is ending with 416. Somehow I want inside of this for to update and create the new column to contain for each row the updated pattern. ![Image alt text](https://software.codidact.com/uploads/1CxdEXsPMXCqH8HGU9aPAJLF)