[Solved] Indentation on python [closed]

From what I can see, sales is a local variable in the main(), and you are trying to access it in DetermineCommRate, and you have syntax errors in the definition of that function def DetermineCommRate(sales): Currently, you are passing sales to it, but not accepting it. Also, your following line should be indented to run … Read more

[Solved] How can I create a vector in pandas dataframe from other attributes of the dataframe?

I think you need: df[‘features’] = df.values.tolist() print(df) Atr1 Atr2 features 0 1 A [1, A] 1 2 B [2, B] 2 4 C [4, C] If you have multiple columns and want to select particular columns then: df = pd.DataFrame({“Atr1″:[1,2,4],”Atr2″:[‘A’,’B’,’C’],”Atr3”:[‘x’,’y’,’z’]}) print(df) Atr1 Atr2 Atr3 0 1 A x 1 2 B y 2 4 … Read more

[Solved] Removing all occurrences of any characters in the word ‘dust’ in the string [closed]

Use a regular expression. import re result = re.sub(r'[dust]’, ”, string) The regexp [dust] matches any of those characters, and all the matches are replaced with an empty string. If you want to remove only the whole word dust, with possible repetitions of the letters, the regexp would be r’d+u+s+t+’. If only u can be … Read more