How to assign values to the classificationAttribute - sap-commerce-cloud

how to input values to the AttributeValueAssignment : insert_update AttributeValueAssignment;&Item;attribute(&Item);attributeAssignment(classificationAttribute(code,systemVersion(catalog(id),version)),systemVersion(catalog(id),version),classificationClass(catalogVersion(catalog(id),version),code))[forceWrite=true,unique=true];systemVersion(catalog(id),version);value(code,systemVersion(catalog(id),version))[forceWrite=true,allownull=true,unique=true];

Related

Why should I use sum() instead of count() to find the null values in a Dataset (Pandas)

df.isnull().count()
Output - 740 (Displaying the opposite)
df.isnull().sum()
Output - 8 (Displaying the null values)
PS : 'df' is the name of my dataset

Find a value in column of lists in pandas dataframe

I have a dataframe with two columns A & B, B is column of lists and A is a string, I want to search a value in the column B and get the corresponding value in column A. For ex :
category zones
0 category_1 [zn_1, zn_2]
1 category_2 [zn_3]
2 category_3 [zn_4]
3 category_4 [zn_5, zn_6]
If the input = 'zn_1', how can i get a response back as 'category_1'?
Use str.contains and filter category values
inputvalue='zn_1'
df[df.zones.str.contains(inputvalue)]['category']
#If didnt want an array
inputvalue='zn_1'
list(df[df.zones.str.contains(inputvalue)]['category'].values)[0]

convert nested dict values in pyspark/pandas dataframe to column and rows

I have a pyspark dataframe with only one record. it contains an id field and a "value" field. the value field contains nested dicts like the example record shown in the inputdf below. I would like to create a new dataframe like the outputdf below, where the type column is the keys from the nested dict in the value field in inputdf, and the value and active columns contain corresponding values from the nested dicts. if it's easier, the dataframe could be converted to a pandas dataframe using .toPandas(). does anyone have a slick way to do this?
inputdf:
id value
1 {"soda":{"value":2,"active":1},"jet":{"value":0,"active":1}}
outputdf:
type value active
soda 2 1
jet 0 1
Let us try , notice here I also include the id column
yourdf = pd.DataFrame(df.value.tolist(),index=df.id).stack().apply(pd.Series).reset_index()
Out[13]:
id level_1 value active
0 1 soda 2 1
1 1 jet 0 1

Powershell providing input from 1 column in Excel and getting output from another

I've got Excel file with 2 columns - Column A has list of number codes and Column B has matching letter codes. A1 matches letter code from B1 etc...
Number Code
11111 AB
12345 GE
How can I get the letter code in output providing the number in Powershell?
You can achieve this by creating a hash table. This allows you to specify a "key" and PowerShell will return the associated data. The key must be unique and not null (in your case the key would be the number.
Create a CSV with 2 columns, number and code.
# Import CSV into $csv variable
$csv = Import-CSV c:\csv.csv
# Create a new empty hash table
$csvHash = #{}
# Foreach row in the csv add the Number value as the key, and the code value as the associated data
$csv | % { $csvHash.Add($_.Number,$_.Code) }
You can then retrieve the associated letter code of a number like so:
$csvHash."11111"

After importing a csv into python as a list object, how do i refer to one of the columns?

I imported a csv into python3 as a List object. Assuming that the headers of the original csv were "FirstName", "LastName", "EmailAddress", "MailAddress", "PhoneNumber", how would I list only the rows that have no string in the "EmailAddress" column? Or how would I list only the rows that have no entry under the "PhoneNumber" column. Im not sure how to refer to specific rows in the List.
If the name of the List was called "ContactInfo", is there a way to specify just the PhoneNumber column? In powershell it would look like....
ContactInfo[1].PhoneNumber
A good way to figure this out would just be to print the list that you have.
Typically, csv to list returns a list of lists, where each inner element list is one row. You can refer individual elements of this inner list element (specific columns) using indices
So you can do :
For row in list_from_csv :
If row[2] = ...... (condition)
If row[4] = ...... (condition)
Here we are checking the 3rd and 5th column in each row.

Resources