Categories
User Help

OneDrive Screw Up (How to Repair)

Long, weird, story. We ordered a laptop. It has a short: shocks us, completely crashes, and reboots. We’re sending it back. We ordered an AIO as a replacement. Works fine. Wife had stuff on the laptop. She hand moved most of it to the AIO. OneDrive synced everything it had from the problem laptop to […]

Categories
Mastering Development

Multiply two lists of different length in R

I have two lists with different structures. List A is a list of dataframes (containing 1 row and 10 columns) and List B is a list of matrix 10x 10, like this: List A [[1]] [1] dataframe (of 1 column) [[2]] [1] dataframe (of 1 column) List B [[1]] [1] num (1:10) [[2]] [2] num […]

Categories
Database Development

Passing column names into dynamic SQL in stored proc

I am trying to create a procedure which will dynamically create a unique table name, populate the table with a result set returned from another procedure, and return the table name to the caller. In outline, it looks something like this CREATE OR REPLACE FUNCTION return_result_table( _param1 integer[], _param2 text[]) RETURNS text LANGUAGE ‘plpgsql’ COST […]

Categories
Mastering Development

create 1D array from data frame column

I am looking for a way to get class label from my dataframe containing rows of features. For instance, in this example: df = pd.DataFrame([ [‘1’, ‘a’, ‘bb’, ‘0’], [‘1’, ‘a’, ‘cc’, ‘0’], [‘2’, ‘a’, ‘dd’, ‘1’], [‘2’, ‘a’, ‘ee’, ‘1’], [‘3’, ‘a’, ‘ff’, ‘2’], [‘3’, ‘a’, ‘gg’, ‘2’], [‘3’, ‘a’, ‘hh’, ‘2’]], columns = […]

Categories
Mastering Development

WOE in a magrittr Pipe

How can I get the weight of evidence code below into a magrittr pipeline (df %>%)? Nothing I’ve tried seems to work. df: library(Information) library(magrittr) #df a = c("aa", "bb", "cc", "aa", "aa", "aa", "bb", "cc", "bb", "bb") b = c("aa", "bb", "cc", "aa", "aa", "aa", "bb", "cc", "bb", "bb") c = c("aa", "bb", "cc", […]

Categories
Mastering Development

create nested JSON from Pandas DataFrame with grouped rows as attributes inside deepest nest

I’m looking for a solution to build a nested dict / JSON with the last three columns "name", "color", "amount" as attributes inside a "products" list. The values from the cat1-cat3 columns should be the keys. The provided DataFrame looks like this: import pandas as pd df = pd.DataFrame({ ‘cat1’: [‘A’, ‘A’, ‘A’, ‘B’, ‘B’, […]

Categories
Mastering Development

Find and group elements on tape of data?

I have got sequence of stings like: "aa", "lot", "bb", "obj", "obj", "obj", "cc", "lot", "obj", "gg", "lot", "obj", "obj" I need to calculate how much every lot have obj. Something like: [lot 3 obj] [lot 1 obj] [lot 2 obj] Or sometinkg like this. String have some crap – any other symbols except lot […]

Categories
Mastering Development

How to Match Strings from multiple data frame and return indexes with AND and OR options,& How to make the process fast; SQL, Tensor Array?

This is the data frame that I want to search on and get back the matching row number. ** Real data contains 2 million rows and 53 columns df2 = pd.DataFrame(np.array([‘A’,’B’,’AC’,’AD’,’NAN’,’BB’,’BC’,’C’,’AC’,’AD’,’NAN’,’BB’,’BC’,’D’,’AA’,’AC’,’AD’,’NAN’,’BB’,’BC’,’AB’,’AC’,’AD’,’NAN’,’BB’,’BC’,’AC’,’AC’,’AD’,’NAN’,’BB’,’BC’,’BB’,’BC’,’AD’]).reshape(5,7),columns=[‘a’,’b’,’c’,’d’,’e’,’f’,’g’]) The strings I will be searching is from this smaller data frame. Where each row has to be searched as, to get back matched […]

Categories
Linux Mastering Development

awk array explanation?

guys i’m new in awk programming and i’m about knowing how array work , really i didn’t know how this work and i found this code awk ‘BEGIN{OFS=FS=","}NR==FNR{a[$1]=$2;next}$3 in a && $3 = a[$3]’ filez filex so he put $1 as index in array and $2 as value then if $3 is equal to a […]

Categories
Linux Mastering Development

Split csv file on multiple csv files based on several columns headers

I have a large csv file that i tried to split into several csv files based on certain columns in the header. The objective is to generate each file in relation to the columns of the country. For example: –>input file: file.csv ,,fr,fr,fr,ca,ca,ca,be,be,be id,dateContact,name,date1,date2,name,date1,date2,name,date1,date2 100,2019-03-19,AA,2019-03-20,2019-03-22,AAA,2019-02-19,2019-02-22,AAAA,2019-02-19,2019-02-22 101,2019-08-15,BB,2019-08-16,2019-08-17,BBB,2019-07-16,2019-07-17,BBBB,2019-07-16,2019-07-17 102,2020-01-19,CC,2020-01-21,2020-01-21,CCC,2020-01-21,2020-01-21,CCCC,2020-01-21,2020-01-21 -Desired output files: –>output_fr.csv: id,dateContact,name,date1,date2 100,2019-03-19 ,AA ,2019-03-20,2019-03-22 […]