I’m trying to make a large DataFrame from a bunch of smaller DF. so I’ve look at multiple sites a nd they all mention to use the pd.concat() method and create an empty DataFrame. I did, however when I print inside my for loop I still get data as if it was still sectioned by individual DataFrame, a…
Accessing a specific instance of Enterprise Architect via COM from Python
A running instance of EA can be accessed from a Python script with something like: However, this seems to always returns the COM object of the instance first started. Let’s say we have a script that needs to starts a new instance of EA. It does so by calling os.startfile(eapxFile) with eapxFile being th…
How to check status of long lasting ibm_db connection in python
I’m developing and API that reads data from DB2 and returns corresponding result (using Flask on Python). Initially I had connection open on each API call but since number of connections per second is growing I thought it’s better to open DB connection once and re-open it only if it closed/failed …
Replace character in file name with regex python
My script should replace the “|” character of a file it finds via regex in a directory with an “l”. The code runs but filenames are not replaced. What is wrong? Answer Joshua’s answer and the many comments, especially the suggestions from ekhumoro, already pointed out issues and …
PyPy and Python version
I have installed latest version of PyPy using sudo apt install pypy pypy-dev on my Xubuntu. When I try python –version I see that I have Python 3.8.10 installed. When I try pypy –version I got Thats a problem because my script is written in Python 3 and I want to use pandas library in this script.…
How to look for specific values and return an index in a dataframe?
I have a DataFrame that looks like this: So I have a pair of u and v values (the last two columns). So what I want to ask is, if for example I have a value of u = 279 and a value of v = -108, my output would be Index = 2, is there a way to do
I want to return the last value of y , and the appended list. However, the list is not being returned. It states : name ‘y’ is not defined
I want to return the last value of y , and the appended list. However, the list is not being returned. It states : name ‘y’ is not defined. Answer Remove y list = []. it does not mean anything.
Problems regarding “key” in the min() function
scores = {1:20, 2:40, 3:0, 4:25} min_score = min(scores, key=scores.get) I don’t quite understand the parameters that can be passed into the key. Running the above code gives me 3 which is what I wanted. scores.get return me a dict object at certain memory address. Calling scores.get() raised me an Erro…
how to send string to python file and display it using terminal
I want to know how can I get the string from terminal or command prompt and make lower case that string and display it on terminal or command promptI used this code but it’s not working and in terminal when I used this in my terminal I got this error File “C:UsersmiladmAppDataLocalProgramsPythonPy…
How can I convert Json data that coming from Postman convert into Integers in python?
Here I’ve wrote a python script using MQL5 to get total history order from MetaTrader5. here’s the code, what my requirement is I need to get from_date and to_date parameter from user. so I passed these parameter from Postman Using POST request.here is the payload And it says, history_orders = mt.…