I am trying to reference a variable from one python file to another. I have a base file that has a variable value, current_time and I want to call this variable in another python function that is in another python file. This is what I tried doing: From the file I am trying to call ..
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 ..
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 ..
I have a pandas dataframe with some columns, and the column ‘input_text’ has around 8K words for each row. My purpose is to split each row into more rows, each one having 500 words from the original row’s input_text. For example, if we used 2 words instead of 500, this row: a | b | ..
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 ..
I have these 2 python files: python_1.py: x = 3 import python_2 python_2.py: print(x) I want to import the function in python_2.py to python_1.py to print x. the results should be like that: 3 but I got this error: NameError: name ‘x’ is not defined how to solve this problem? Source: Python..
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 , x) The output is like ..
I’m writing a code for 7 segment display (not arduino code) If i enter number as 123 it will print 123 in patterns but the output printed one by one like for loop i want to print it on single line. please tell how to do it for this program # 7 Segment Display by ..
I searched the documentations of Numpy, Scipy, etc. but couldn’t find any function to compute the Marcum’s Q function: https://de.mathworks.com/help/comm/ref/marcumq.html Can anyone please point me in the right direction? Thanks! Source: Python..
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: ..