push object with add force in Unity3D

I made top down shooter game where enemies are following the player. If they touch you, they push you with AddForce. I’ve managed to do that but only on specific direction. Problem is that if enemy is coming from player’s right, they still gonna push you to the right and not to the opposite direction… Read More push object with add force in Unity3D

Make a parabola steeper at both sides while keeping both ends

I’m having a parabola with both axes being from 0 to 1 as follows: The parabola is created and normalized with the following code: import matplotlib.pyplot as plt import numpy as np # normalize array def min_max_scale_array(arr): arr = np.array(arr) return (arr – arr.min())/(arr.max()-arr.min()) x = np.linspace(-50,50,100) y = x**2 x = min_max_scale_array(x) y =… Read More Make a parabola steeper at both sides while keeping both ends

Convert "weird" strings to normal python strings

Context: I’m trying to convert characters like these: 𝐁𝐔𝐈𝐋𝐃𝐈𝐍𝐆 𝙎𝙥𝙚𝙚𝙙𝙮 𝕋𝕌𝔼𝕊𝔻𝔸𝕐 𝕤𝕡𝕒𝕘𝕙𝕖𝕥𝕥𝕚 To normal python strings (speedy, building, tuesday, etc) and save them into a new dataframe to be exported into a new excel file. For example, the charcter 𝕒 (U+1D552) should be converted to a (U+00AA). I’m reading each string from an excel file… Read More Convert "weird" strings to normal python strings

Pandas groupby and compute ratio of values with NA in multiple columns

I have a dataframe like as below id,status,amount,qty 1,pass,123,4500 1,pass,156,3210 1,fail,687,2137 1,fail,456,1236 2,pass,216,324 2,pass,678,241 2,nan,637,213 2,pass,213,543 df = pd.read_clipboard(sep=’,’) I would like to do the below a) Groupby id and compute the pass percentage for each id b) Groupby id and compute the average amount for each id So, I tried the below df[‘amt_avg’] =… Read More Pandas groupby and compute ratio of values with NA in multiple columns

Move the bottom of a curve without changing both ends

I’m having a curve as follows: The curve is generated with the following code: import matplotlib.pyplot as plt import numpy as np # normalize array def min_max_scale_array(arr): arr = np.array(arr) return (arr – arr.min())/(arr.max()-arr.min()) x = np.linspace(-50,48,100) y = x**2 + 2*x + 2 x = min_max_scale_array(x) y = min_max_scale_array(y) fig, ax = plt.subplots() ax.plot(x,… Read More Move the bottom of a curve without changing both ends

How do I json_normalize() a specific field within a df and keep the other columns?

So here’s my simple example (the json field in my actual dataset is very nested so I’m unpacking things one level at a time). I need to keep certain columns on the dataset post json_normalize(). https://pandas.pydata.org/docs/reference/api/pandas.json_normalize.html Start: Expected (Excel mockup): Actual: import json d = {‘report_id’: [100, 101, 102], ‘start_date’: ["2021-03-12", "2021-04-22", "2021-05-02"], ‘report_json’: [‘{"name":"John",… Read More How do I json_normalize() a specific field within a df and keep the other columns?

How to associate label with checkbox but not using "for=id"

i have this code: <li><input type="checkbox" id="checkboxThree" value="Alergia3" ><label for="checkboxThree">Alergia 1</label></li> <li><input type="checkbox" id="checkboxFour" value="Alergia4"><label for="checkboxFour">Alergia 1</label></li> <li><input type="checkbox" id="checkboxFive" value="Alergia5"><label for="checkboxFive">Alergia 1</label></li> <li><input type="checkbox" id="checkboxSix" value="Alergia6" ><label for="checkboxSix">Alergia 1</label></li> But I don’t want to use "id" and "for" because I have to do other thing later and I can’t use them. I have see… Read More How to associate label with checkbox but not using "for=id"