pandas

Select previous row from the given parameters

Select previous row from the given parameters Question: I have a data frame that looks like this: id code date 1 37 2022-01-11 1 22 2021-10-01 1 39 2019-02-11 1 21 2018-10-08 1 17 2018-09-19 1 18 2018-09-10 1 39 2017-03-20 1 36 2017-02-28 1 34 2017-02-14 1 31 2017-01-20 1 21 2016-11-17 1 17 …

Total answers: 1

PySide6: How to clear the values of all QPlainTextEdit and QComboBox elements after inserting data into a database?

PySide6: How to clear the values of all QPlainTextEdit and QComboBox elements after inserting data into a database? Question: Hy, i want to clear all qtextedit,qcombobox etc.., when a product is inserted in database,but i dont know, how to do it. Right now this is my function def commit(self): self.inserebd() tree_data=self.dadostree() self.contarserie() sql = """INSERT …

Total answers: 1

Efficiently add a value to a new column in a large DataFrame

Efficiently add a value to a new column in a large DataFrame Question: I have two dataframes, adv_text with about 9,000 rows and events with over 900,000 rows. events is essentially an expanded version of adv_text with about 100 rows per row in adv_text. I want to add three columns from adv_text to events. The …

Total answers: 1

Importing multiple .cnv files, extract filename, and attach as a column

Importing multiple .cnv files, extract filename, and attach as a column Question: I have multiple .cnv files that I can import and concatenate with the following code: import pandas as pd import numpy as np import matplotlib.pyplot as plt import glob # Get CSV files list from a folder path =’/Users/mariacristinaalvarez/Documents/High3/’ csv_files = glob.glob(path + …

Total answers: 2

Check if pandas row contains exact quantity of strings

Check if pandas row contains exact quantity of strings Question: I have a df1 32611 x 17: 0 1 2 3 4 5 … 11 12 13 14 15 16 0 BSO PRV BSI TUR WSP ACP … HLR HEX HEX None None None 1 BSO PRV BSI TUR WSP ACP … HLF HLR HEX …

Total answers: 1

pandas problem when assigning value using loc

pandas problem when assigning value using loc Question: So what is happening is the values in column B are becoming NaN. How would I fix this so that it does not override other values? import pandas as pd import numpy as np # %% # df=pd.read_csv(‘testing/example.csv’) data = { ‘Name’ : [‘Abby’, ‘Bob’, ‘Chris’], ‘Active’ …

Total answers: 1

Defining a new column based on non null values in other columns

Defining a new column based on non null values in other columns Question: I working with two tables that I performed an outer join on. Below is the table. I want to create a column called Job Number which looks at the Job Number Salesforce and Job Number Coins columns and returns which ever one …

Total answers: 1