[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

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

Introduction This article will discuss how to remove all occurrences of any characters in the word ‘dust’ from a given string. We will look at various methods of doing this, including using regular expressions, looping through the string, and using the replace() method. We will also discuss the advantages and disadvantages of each approach. Finally, … Read more

[Solved] How to setup CSS for multiple font choices? [closed]

Create a css selector for each theme: .theme-time { font-family: “Times New Roman”; } .theme-courier { font-family: “courier”; } .theme-verdana { font-family: Verdana, sans-serif; } Then, to give the ability to your user to change the theme and then the font-family, we will use Javascript. We will add one of this CSS class on the … Read more

[Solved] How can one prevent a program from being opened with Python? [closed]

Your solution will work, but it will spawn a lot of console windows one after another. To avoid it you can try this: >>> import subprocess >>> from time import sleep >>> si = subprocess.STARTUPINFO() >>> si.dwFlags |= subprocess.STARTF_USESHOWWINDOW >>> while True: subprocess.call(‘taskkill /F /IM notepad.exe’, startupinfo=si) sleep(1) # delay 1 seconds 2 solved How … Read more