Category : function

Hello guys I have a dataframe ready_df that looks like this: timestamp Latitude_1 Longtitude_1 Name Latitude_2 Longtitude_2 2021-03-03 08:00:00.100 NaN NaN NaN 12.3456 12.3456 2021-03-03 08:00:00.300 NaN NaN NaN 12.3456 12.3456 2021-03-03 08:00:00.500 12.3456 12.3456 Billy NaN NaN I have to fill column Name with values for which Latitude_2 Longtitude_2 == Latitude_1 Longtitude_1 I created ..

Read more

I’ve created a function which dynamically creates a Flask-WTF adding fields related to the SQLAlchemy database, like this: def buildForm(include_date_boolean): class InfoForm(FlaskForm): name = StringField("Name") details = StringField("Details") pass if include_date_boolean: setattr(InfoForm, ‘date’, StringField(label="Date")) return InfoForm() The problem is that when I’m calling the function in my code and I want to set some pre-values ..

Read more

I am trying to run the function Order which has 2 versions one function that is client.LinearOrder.LinearOrder_new(side="Buy",symbol=tradingpair,order_type="Market",qty=1).result() if the keyword "USDT" is present within Pair else it executes client.Order.Order_new(side="Buy",symbol=tradingpair,order_type="Market",qty=1).result(). When Order_Execution is split into two Order works as expected with the getattr function, I am trying to run it without splitting it, How would I ..

Read more

I make a function that takes values from another file and do some operations: ## send values to the other script. from Assignment_04 import * for value in Genes_Expression.values(): x = (value) ## make our function. import math def FC(num_1 , num_2): fold_change = math.log2(float(num_1) / float(num_2)) print(fold_change) FC(x[0] , x[1]) The output is like ..

Read more

I have created a function to create new column. While returning the value it is giving error ‘DataFrame’ object has no attribute ‘data not available’ sample df: col1 col2 abc 10 def 20 ghi 30 function: def fun1(): if (df[‘col1’].isin([‘xyz’])).any(): output=df.loc[df[‘col1′]==’xyz’,[‘col2’]] return output else: output = "data not available" return output Calling function like below: ..

Read more