Python – Pandas updating / adding columns to rows incrementally using dictionary key values

I wish to fill the columns of a data frame (df) by performing an iterative loop on a list (A_list) generating a dictionary in which the keys are the names of the desired columns of df (in this example below, the new columns are 'C', 'D' and 'E'

pandas of import
def gen_data (key):
data_dict = {C}: key + key, key, key: key + key + key
returns data_dict

A_list = ['a', 'b', 'c', 'd', 'f']
df = pandas.DataFrame ({& # 39; ['a', 'b', 'c', 'd', 'f']& # 39; & # 39 ;: B [1,2,3,3,2]})

for A_value in A_list:
data_dict = gen_data (A_value)
for data_key in data_dict:
df.loc[df.A == A_value, data_key] = data_dict[key]

So, the result should be:

df = pandas.DataFrame ({& # 39; ['a', 'b', 'c', 'd', 'e','f'],
& # 39; & # 39 ;: B [1,2,3,3,2,1],
& # 39; C & # 39 ;: ['aa','bb','cc','dd',nan,'ff'],
& # 39; & # 39 ;: RE ['a', 'b', 'c', 'd', nan,'f'],
& # 39; S & # 39 ;: ['aaa','bbb','ccc','ddd',nan,'fff']})

I feel that

for data_key in data_dict:
df.loc[df.A == A_value, data_key] = data_dict[key]

is really inefficient if there are a lot of lines in df and I think there should be a way to remove the for loop in this code.

for A_value in A_list:
data_dict = gen_data (A_value)
for data_key in data_dict:
df.loc[df.A == key, data_key] = data_dict[key]

workflow – Extract the document name and store it in separate columns in the document library.

I was instructed to extract the document name and store it in 4 separate columns in SharePoint. New documents in .PDF format are named as follows: Sam; Black-smith; 123456; Dental

And the column names on the list after removing the document name are as below.

* Name: Sam
* Name: Smith
* Employee number: 123456
* Type of registration: Dental
enter the description of the image here
I have therefore created the list of document library and added the 4 columns above to the document library. In link 2, I understand that a workflow using MS Flow is a possible solution, but the example they are dealing with has only one "-" and the documents I have in front have two; So, I really do not know how to find the substring expressions they're talking about.

Thank you for all your help and comments.
sat

Google Sheets, how to iterate between columns and rows

I'm running the following forumula:

= IF (INDEX (C $ 2: US $ 2, 1, ROW (1: 1))), CONCATENATE (C $ 2.00, "-", INDEX (C $ 1: 1, 1, ROW (1 : 1)))))

On the following table

Basically, if a value is present in column C2, I return the value + the value of B2. I'd like to do this for all columns up to O2, however, once I reach the O2 column, I'd like to go to the next line and have the process start with a new one. line. How would I do that?

sed – How to remove a row when all columns are less than one

I have a matrix file

0.34 3.03 1.92
b 1.35 1.34 0.63
c 0.66 2.32 1.01
0.23 2.07 0.22
e 0.34 0.47 0.55

I need to delete rows where all values ​​in its column are less than 1.

The expected output file is

0.34 3.03 1.92
b 1.35 1.34 0.63
c 0.66 2.32 1.01
0.23 2.07 0.22

Magento2: How to get the first column of the array from the result of the join query (from duplicate columns)

Table 1 – column_name city_col_tid

Table 2 – col_id col_city

In Magento2, I want col_name, col_city from Table1 and col_id from Table2. Using the join query
And col_city is in both tables, so I just want col_city from Table1.

I've already tried with the query below join

                $ this-> setMainTable (& # 39; Table1 & # 39;);

$ this-> getSelect ()
-> joinLeft (
array (& # 39; tbl2 => $ this-> getTable (& # 39; Table2 & # 39;)),
& # 39; main_table.col_tid = tbl2.col_id & # 39;
)

but it returns both col_city column tables, so i just want col_city only from Table1

so please tell me how I can do it in Magento2

Subtract two columns and add the results to another column

What would the syntax look like to subtract the Time_Exit – Time_Entry columns and add the results of each row in the column duration? I am using SQL Server 2012

enter the description of the image here

postgresql – A single non-nullable value on 3 columns

This is not what the indexes are for, you need a verification constraint for that,

For the "at most we can be non-zero" you can use a little trick: transform a Boolean expression into integer gives 0 or 1. If you add up the values ​​for one is non-zero condition, the rule "at most one can be non-zero" translates to "the sum of these must always be 1":

modify the contacts of the table add a constraint only_one_not_null
check ((is not zero) :: int
+ (b is not zero) :: int
+ (c is not zero) :: int = 1);

The above can be simplified by using the num_nonnulls () a function:

modify the contacts of the table add a constraint only_one_not_null
check (num_nonnulls (a, b, c) = 1);

This also covers the requirement "all three can not be zero".

mysql – Multi query with group by, join them in different columns

A table has different columns for each column, I want to make a group by function. I receive unique values ​​for each column of the table.

At the moment I am doing this:

SELECT custom user name FROM group of table group by user name;
SELECT amazonnumber FROM group of table groups by amazonnumber;

It's great to get for each column the unique value

I want to combine them to get all vertical data in columns.
I have tried this but, it does not give the good results:

SELECT * FROM
(SELECT custom group group name by custom name) b
CROSS JOIN
(SELECT amazonnumber FROM group of table groups by amazonnumber) c;

That's the bad result:

+ --------------- + -------------- +
| username | amazonnumber |
+ --------------- + -------------- +
| Mark | 11222 |
| Pieter | 11222 |
| Jean | 11222 |
| Janis | 11222 |
+ --------------- + -------------- +

Final result:

+ --------------- + -------------- +
| username | amazonnumber |
+ --------------- + -------------- +
| Mark | 11222 |
| Pieter | 11223 |
| Jean | |
| Janis | |
+ --------------- + -------------- +

SQL Server – splits a column into two columns based on its value using t / sql

I hope you are well.
I have a table as you can see below:

ACNTHEADER (DATE OF DATE, ACNTCODE INT, DIGITAL VALUE (17,2))

the data in the table:

DDATE ACNTCODE VALUE
01/06/2013 1174 10.00
01/06/2013 1174 20,00
01/06/2013 1174 -3.00
06/05/2013 1174 -5.00
6/7/2013 1174 -1.00
08/06/2013 1174 -1.00
08/06/2013 1174 -1.00
08/06/2013 1174 -5.00
10/06/2013 1174 3.00
10/06/2013 1174 -3.00

I need to have blocks of data for each & # 39; DATE & # 39; and the result should be like this:

DATE ACNTCODE SUMMARY SUMPOSITIVE
01/06/2013 1174 30,00 -3,00
6/2/2013 1174 0 0
03/06/2013 1174 0 0
04/06/2013 1174 0 0
06/06/2013 1174 0 -5.00
06/06/2013 1174 0 0
6/7/2013 1174 0 -1.00
08/06/2013 1174 0 -7.00
09/06/2013 1174 0 0
10/06/2013 1174 +3.00 -3.00

I do not know how to split a column value in two columns according to their value and another thing is that the way I build blocks of data is that I ', joining my tables with date table in our database which is the standard date table. I want to know if there are better ways to do it.
this my request up to now:

SELECT DISTINCT
D.MDATE,
A.ACNTCODE,
A VALUE
FROM ACNTHEADER TO INNER JOIN DIMDATE D
ON D.MDATE> = A.DDATE AND D.MDATE <= (SELECT MAX (B.DDATE)
SINCE THE ACNTHEADER B
WHERE B.ACNTCODE = A.ACNTCODE)
ORDER BY D.MDATE

python – Displays two lists as columns with tkinter in a frame

Just start with Python and tkinter would like to know if this can be done and if possible, tell me how or where to get an answer. I generate two lists and I want to print them vertically side by side and separated by a line in a frame or window. Thank you