row

Error: AttributeError: 'str' object has no attribute 'row'

Error: AttributeError: 'str' object has no attribute 'row' Question: I have code: def add_to_database(object_name, value): workbook = openpyxl.load_workbook(DATABASE_FILE) worksheet = workbook[DATABASE_SHEET] object_row = None for row in worksheet.iter_rows(min_row = 1, max_row = worksheet.max_row + 1, values_only = True): if row[0] == object_name: object_row = row break if object_row: worksheet.cell(row = object_row[0].row, column = 2).value += …

Total answers: 1

Create extra rows using date column pandas dataframe

Create extra rows using date column pandas dataframe Question: Imagine I have the following data: ID Leave Type Start Date End Date 1 Sick 2022-01-01 2022-01-01 1 Holiday 2023-03-28 2 Holiday 2023-01-01 2023-01-02 3 Work 2023-01-01 2023-01-01 I need to find a way to confirm Start Date and End Date have the same value. In …

Total answers: 3

Why is there extra space after the last column in a Tkinter application?

Why is there extra space after the last column in a Tkinter application? Question: I’m trying to build an application in Tkinter. When the user presses a button, I need 3 widgets to appear in certain rows and columns. When the user clicks again, I need 3 more widgets (of the same types) to appear …

Total answers: 1

Pandas: Find the left-most value in a pandas dataframe followed by all 1s

Pandas: Find the left-most value in a pandas dataframe followed by all 1s Question: I have the following dataset data = {‘ID’: [‘A’, ‘B’, ‘C’, ‘D’], ‘2012’: [0, 1, 1, 1], ‘2013’: [0, 0, 1, 1], ‘2014’: [0, 0, 0, 1], ‘2015’: [0, 0, 1, 1], ‘2016’: [0, 0, 1, 0], ‘2017’: [1, 0, 1,1]} …

Total answers: 1

Join rows and concatenate attribute values in a csv file with pandas

Join rows and concatenate attribute values in a csv file with pandas Question: I have a csv file structured like this: As you can see, many lines are repeated (they represent the same entity) with the attribute ‘category’ being the only difference between each other. I would like to join those rows and include all …

Total answers: 2

Creating a dictionary of dictionaries from a CSV file

Creating a dictionary of dictionaries from a CSV file Question: I am trying to create a dictionary of dictionaries in Python from a CSV file, the file looks something like this: Column 1 Column 2 Column 3 A flower 12 A sun 13 B cloud 14 B water 34 C rock 12 And I am …

Total answers: 1

truth value of a Series is ambiguous

truth value of a Series is ambiguous Question: I am trying to create new column in pandas dataframe with row number as condition using iloc. This is my code: import pandas as pd shop=pd.DataFrame.from_dict(data) def cate_shop (shop): if shop==shop.iloc[:4]: return ‘Service’ if shop==shop.iloc[4:140]: return ‘Food & Beverage’ if shop==shop.iloc[140:173]: return ‘Fashion’ if shop==shop.iloc[173:197]: return ‘Electronics’ …

Total answers: 1

Remove rows with similar values

Remove rows with similar values Question: I want to remove all rows where Column "a" value = Column "b" value from the DataFrame like this: a b 1 AAA BBB 2 AAA CCC 3 AAA AAA 4 CCC CCC 5 CCC BBB 6 CCC DDD Desired output: a b 1 AAA BBB 2 AAA CCC …

Total answers: 4

Why doesn't Sympy's row_del() method work (example from geeksforgeeeks website)?

Why doesn't Sympy's row_del() method work (example from geeksforgeeeks website)? Question: TL;DR There is an inconsistency when using Sympy’s [Matrix].row_del() method and websites seem to be reporting its use wrongly. Note from the following link from the geeksforgeeks website for an example of deleting matrix rows using sympy: from sympy import * # use the …

Total answers: 1