CoolFace
Datasetpublic

RazinAleks/SO-Python_QA-API_USAGE_class

sourceHugging Faceupdated 3y agoView on Hugging Face
0likes18downloads
test.json1 linesDownload Raw Back to root
1[{"Question":"Is there a possibility to see all pip installed packages in Pycharm?\nBecause I have the Problem: I write in PyCharm and it works fine, but now I want to move the project to a server... And now I don't know how can I quickly export this","AnswerCount":3,"Available Count":1,"Score":0.0665680765,"is_accepted":false,"ViewCount":70,"Q_Id":65914621,"Users Score":1,"Answer":"Use the command pip freeze >requirements.txt locally to import the environment you need into the file,\nthen  use the command pip install -r requirements.txt  on the server to install the required environment","Q_Score":0,"Tags":"python,pycharm","A_Id":65914668,"CreationDate":"2021-01-27T07:28:00.000","Title":"See pip installations in a PyCharm Project?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I wrote a program that automatically navigates me threw a website, but how do I copy my current URL.\nContext: I am attempting to code a watch2gether bot that automatically creates a watch2gether room","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":30,"Q_Id":65926560,"Users Score":1,"Answer":"I don't know which programming language you use, but in Python3 its simply driver.current_url","Q_Score":0,"Tags":"python-3.x,selenium,discord","A_Id":65926716,"CreationDate":"2021-01-27T20:03:00.000","Title":"How do i copy a URL from searchbar?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm a newbie to the django framework and trying to make a watchlist for stocks. I've already made the crux of the webapp, where-in, a user can search for a quote and add it to their watchlist, along with relevant data about that quote.\nWhat I want to do now is, to save the separate watchlists that different users are creating (after creating an account on my site) and upon logging in to my site, they can view their personalized watchlist and edit it.\nI'm using a model for storing the data for the watchlist quotes and looking for a way to provide the different personalized watchlists depending upon the logged in user.\nCan anyone give me a lead on how to employ the logic for this? Do I need to use two data bases - one for the data of the users and the other one for storing the respective user watchlists? If yes, how do I connect everything?\nEDIT: Ever used a stock investment app? The way every user\/customer can log in to their account and make\/edit and save their watchlists in the app - that is the functionality I want to implement. How\/Where do I store so many watchlists?","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":44,"Q_Id":65927879,"Users Score":1,"Answer":"use 'request.user' from your view, to know the user who sent the request and return the corresponding watchlist","Q_Score":0,"Tags":"python,django,django-models","A_Id":65928436,"CreationDate":"2021-01-27T21:46:00.000","Title":"How to provide different sets of data to different users in django?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am doing binary classification for a time series with keras LSTM. How could I extract the final output from the model? By this I mean, how can I get a list containing zero and one values from the final model?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":242,"Q_Id":65939879,"Users Score":0,"Answer":"You should attach right after a LSTM layer a Dense layer with as much neurons as you consider (that depends upon the LSTM output itself), and on top of that one add a final Dense classification layer with a single neuron, that'd be the binary output.","Q_Score":0,"Tags":"python,tensorflow,keras,deep-learning,lstm","A_Id":65944376,"CreationDate":"2021-01-28T15:09:00.000","Title":"Keras LSTM Binary Classification Output","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am new on Medical Imaging. I am dealing with MRI images, namely T2 and DWI.\nI uploaded both images with nib.load, yet each sequence image has a different number of slices (volume, depth?). If I select one slice (z coordinate), how can get the corresponding slice on the other sequence image? ITK does it correctly, so maybe something in the NIFTI header could help?\nThank you so much for reading! I also tried interpolation, but it did not work.","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":76,"Q_Id":65946097,"Users Score":1,"Answer":"Reading the NIFTI, namely affine, and extracting the translation Transformation Matrix to create a mapping from the T2 to the DWI voxels.\nHint: nibabel.","Q_Score":1,"Tags":"python,registration,coordinate-systems,itk,medical-imaging","A_Id":65971759,"CreationDate":"2021-01-28T22:25:00.000","Title":"How to correlate different MRI sequences images in NIFTI format?","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm trying to reinstall Jupyter-Lab with conda completely. I mean, when I run uninstall jupyterlab and install it again, the system already comes with configuration I had previously, such as extensions installed. Therefore, there is something that is still present after the uninstall.\nHence, how do I completely remove jupyter-lab and install it again from scratch?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":2217,"Q_Id":65952807,"Users Score":1,"Answer":"When jupyterlab is installed use jupyter --paths to see where the configuration, data and runtime is stored. After removing the corresponding files and directories you will be able to perform a clean install without any traces of the old extensions.\nRemember to use it in the right environment.","Q_Score":0,"Tags":"python,installation,conda,jupyter-lab","A_Id":65961985,"CreationDate":"2021-01-29T10:32:00.000","Title":"Uninstall Jupyter-Lab with conda completely","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have built a Socket TCP \/ IP server that listens on a specific port and then, with that data, makes a rest query to another server, and that response is returned through the port where it received it.\nAll Socket server is made in Python 3.8 and works great.\nI need to know how to implement this code from my Socket server to an Azure Functions, so that it provides permanent service?\nI appreciate the goodwill of anyone who can offer an answer.\nThanks Total.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":68,"Q_Id":65954851,"Users Score":0,"Answer":"Simple answer: you cannot do that. Azure Functions are Event-based (such as an HTTP call). If you need to provide TCP socket, maybe hosting your python code in a container, e.g. Azure Container Instances, might be a good way to go.","Q_Score":0,"Tags":"python,sockets","A_Id":65956535,"CreationDate":"2021-01-29T12:52:00.000","Title":"How to implement a python code to work as Azure Function?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm hoping this is a fairly simple question with a simple answer.\nIn PostgreSQL I have a table with a Answer column that is a jsonb.\nAs of right now, the data that can be stored in the column can be empty or quite varied. Some examples include:\n\n{\"Answer\":\"My name is Fred\"}\n{\"Answer\":[{\"text\": \"choice 1\", \"isActive\": true}, {\"text\": \"choice 2\", \"isActive\": false}]}\n\nYes, we store a field called Answer in our column called Answer. Not sure why, but that is how it is.\nI want to be able to test if the JSON attribute Answer contains a string or an array. But I don't know how, and I must be wording my searches incorrectly. I'm not finding anything concrete. I already know how to check if Answer exists. Just can't tell what it contains.\nDoes anyone know how I would do this? Or if there isn't a way, what I need to do instead to query this data?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":66,"Q_Id":65956645,"Users Score":0,"Answer":"func.jsonb_typeof(<TableNameHere>.answer.op('->')('Answer')) == \"string\" seems to do the job.","Q_Score":0,"Tags":"python,postgresql,flask-sqlalchemy,jsonb","A_Id":65957361,"CreationDate":"2021-01-29T14:48:00.000","Title":"How do I check the type of a field contained in a JSONB?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I want to implement a simple source code that DROPs all RST packets that come into the computer using Python. What should I do?\nLinux servers can be easily set up using the iptables command, but I want to make it Python for use on Mac, Linux, and Windows systems.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":31,"Q_Id":65970822,"Users Score":0,"Answer":"Dropping RST packets is a function of the networking firewall built into your operating system.\nThere is only one way to do it on Linux: with iptables. You could use Python to instruct iptables.\nWindows has its own way to add firewall rules. MacOS also has its own way, and each of them is different from the other.\nThere is no single common way to do this. Therefore, there is no single common way to do this with Python.","Q_Score":0,"Tags":"python,packet","A_Id":65971659,"CreationDate":"2021-01-30T17:10:00.000","Title":"how to RST packet drop using python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am using bulk_create to upload some data from excel to django db. Since the data is huge I had to use bulk_create instead of .create and .save. But the problem is that I need to show the user how many duplicate data has been found and has not been uploaded due to integrity error. Is there a way to get the number of errors or duplicate data while using bulk upload?","AnswerCount":1,"Available Count":1,"Score":-0.537049567,"is_accepted":false,"ViewCount":117,"Q_Id":65989590,"Users Score":-3,"Answer":"After, Reading data from csv file.\nFirst create a list before inserting data to system.\nThen convert that list to set after then again sort the data which is in set.\nHere , you gets every data exactly one time in sorted manner.","Q_Score":0,"Tags":"python,django,postgresql","A_Id":65990514,"CreationDate":"2021-02-01T08:48:00.000","Title":"is there a way to get the count of conflicts while using Django ...bulk_create(.., ignore_conflicts=True)?","Data Science and Machine Learning":0,"Database and SQL":1,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"I have Django model with Image field, but sometimes I don't need to actually upload file and store path to it, but I need to store only path. Especially url. I mean, I have web client, that receives both foreign urls like sun1-17.userapi.com and url of my own server, so sometimes I don't need to download but need to store url. Is it possible, to store url in ImageField, or I need to make CharField and save files via python? If its impossible, how do I save file in python3, having one, sent me via multipart?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":254,"Q_Id":65994385,"Users Score":0,"Answer":"The URL field in the ImageField is ReadOnly, so you cannot write it. You should probably use in addition a URLField (better than a CharField) to save the URLs.\nYou can allow null values on both and use only the appropriate one according to your scenario.","Q_Score":0,"Tags":"python-3.x,django,imagefield","A_Id":65994666,"CreationDate":"2021-02-01T14:22:00.000","Title":"How to save URL to a Django ImageField","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"How can I an image as the background in my ursina project. I know I can change the color of the background by using window.color = color.light_gray for example. But how do I use an image?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":704,"Q_Id":66001243,"Users Score":0,"Answer":"Try\nSky(texture=\"texture_name\")","Q_Score":0,"Tags":"python,background","A_Id":66217213,"CreationDate":"2021-02-01T22:49:00.000","Title":"How can I set a .jpg as window background in python ursina?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am trying to make an app with kivy and kivymd but I can't figure out how I can make the setup screen show up only the first time. This is how the application is going to work: User launches the application after installation and is being shown the sign up\/log in screen, And once the user is done with the setup, the setup screens will never appear again unless the user reinstalls the application.\nHow can I make this happen?\nPlease help and thanks SO much in advance!","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":63,"Q_Id":66005886,"Users Score":1,"Answer":"I fixed this problem by creating and reading a \"text\" file.My \"text\" file has '0' as a boolean variable .Once the user is done with signing up \/ logging in , I change that \"text\" file to '1' ,and in the __init__ func, I check if that file equals to '0' or '1'.\nI'm not sure if this is the correct way or not,but this worked for me.","Q_Score":0,"Tags":"python,kivy,kivy-language,python-3.8,kivymd","A_Id":66173541,"CreationDate":"2021-02-02T08:16:00.000","Title":"Showing the setup screen only on first launch in kivy","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am wondering how best to feed back the changes my DQN agent makes on its environment, back to itself.\nI have a battery model whereby an agent can observe a time-series forecast of 17 steps, and 5 features. It then makes a decision on whether to charge or discharge.\nI want to includes its current state of charge (empty, half full, full etc) in its observation space (i.e. somewhere within the (17,5) dataframes I am feeding it).\nI have several options, I can either set a whole column to the state of charge value, a whole row, or I can flatten the whole dataframe and set one value to the state of charge value.\nIs any of these unwise? It seem a little rudimentary to me to set a whole columns to a single value, but should it actually impact performance? I am wary of flattening the whole thing as I plan to use either conv or lstm layers (although the current model is just dense layers).","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":40,"Q_Id":66008062,"Users Score":1,"Answer":"You would not want to add in unnecessary features which are repetitive in the state representation as it might hamper your RL agent convergence later when you would want to scale your model to larger input sizes(if that is in your plan).\nAlso, the decision of how much of information you would want to give in the state representation is mostly experimental. The best way to start would be to just give in a single value as the battery state. But if the model does not converge, then maybe you could try out the other options you have mentioned in your question.","Q_Score":0,"Tags":"python,deep-learning,reinforcement-learning,dqn","A_Id":66030093,"CreationDate":"2021-02-02T10:41:00.000","Title":"Reinforcement learning DQN environment structure","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Sorry to my bad english.\nSo i use a automate with MERVIS software and i use a Bacnet server to have my variable in my IHM (weintek panel pc with Easybuilder Pro).\nSo all i make is good and work but i'm not happy to EasyBuilder pro and i want make my own HMI. I decide to make my application with QT in C++.\nBut i'm physicien at the begining so learn little bit by little bit( i have base of python,c++, structur text). I know nothing about how build a bacnet client and do you have idea where can i find some simple exemple to communicate with my PLC because i find nothing and i need to learn and make this to my project.\nSo i have my PLC, link in ethernet to my PC where i make my hmi. In the future i want put this application in PANEL PC tactil work in window and link to my PLC with MERVIS software.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":55,"Q_Id":66029193,"Users Score":0,"Answer":"If I'm clear on the question, you could checkout the 'BACnet Stack' project source code or even the 'VTS' source code too - for a C\/C++ (language) reference.\nOtherwise YABE is a good project in C# (language), but there's also a BACnet NuGet package available for C# too - along with the mechanics that underpin the YABE tool.","Q_Score":0,"Tags":"python,c++,client,bacnet,human-interface","A_Id":67459182,"CreationDate":"2021-02-03T14:09:00.000","Title":"Create Bacnet client variable automate","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"hello guys I'm trying to make another one to access my Django website I host it on my localhost by type\npython manage.py runserver 0.0.0.0:8000\nand i set the ALLOWED_HOSTS = ['*']\nwhen I trying to connect with my IP it's says refused to connect.\ncan someone help me","AnswerCount":1,"Available Count":1,"Score":-0.1973753202,"is_accepted":false,"ViewCount":78,"Q_Id":66032193,"Users Score":-1,"Answer":"you are only hosting your server in your local network therefore no-one outside of this network can access your server. To make them access it you would have to make it accessible over the internet for example via hosting it on aws or another cloud hoster.","Q_Score":0,"Tags":"python,django","A_Id":66032246,"CreationDate":"2021-02-03T17:00:00.000","Title":"how can i make someone on another network access my website with django","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Let's imagine, I have a simple tkinter program: only tkinter.Entry(), where I can write down some text. The main goal I have set to this tkinter.Entry() is to make next: when I try to input there some symbol, it is immediately deleted from tkinter.Entry(). So the question is how to make tkinter.Entry() delete every symbol, when it have been just input there?\nI hope the problem is fully described. Thanks in advance for your help.\n\nI apologize, but it seems to me that this question has lost its former relevance for me. Sorry for letting you take all of your precious time. I took all the answers and tips into account. I will delete the question soon. Thank you for your attention to me","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":45,"Q_Id":66033049,"Users Score":1,"Answer":"From what I deduced, you're trying to delete the content from the entry widget.\ntkinter.Entry.delete('0',END)\nThis should do it.","Q_Score":0,"Tags":"python-3.x,tkinter,tkinter-entry","A_Id":66033184,"CreationDate":"2021-02-03T17:56:00.000","Title":"How to immediately delete just input symbol in tkinter.Entry()","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have a Tkinter app which I have converted to .app and .exe, but after giving this app to others if I have to update the app how should I do it(like in play store update)? And also if I package this app and distribute with an installer then how to send update to the app?","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":44,"Q_Id":66033193,"Users Score":2,"Answer":"I don't think that it's possible to update the app like that. Android apps usually are made with Java, and iOS apps are made with Xcode, Swift, and Objective-C. I don't usually make apps with Python, unless they are for myself, because once they are made into apps, they cannot be updated (as far as I know). If I wanted to update my Python app, I would remove the first app, then use Pyinstaller to make the updated app.\nHope this helps, and have a good day. :)","Q_Score":1,"Tags":"python,python-3.x,windows,macos,tkinter","A_Id":66034171,"CreationDate":"2021-02-03T18:05:00.000","Title":"how can i create a tkinter app updater which is included with the app","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm using Task Scheduler to execute python run.py. It works, but the Python interpreter pops up. I want to run run.py in the background without any interpreter popping up.\nHow can I do this? In Linux I'd just do python run.py & to get it to run in the background silently, but I'm not sure how to achieve the same in Windows with Task Scheduler.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":655,"Q_Id":66055158,"Users Score":0,"Answer":"You can just change .py extension to .pyw\nand the python file will run in background.\nAnd if you want to terminate or check if it actually running in background,\nsimply open Task manager and go to Processes you will see python32 running\nthere.\nEDIT\nAs you mentioned, this doesn't seem like working from command line because changing the file's .extension simply tells your system to open the file with pythonw application instead of python.\nSo when you are running this via command line as python .\\run.pyw even with the .pyw this will run with python.exe instead of pythonw.exe.\nSolution:\nAs you mentioned in the comments, run the file as pythonw .\\run.pyw or .\\run.py\nor just double click the run.pyw file.","Q_Score":0,"Tags":"python,windows,scheduled-tasks","A_Id":66055185,"CreationDate":"2021-02-04T23:02:00.000","Title":"How to hide window when running a Task Scheduler task","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I had developed a standalone application on Windows for Deep Learning \/ Computer vision in Python 3.X using various standard python libraries such as pandas, numpy, TensorFlow, Keras, Yolo, PyQt ...etc. I want to deliver this application to my client but without source code.\nCan you please help me how to do this?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":102,"Q_Id":66056606,"Users Score":0,"Answer":"\"I want to deliver this application to my client but without source code.\"\nCan you clarify this process?\nIf you just want to deliver this service to your client you can just use HTTP\/POST to let users upload their data to you, then you run these data on your network on the server, and finally, just return the prediction result to them.","Q_Score":0,"Tags":"python,python-3.x,windows,deep-learning","A_Id":66056643,"CreationDate":"2021-02-05T02:07:00.000","Title":"How to hide \/ encrypt source code written in Python?","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I just uninstalled and reinstalled python on my Windows machine. Before I uninstalled my previous version I was able to just double-click on a python script and it would open the command prompt, run the script, and close automatically. After re-installing with the newest version (3.9), I am no longer able to execute the script like that with a double-click.\nClearly I had done something special last time to set that up for myself, but I don't remember what it was. Any idea how I can get that double-click deal going again?","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1269,"Q_Id":66073004,"Users Score":0,"Answer":"There will be an option of \"Open With\" after right-click on the file go and choose CMD. I hope it helps if not then sorry. Because I use Parrot OS","Q_Score":2,"Tags":"python,python-3.x,windows","A_Id":66073027,"CreationDate":"2021-02-06T02:26:00.000","Title":"How to execute .py file with double-click","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have built a snake game using Turtle graphics module of Python, and now I wish to convert it into an apk.\nI have tried kivy. It builds the apk, but the app crashes as soon as I open it in android. When using adb logact -s python, it says that the tkinter module is not available.\nOn further researching, I got to know that turtle graphics is based upon tkinter module and tkinter is not supported by python-for-android. The solutions suggest to rewrite my code in Kivy, but I don't know how to do so.\nAny suggestions on how can I run my turtle graphics game on android?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":277,"Q_Id":66080212,"Users Score":0,"Answer":"The solutions suggest to rewrite my code in Kivy, but I don't know how to do so.\n\n\nAny suggestions on how can I run my turtle graphics game on android?\n\nIt looks like you've already found the solution: rewrite your graphics in Kivy, or another python module that works on android. Recent pygame releases might.\nIf you don't know how to do so, you need to learn. If you try to do so but have problems with any specific question, that would be a better target for a stackoverflow question.","Q_Score":0,"Tags":"android,python-3.x,kivy,python-turtle,python-for-android","A_Id":66081362,"CreationDate":"2021-02-06T18:05:00.000","Title":"Turtle Graphics APK","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have VRP problem. I have vehicles starting positions and I have distance matrix. I want solution to be terminated\/finished when certain locations are visited.\nSo I don't want it to actually visit each index of location_matrix but if visiting different index beside \"MUST VISITS\" make for better solution then I have no problem. Because you know sometimes going from directly 1 to 3 is slower than 1-2-3. (visiting 2 which is not necessary but make it for shortcut)\nI defined a dummy depot which cost 0 , I used this for end because if you use starts you have to define ends. And I put ends 000 which are basically ending position. You might ask why you didnt put your \"JOB\" locations. But this means they have to end there. So it doesn't seem optimal because  example one vehicle could be really near to both of \"JOB\" locations but if it terminates \/ ends because it has END defined vehicle would stop.\nI have no idea how to make this work. Basically what I want that if certain locations are visited once just terminate - that's the solution. So if jobs are (1,3,5) and  Vehicle 1  visited 1,3 and Vehicle 2 just visited 2 it should be finished.\nIf I use solver in ortools It will be like TSP problem which will try to visit each location in distance_matrix. I don't exactly want this. It could visit if results better solution(does it make sense?) but it should be focusing on \"JOB\" locations and how to go them faster","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":112,"Q_Id":66087248,"Users Score":1,"Answer":"Potential approach: Compute a new distance matrix with only the \"MUST VISIT\" locations, and run a VRP with this matrix.\n\nCompute a distance matrix with only the \"MUST VISIT\" locations.\nEach cell contains the shortest path between two \"MUST VISIT\" locations.\nStore all the pairwise shortest paths found.\nRun a regular VRP on this distance matrix.\nReconstruct the full path using the shortest paths found earlier.","Q_Score":2,"Tags":"python,python-3.x,algorithm,or-tools,vehicle-routing","A_Id":66105127,"CreationDate":"2021-02-07T11:16:00.000","Title":"Vehicle Routing Problem - How to finish\/determine when certain locations are visited?","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm dealing with a highly imbalanced dataset for my project rn, for the simplicity, I will give a simple example here: a dataset has a number of 20 '0's and 80 '1's so the total is 100.\nSuppose I have already used X_train, X_test,y_train,y_test = train_test_split(X, y,stratify=y,random_state=42) to make a stratified split (X_train.shape is 80 and X_test.shape is 20), so my question is how to achieve under-sampling with K-fold validation in the train dataset at the same time.\nMy initial thought is use from imblearn.under_sampling import RandomUnderSampler to get 16 '0's and 16 '1's (total is 32) to make equal distributed dataset, and do the K-fold cross-validation on that 32 dataset and discard the rest of 48 in the X_train. Use the model to predict the X_test. So I was wondering if this is correct procedure to deal with.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":99,"Q_Id":66093809,"Users Score":0,"Answer":"You can use RandomUnderSampler method to achieve it. Put random states and ratio value in the arguments and try to see if this works.","Q_Score":0,"Tags":"python,machine-learning","A_Id":66102683,"CreationDate":"2021-02-07T22:32:00.000","Title":"How to do under-sampling with K-fold validation in machine learning","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I've built an IB TWS application in python. All seems to work fine, but I'm struggling with one last element.\nTWS requires a daily logout or restart. I've opted for the daily restart at a set time so I could easily anticipate a restart of my application at certain times (at least, so I thought.)\nMy program has one class, called InteractiveBrokersAPI which subclasses the ECClient and EWrapper. Upon the start of my program, I create this instance and it successfully connects to and works with TWS. Now, say that TWS restarts daily at 23:00. I have implemented logic in my program that creates a new instance of my InteractiveBrokersAPI, and calls run() on it af 23:15. This too seems to work. I know this because upon creation, InteractiveBrokersAPI calls reqAccountUpdates() and I can see these updates coming in after my restart. When I try to actually commit a trade the next day, I get an error that it's not connected.\nDoes anyone else have experience in how to handle this? I am wondering how others have fixed this issue. Any guidance would be highly appreciated.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":198,"Q_Id":66117983,"Users Score":0,"Answer":"Well, this doesnt exactly answer your question, but have you looked at ib_insync","Q_Score":0,"Tags":"python,interactive-brokers,tws","A_Id":66525038,"CreationDate":"2021-02-09T11:19:00.000","Title":"Interactive Brokers TWS: How to handle daily restart in python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"My code (test.py) looks like this (simplified):\nfrom app.utils import conversion \n(code) \nWhen I try to make an executable using PyInstaller, the .exe works when I import generic modules. However, I get the following error message when I use ''from app.utils import conversion'' at the beginning of my code:\nModuleNotFoundError: No module named 'app' \nand the .exe won't run.\nMy project is structured this way (simplified):\nproject\/app\/test.py \nproject\/app\/utils\/conversion.py \nThe instruction I put in the console is:\npyinstaller --onefile test.py \nAny idea why and how to overcome this? Thanks!","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":39,"Q_Id":66144821,"Users Score":0,"Answer":"Here is how I fixed my problem:\nin the .spec file, added the missing app module in hiddenimports:\nhiddenimports=[\"app\"]\nThen to compile the executable, I run the .spec file instead or the .py file.\npyinstaller --onefile test.spec","Q_Score":0,"Tags":"python,module,compiler-errors,pyinstaller,exe","A_Id":67639113,"CreationDate":"2021-02-10T20:52:00.000","Title":"ModuleNotFoundError: No module named 'x' because can't find the module folder, PyInstaller","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"Let me describe it as briefly and clearly as possible:\nI have 10 different copies of a node JS based program running on 10 different desktops. I want to create a Node JS based (or any other technology) web app deployed on a server which will check if these 10 programs are online or not.\nAny suggestions as to how I can implement this?\nNote: The node JS based desktop apps are running on electron.","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":38,"Q_Id":66156309,"Users Score":0,"Answer":"You can use 2 most probable ways.\n\nif you want to know immediately whether out of 10 programs, if any of them goes offline then you should use Socket.io\n\n\nYour server nodejs program will act as server and your 10 desktop program will work as client. Your 10 client socket connection will connect with server socket connection and server socket can check whether socket client is still connected or not based on Ping\/Pong concept of socket.\n\nin brief, Ping\/pong technique in which server sends Ping event on socket connection and client will receive server's ping event and send Pong event back to server.\nif client is not sending Pong event back in predefined time interval on getting Ping event then that client is offline or disconnected.\n\nYou can periodically (say every 1\/5\/10 minutes etc ) call simple HTTP request and check if response status is 200 or not. If any of the 10 desktop program is offline then you will know it by response status whether it is 200 or not.","Q_Score":0,"Tags":"javascript,python,node.js,electron,backend","A_Id":68328337,"CreationDate":"2021-02-11T14:08:00.000","Title":"Node JS detect connectivity to all Node JS programs","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Let me describe it as briefly and clearly as possible:\nI have 10 different copies of a node JS based program running on 10 different desktops. I want to create a Node JS based (or any other technology) web app deployed on a server which will check if these 10 programs are online or not.\nAny suggestions as to how I can implement this?\nNote: The node JS based desktop apps are running on electron.","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":38,"Q_Id":66156309,"Users Score":0,"Answer":"While you can use socket.io for this there may also be a simpler way and that is to just use a post request \/ cron to check every X minutes if the server is reachable from 'Checking' server (that would just be the server that is doing the check)\nSo why not use socket.io? Well, without knowing how you node servers are setup, its hard to say if socket.io would be a good fit, this is simply because socket.io uses WSS to connect, so unless you are running it from the browser it will need additional configurations \/ modules setup on the server to actually use WSS (if you do go this route, you will need socket.io-client module on each system, this is important because this will allow you to connect to the socket.io server, also make sure the version of socket.io matches the socket.io-client build)\nAll in all, if I was building this out, I would probably just do a simple ping of each server and log it to a DB or what not but your requirements will really dictate the direction you go","Q_Score":0,"Tags":"javascript,python,node.js,electron,backend","A_Id":68328746,"CreationDate":"2021-02-11T14:08:00.000","Title":"Node JS detect connectivity to all Node JS programs","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I do not have administrative privileges' on my Windows 10 workstation. The IT department installed Python 2.7 as my request but I proceed a PIP upgrade without the \"--user\" setting, and now the already installed PIP got corrupted and I do not know how to recover it.\nThe corrupted PIP always return syntax error on lib\\site-packages\\pip_internal\\cli\\main.py\", line 60\nsys.stderr.write(f\"ERROR: {exc}\")\nI can not run again the --upgrade or get-pip\nI can write in the Python folder so I can change the main.py file.\nIs there a way to manually recover the installation (without sudo)? I need to reinstall the Python?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":226,"Q_Id":66180184,"Users Score":0,"Answer":"It would be better to reinstall Python, yes.\nIt would be better to install a version of Python that was actually still supported, such as 3.6 or newer.","Q_Score":0,"Tags":"python,installation,pip,failed-installation","A_Id":66180204,"CreationDate":"2021-02-12T23:08:00.000","Title":"How to to manually recover the a PIP corrupted installation?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"I have been working on a project which involves me to get the icon from the icon theme used on Linux so that I can use it with the Gtk Pixbuf like how Gnome-system-monitor displays the icon for all the process, the same thing I want to achieve. Any ideas about how to do this?\nI am using python with Gtk on PopOS 20.10.","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":200,"Q_Id":66184610,"Users Score":1,"Answer":"Gio.AppInfo in the Gtk library stack is a good point to start.\nIf you are looking for the approach that is used by the gnome-system-monitor then the prettytable.c file will the one you need to check.\nThere is one more approach, scanning the \/usr\/share\/application\/ directory and creating a file monitor for this directory. All icons of the application are that are in the menu can be found here.","Q_Score":0,"Tags":"python,linux,user-interface,process,gtk","A_Id":69208718,"CreationDate":"2021-02-13T11:32:00.000","Title":"Get icon of a process (like in gnome-system-monitor) to be used with Gtk and python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Thanks for your time.\nBasically, what I'm trying to do is to set a object from a database list (.csv) and if i get an ValueError I would like to set that field value and keep adding data\n\nValueError: Field 'age' expected a number but got 'M'\n\nI'm quite sure that's a doc for this, but I've been reading for some time and hasn't found.","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":45,"Q_Id":66191418,"Users Score":1,"Answer":"How about filtering the data once you receive it? For example lets say age field expects an Integer, and before you save it you could check if the data is an Integer. But I also think the most efficient way is using try except.","Q_Score":0,"Tags":"python,python-3.x,django,django-models,django-rest-framework","A_Id":66193705,"CreationDate":"2021-02-14T00:46:00.000","Title":"Django how to change a vallue of a field that received error","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"Thanks for your time.\nBasically, what I'm trying to do is to set a object from a database list (.csv) and if i get an ValueError I would like to set that field value and keep adding data\n\nValueError: Field 'age' expected a number but got 'M'\n\nI'm quite sure that's a doc for this, but I've been reading for some time and hasn't found.","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":45,"Q_Id":66191418,"Users Score":0,"Answer":"Using a simple 'try', 'except' block should work where you have a default value to use in 'except' before saving.","Q_Score":0,"Tags":"python,python-3.x,django,django-models,django-rest-framework","A_Id":66191475,"CreationDate":"2021-02-14T00:46:00.000","Title":"Django how to change a vallue of a field that received error","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"How to import postgresql database (.sql) file from AmazonS3 to AWS RDS?\nI am very new to AWS, and Postgresql.\nI have created a database using PgAdmin4 and added my data to the database.\nI have created a backup file of my database i.e. .SQL file.\nI have created a database instance on AWS RDS.\nI have uploaded my database file and several documents s3 bucket.\nI tried to integrate AWS S3 and RDS database using AWS Glue, but nothing is working for me. I am not able to figure out how to integrate S3 and RDS for importing and exporting datafrom S3 to RDS and vice versa.\nCan you please tell me how can I set up RDS and S3?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":510,"Q_Id":66192696,"Users Score":0,"Answer":"What you can do is install a pure python library to interact with rds and run the commands via that library just like you would do with any normal python program. It is possible for you to add libraries like this to run in your glue job. In your case pg8000 would work like a charm","Q_Score":0,"Tags":"python-3.x,postgresql,amazon-s3,amazon-rds,aws-glue","A_Id":66200464,"CreationDate":"2021-02-14T05:24:00.000","Title":"How to import postgresql database (.sql) file from AmazonS3 to AWS RDS?","Data Science and Machine Learning":0,"Database and SQL":1,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am solving a stochastic differential equation and I have a function that contains an algorithm to solve it. So I have to call that function at each time step (it is similar to Runge Kutta's method but with a random variable), then I have to solve the equation many times (since the solution is random) to be able to make averages with all the solutions . That is why I want to know how to call this function in each iteration in the most efficient way possible.","AnswerCount":4,"Available Count":2,"Score":0.049958375,"is_accepted":false,"ViewCount":647,"Q_Id":66196167,"Users Score":1,"Answer":"The best way to implement a function on an iterable is to use the map function.\nSince map is written in C and is highly optimized, its internal implied loop can be more efficient than a regular Python for loop.","Q_Score":2,"Tags":"python,performance,function,loops,call","A_Id":66196437,"CreationDate":"2021-02-14T14:03:00.000","Title":"How can I efficiently call a function in a loop with python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am solving a stochastic differential equation and I have a function that contains an algorithm to solve it. So I have to call that function at each time step (it is similar to Runge Kutta's method but with a random variable), then I have to solve the equation many times (since the solution is random) to be able to make averages with all the solutions . That is why I want to know how to call this function in each iteration in the most efficient way possible.","AnswerCount":4,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":647,"Q_Id":66196167,"Users Score":3,"Answer":"Some ways to optimize function calls:\n\nif the function arguments and results are always the same, move the function call out of the loop\nif some function arguments are repeated and the results for a given set of arguments are the same, use memoize or lru_cache\n\nHowever, since you say that your application is a variation on Runge-Kutta, then neither of these is likely to work; you are going to have varying values of t and the modeled state vector, so you must call the function within the loop, and the values are constantly changing.\nIf your algorithm is slow, then it won't matter how efficient you make the function calls. Look at optimizing the function to make it run faster (or convert to Cython) - the actual call itself is not the bottleneck.\nEDIT: I see that you are running this multiple times, to determine a range of values given the stochastic nature of this simulation. In that case, you should use multiprocessing to run multiple simulations on separate CPU cores - this will speed things up some.","Q_Score":2,"Tags":"python,performance,function,loops,call","A_Id":66198269,"CreationDate":"2021-02-14T14:03:00.000","Title":"How can I efficiently call a function in a loop with python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I would like to send DirectInput keys to an inactive window without interfering with my actual mouse. I tried using PostMessage, SendInput and SendMessage but pywin32 uses virtual keycodes while ctypes does work with DirectInput. I have no idea how I can make it send in an inactive window.","AnswerCount":1,"Available Count":1,"Score":-0.1973753202,"is_accepted":false,"ViewCount":552,"Q_Id":66222584,"Users Score":-1,"Answer":"Try using this, it manages to work for me send the keystrokes to the inactive window,\nUse (but add error checking) hwndMain = win32gui.FindWindow(\"notepad\", \"\u200bprueba.txt: log keys\") hwndEdit = win32gui.FindWindowEx","Q_Score":3,"Tags":"python,ctypes,pywin32","A_Id":66222675,"CreationDate":"2021-02-16T10:24:00.000","Title":"How to send DirectInput keys to an inactive window in Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am using the ResNet18 pre-trained model which will be used for a simple binary image classification task. However, all the tutorials including PyTorch itself use nn.Linear(num_of_features, classes) for the final fully connected layer. What I fail to understand is where is the activation function for that module? Also what if I want to use sigmoid\/softmax how do I go about that?\nThanks for your help in advance, I am kinda new to Pytorch","AnswerCount":3,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":854,"Q_Id":66222699,"Users Score":3,"Answer":"No you do not use activation in the last layer if your loss function is CrossEntropyLoss because pytorch CrossEntropyLoss loss combines nn.LogSoftmax() and nn.NLLLoss() in one single class.\nThey do they do that ?\nYou actually need logits (output of sigmoid) for loss calculation so it is a correct design to not have it as part of forward pass. More over for predictions you don't need logits because argmax(linear(x)) == argmax(softmax(linear(x)) i.e softmax does not change the ordering but only change the magnitudes (squashing function which converts arbitrary value into [0,1] range, but preserves the partial ordering]\nIf you want to use activation functions to add some sort of non-linearity you normally do that by using a multi-layer NN and having the activation functions in the last but other layers.\nFinally, if you are using other loss function like NLLLoss, PoissonNLLLoss, BCELoss then you have to calculates sigmoid yourself. Again on the same note if you are using BCEWithLogitsLoss you don't need to calculate sigmoid again because this loss combines a Sigmoid layer and the BCELoss in one single class.\ncheck the pytorch docs to see how to use the loss.","Q_Score":1,"Tags":"python,pytorch,resnet","A_Id":66222964,"CreationDate":"2021-02-16T10:32:00.000","Title":"ResNet family classification layer activation function","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Newbie here... 2 days into learning this.\nIn a learning management system, there is an element (a plus mark icon) to click which adds a form field upon each click.\u00a0 The goal is to click the icon, which generates a new field, and then put text into the new field.\u00a0 This field does NOT exist when the page loads... it's added dynamically based on the clicking of the icon.\nWhen I try to use \"driver.find_element_by_*\" (have tried ID, Name and xpath), I get an error that it can't be found.  I'm assuming it's because it wasn't there when the page loaded.  Any way to resolve this?\nBy the way, I've been successful in scripting the login process and navigating through the site to get to this point. So, I have actually learned how to find other elements that are static.\nLet me know if I need to provide more info or a better description.\nThanks,\nBill","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":45,"Q_Id":66250310,"Users Score":0,"Answer":"Apparently I needed to have patience and let something catch up...\nI added:\nimport time\nand then:\ntime.sleep(3)\nafter the click on the icon to add the field.  It's working!","Q_Score":0,"Tags":"python,selenium,selenium-chromedriver","A_Id":66250513,"CreationDate":"2021-02-17T21:38:00.000","Title":"Selenium\/Python - Finding Dynamically Created Fields","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"I create a Todo web application in Django and i deploy it on Heroku. I want to know how can i push the notification in my browser for upcoming task.Thanks in advance.","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":823,"Q_Id":66259563,"Users Score":2,"Answer":"You should use websockets and async functionality of Django to be able to push realtime notifications as they occur.\nBasic http protocol does not give you such functionality.","Q_Score":1,"Tags":"python,django,heroku","A_Id":66259742,"CreationDate":"2021-02-18T12:02:00.000","Title":"How to push the notification on web browser using django","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"In my template, I want to show the join date of a user, so I am using {{ user.date_joined }} which shows the date and time (in local time zone - same as what is shown in the admin panel). To just show the date, I use {{ user.date_joined.date }}, but it seems to be converting the date and time to UTC before showing the date (I am in EST\/EDT - I never remember which is which).\nFor example:\n{{ user.date_joined }} ==> Feb. 18, 2021, 7 p.m.\n{{ user.date_joined.date }} ==> Feb. 19, 2021\nIs there a way for me to change this so that it shows the same date as the full date and time?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":153,"Q_Id":66272633,"Users Score":1,"Answer":"Found a solution\/workaround for anyone else with a similar question.\nInstead of using {{ user.date_joined.date }} like a traditional datetime object, I used {{ user.date_joined|date }}","Q_Score":0,"Tags":"python,python-3.x,django,django-templates","A_Id":66272941,"CreationDate":"2021-02-19T06:19:00.000","Title":"Django User.date_joined.date using UTC time?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I just tried to install package WoE using pip which works fine. Then in Jupyter Notebook when I try to run the command:\nfrom WoE import WoE\nI receive an error that there is no module named \"WoE\"\nI keep trying to figure out how to use sys.path.append to make this module work but I cannot figure it out. Any help or advice would be appreciated!","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":44,"Q_Id":66281276,"Users Score":0,"Answer":"Try running command prompt as admin and then doing the command py -m pip install WoE. If that still doesn't work try restarting your computer, it could just be an issue with Jupyter not seeing the module yet. You can also do py -m pip show WoE and if that gives you a file location then that means it did install correctly.","Q_Score":0,"Tags":"python,jupyter-notebook,sys.path","A_Id":66282893,"CreationDate":"2021-02-19T16:21:00.000","Title":"Solving ModuleNotFoundError: Importing the module WoE and manipulating sys.path.append to allow my notebook to identify the new module","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"i got this message when i wanted run a beysian personalized ranking by GPU in colab, How can i resolve this problem ?\nmessage is :\nGPU training requires factor size to be a multiple of 32 - 1. Increasing factors from 100 to 127.","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":337,"Q_Id":66284758,"Users Score":0,"Answer":"It could be that google colab is running out of ram\nwhy?\nbecause we are loading all data at once.or generating all data at once.\nexample :\ngoogle colab having 12 GB of ram. and it running out of ram.\nSo what i would suggest is:\nwe can process that data in chunks. if the total size of the data is 12 GB. than we can divide it into chunk(file) of 1 Gb.\n12 GB data = 12 chunks(files) of 1 Gb\nso now we have to load only 1 GB file into ram. which won't crash our notebook.","Q_Score":0,"Tags":"python,google-colaboratory","A_Id":66284829,"CreationDate":"2021-02-19T20:44:00.000","Title":"my colab notebook crash, how can i resolve it?","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"i got this message when i wanted run a beysian personalized ranking by GPU in colab, How can i resolve this problem ?\nmessage is :\nGPU training requires factor size to be a multiple of 32 - 1. Increasing factors from 100 to 127.","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":337,"Q_Id":66284758,"Users Score":0,"Answer":"On Colab a multitude of things could lead to crash. It's likely that you ran out of RAM or out of GPU memory.","Q_Score":0,"Tags":"python,google-colaboratory","A_Id":66284848,"CreationDate":"2021-02-19T20:44:00.000","Title":"my colab notebook crash, how can i resolve it?","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am relatively new to oop and had a quick question about the best way to approach coding a certain type of calculation. I'm curious if there's an established design pattern to approach this sort of problem.\nConsider a chemical process flow where you convert materials (a,b) with attributes such as temperature, pressure, flow rate, etc. into a final product c. To get there, I need unit operations D,E,F... each with its own set of attributes (cost, size, etc.). I would only need information flow in one direction as closed loops will probably increase the complexity (if not, I would really appreciate insight into how closed loops would work).\na,b --> D --> E --> F --> c\nUltimately I would like to be able to do a system cost analysis, where I would sum up the cost attributes of D,E,F.\nMy current thought process to approach this is to define a \"materials\" object, then have D inherit materials, E inherit D... c inherit F then lastly a \"system\" object inherit c to analyze the system variables. Since I would like to be able to swap out D,E,F for say G,H,I, there also needs to be code for conditional inheritance where D must be able to accept inputs a,b (based on defined attributes) and E be able to inherit D for the same reason. One of the things I'm unsure of is how object c would be able to understand how to sum up attributes of all the inherited objects (probably based on some consistent naming convention of objects\/attributes?).\nSorry for the somewhat lengthy question - if you are aware of AspenPlus, I'm looking to replicate a smaller scale version of this (ie no solvers) in Python. Thank you for reading through this!","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":71,"Q_Id":66287297,"Users Score":0,"Answer":"I would argue that in your case functional programming is actually more suited than OOP since what it boils down to is a set of operations process on \"blank\" materials that results in a new material, well actually the same with different properties.\nIf I was restrained to OOP I would create different classes :\n\nMaterialType which is basically a string or enum (of a, b & c)\nExternalProperties for temperature\/pressure, etc.\nMaterial which contains the Material_Type and various properties\/functions aimed at transforming the material type so for instance it could contain a transform function with an unbounded list of ExternalProperties\nLaboratory to do all the operations\n\nHere object c would be the MaterialType which the Material can calculate without inheriting of everything else.\nIt's hard to propose an accurate concretisation since your example is very abstract but I think inheritance brings more problems than solutions here.","Q_Score":1,"Tags":"python,oop,design-patterns","A_Id":66299410,"CreationDate":"2021-02-20T02:07:00.000","Title":"Python OOP Design Pattern for Calculation Flows","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Suppose I have a list of 100 numbers. I can find the mean by summing and dividing by the number of elements. But how can I find two values, one that gravitates towards the left of the list (assuming the list is ordered) and one towards the right, so that the list is equally divided into three blocks?\nSorting the array and taking the 33th and the 66th elements doesn't work because I could have all 1's before the 33th position and bigger values after, so the 33th position would be too early in the array. Those two 'means' depend on the values of the array and not solely on the indices.\nI'm sure what I'm trying to do has a proper naming but I can't really remember it now.","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":77,"Q_Id":66290266,"Users Score":0,"Answer":"You could try numpy.quantile for example np.quantile(your_list, [0.33, 0.66]) I think should do the trick","Q_Score":0,"Tags":"python,arrays,list,numpy,mean","A_Id":66290439,"CreationDate":"2021-02-20T10:01:00.000","Title":"How to find multiple equally distributed means of a numpy array?","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"For example: I want to know wether 5 and 500 have a 1:100 ratio, I also want to know how I can see if they roughly have the same ratio or not, how do I do this??","AnswerCount":4,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":406,"Q_Id":66293480,"Users Score":1,"Answer":"If you need to know whether a\/b and c\/d are roughly the same ratio, then (in Python 3 only) you can do math.abs(a\/b - c\/d) < margin. The smaller the positive number margin is, the more close the ratios have to be for the expression to return True. margin = 1\/100 would be within a percentage point.","Q_Score":1,"Tags":"python,python-3.x","A_Id":66293671,"CreationDate":"2021-02-20T15:45:00.000","Title":"How do I check if 2 numbers are equal to a specific ratio in Python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"i need to create random numbers in python, i have been using the random library, but is this library really random or is it just pseudo random?  and if it is pseudo random how can I get real random numbers in python?","AnswerCount":1,"Available Count":1,"Score":0.537049567,"is_accepted":false,"ViewCount":58,"Q_Id":66298189,"Users Score":3,"Answer":"All computer generated random numbers are pseudo-random.  If you want a more \"randomized\" version, you can use the secrets module instead of the random module.","Q_Score":0,"Tags":"python,random","A_Id":66298209,"CreationDate":"2021-02-21T01:11:00.000","Title":"Real random python numbers","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm having a hard time connecting my facial recognition system (realtime) to the database.\nI am using python language here. Try to imagine, when the system is doing REAL-TIME face detection and recognition, it will certainly form frame by frame during the process (looping logic), and I want if that face is recognized then the system will write 'known face' in the database. But this is the problem, because what if the upload to the database is done repeatedly because the same frame is continuously formed?\nthe question is, how do you make the system only upload 1 data to the database and if the other frames have the same image, the system doesn't need to upload data to the database?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":97,"Q_Id":66298575,"Users Score":0,"Answer":"you dont show any code, but to do what you're asking you want to have a flag that detects when a face is found and sets the variable. Then clear the variable once the flag leaves the frame. to account for false positives you can wait 4-5 frames before clear the flags and see if the face is still in the frame (i.e someone turns their head and the tracking looses the face)","Q_Score":0,"Tags":"python,face-recognition,yolo","A_Id":66298603,"CreationDate":"2021-02-21T02:28:00.000","Title":"Connect face recognition model to database efficiently","Data Science and Machine Learning":0,"Database and SQL":1,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am using django-email-verification for sending verification link to email of the user but it tales time to send email , i want to send mail with celery for the same to speed it up , please guide me how can i add celery configs?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":127,"Q_Id":66306295,"Users Score":0,"Answer":"Celery isn't going to make this run any faster. What Celery will do for you is make the task asynchronous.","Q_Score":0,"Tags":"python,django,email,celery,email-verification","A_Id":66306824,"CreationDate":"2021-02-21T19:35:00.000","Title":"send email verfication link using django-email-verification with celery","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"In python, after I set some filter with warnings.filterwarning (or some package I import does), how can I access the list of active filters? I tried sys.warnoptions but it always gives me an empty list.","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":34,"Q_Id":66316703,"Users Score":1,"Answer":"I found it looking at the source code. It's warnings.filters.","Q_Score":2,"Tags":"python,warnings","A_Id":66316874,"CreationDate":"2021-02-22T13:32:00.000","Title":"How to access active warning filters list?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"do I convert it a txt file? how do I inject the new line in between the other lines? I'm trying to inject a wallet address to a simple mining batch file without needing to physically open it prior.\npretty much the last step to automating my mining rigs for full self sufficiency.\nif anyone has any way of doing this, please describe in full detail or show an example, as I am self taught and in way over my head for a project that's exceeding expectations before release lol","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":49,"Q_Id":66362462,"Users Score":0,"Answer":"I would read in the entire file with f.readlines() so you get a list of strings (where each string represents a line in the file), write some logic that determines where the new string should go in between, and then re-write that to a file after.","Q_Score":1,"Tags":"python,html,batch-file,helper","A_Id":66363316,"CreationDate":"2021-02-25T04:35:00.000","Title":"how to inject code with a batch into a batch that has existing code","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I made an API for my AI model but I would like to not have any down time when I update the model. I search a way to load in background and once it's loaded I switch the old model with the new. I tried passing values between sub process but doesn't work well. Do you have any idea how can I do that ?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":44,"Q_Id":66370017,"Users Score":0,"Answer":"You can place the serialized model in a raw storage, like an S3 bucket if you're on AWS. In S3's case, you can use bucket versioning which might prove helpful. Then setup some sort of trigger. You can definitely get creative here, and I've thought about this a lot. In practice, the best options I've tried are:\n\nSet up an endpoint that when called will go open the new model at whatever location you store it at. Set up a webhook on the storage\/S3 bucket that will send a quick automated call to the given endpoint and auto-load that new item\nSame thing as #1, but instead you just manually load it. In both cases you'll really want some security on that endpoint or anyone that finds your site can just absolutely abuse your stack.\nSet a timer at startup that calls a given function nightly, internally running within the application itself. The function is invoked and then goes and reloads.\n\nCould be other ideas I'm not smart enough (yet!) to use, just trying to start some dialogue.","Q_Score":0,"Tags":"python,fastapi","A_Id":66394917,"CreationDate":"2021-02-25T14:02:00.000","Title":"Load new model in background","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I was able to convert a .py file to and exe file,\nhowever when I try to send it via Gmail, it detects as a virus.\nAlso, when trying to transfer the file on a USB flash drive, the computer says it's a virus.\nAny ideas on how to fix this?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":118,"Q_Id":66370571,"Users Score":0,"Answer":"Apart from getting your exe signed (not really a viable option unless you're working on a big and important project) or writing the program in a natively compiled programming language like C, no, there is no way to avoid the detection since the Py2Exe converter you're using embeds the Python interpreter and all needed dependencies into the binary, which is a technique often used by viruses.\nEDIT FOR:\nI didn't actually get the fact that Gmail is the thing blocking the exe, not your AV. Well, as said by other comments, Gmail blocks certain files by default. Try adding the exe to a zip or rar archive and send that instead of the plain .exe.","Q_Score":0,"Tags":"python,exe,converters,antivirus,virus","A_Id":66370775,"CreationDate":"2021-02-25T14:34:00.000","Title":"Created an EXE file from .py and it's detected as virus","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I was recently trying to solve a data science test. Part of the test was to get the number of observations in a dataset for which the variable X is less than the 4th 5-quantile of this variable X.\nI don't realy understand what they meant by the 4th 5-quantile! I tried using pandas df.quantile function but I wasn't able to figure out how to use it in my case","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1216,"Q_Id":66372010,"Users Score":0,"Answer":"4th 5-quantile translates value = data.quantile(4\/5)","Q_Score":0,"Tags":"python,pandas,dataframe,statistics,data-science","A_Id":66394110,"CreationDate":"2021-02-25T16:00:00.000","Title":"Is there a pandas method to find the 4th 5-quantile of a dataset?","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have two applications that access the same DB. One application inserts data into a table. The other sits in a loop and waits for the data to be available. If I add a new connection and close the connection before I run the SELECT query I find the data in the table without issues. I am trying to reduce the number of connections. I tried to leave the connection open then just loop through and send the query. When I do this, I do not get any of the updated data that was inserted into the table since the original connection was made. I get I can just re-connect and close, but this is a lot of overhead if I am connecting and closing every second or 2. Any ideas how to get data that was added to a DB from an external source with a SELECT query without having to connect and close every time in a loop?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":40,"Q_Id":66372325,"Users Score":0,"Answer":"Do you commit your insert?\nnormally the best way is you close your connection, and it is not generating very overhead if you open a connection for the select query.","Q_Score":0,"Tags":"python,mysql,sql,pymysql","A_Id":66372679,"CreationDate":"2021-02-25T16:17:00.000","Title":"pymysql SELECT * only detecting changes made externally after instantiating a new connection","Data Science and Machine Learning":0,"Database and SQL":1,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Let's say I have two complex images Z_1 and Z_2. I want to make a relative-phase map of the second image with respect to the first. This means:\nZ_2_relative = Z_2 * np.exp(-1j * np.angle(Z_1))\nThis creates a new complex valued matrix where the complex-phase should now be given by\nnp.angle(Z_2_relative) == np.angle(Z_2) - np.angle(Z_1)\nBut according to python these two are not equal. I bet it has something to do with the np.angle function.. but I cant pinpoint it, or know how to fix it...\nPS: Sorry, cant make a reproducible piece of code atm. Can do it later today","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":18,"Q_Id":66386086,"Users Score":0,"Answer":"Bah.. stupid question. Sorry for anyone that read it. If you do module 2pi, then everything is the same","Q_Score":0,"Tags":"python","A_Id":66386806,"CreationDate":"2021-02-26T12:47:00.000","Title":"Subtracting angles of complex valued matrix","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm attempting to thread a function call in my Python catastr^H^H^H^H^H^Hreation, and I've read up on how to use the threading.Thread() call.  My function takes a simple string argument, so theoretically it should be as easy as:\nthread = threading.Thread(target = my_func, args = (string_var, ))\nbearing in mind that the args() needs to be a tuple.  Got it.  However, it appears as though I'm still doing something wrong because I continually get the barffage from Python:\nTypeError: my_func() takes 1 positional argument but 2 were given\nI'm a bit stumped here.  Any guidance?\nThanks!","AnswerCount":3,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":55,"Q_Id":66389451,"Users Score":0,"Answer":"Seems the issue is that because it's a method (thanks gribvirus74 for the idea) and I'm attempting to thread it, it won't inherit the self.  And that appears to be the issue.  I moved the function outside of the class and called it with the Thread().  Works fine now.","Q_Score":0,"Tags":"python,multithreading,tuples","A_Id":66389727,"CreationDate":"2021-02-26T16:27:00.000","Title":"Python Thread() - Function Arg Tuple Not Working?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm sorry for the title of my question if it doesn't let clear my problem.\nI'm trying to get information from an image of a document using tesseract, but it doesn't work well on pictures (on print screens of text it works very well). I want to ask if somebody know a technique that can help me. I think that letting the image black and white, where the information I want is in black would help a lot, but I don't know how to do that.\nI will be glad if somebody knows how to help me. (:","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":74,"Q_Id":66403978,"Users Score":0,"Answer":"Using opencv might help to preprocess the image before passing it to tesseract.\nI usually follow these steps\n\nConvert the image to grayscale\nIf the texts in the image are small, resize the image using cv2.resize()\nBlur the image (GaussianBlur or MedianBlur)\nApply threshhold to make the text prominent (cv2.threshold)\nUse tesseract config to instruct tesseract to look for specific characters.\nFor example If the image contains only alphanumeric upper case english text then passing\nconfig='-c tessedit_char_whitelist=0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ\" would help.","Q_Score":1,"Tags":"python,image,image-processing,tesseract,python-tesseract","A_Id":66404196,"CreationDate":"2021-02-27T22:20:00.000","Title":"How to get information from an image of a document, like name, CPF, RG, on python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"In VS Code, many extensions, such as Tab Nine and Lint, rely on specific Python packages to function. On the other hand, the code I develop may need a different set of packages. Because there is the potential for package conflict and because we want the environment that we develop code to mimic the production environment,  it is convenient to have the dev environment\/extensions use one Anaconda Environment and the code I develop to use a different Anaconda Environment. But I am not sure how to configure this. Can someone help?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":27,"Q_Id":66414367,"Users Score":0,"Answer":"Down in the bottom left corner of VS code you can manually select the python environment depending on which codebase you are working with. The selection can be saved in the settings.json file so you don't have to manually reselect each time.","Q_Score":0,"Tags":"python,visual-studio-code,anaconda,vscode-settings","A_Id":66414999,"CreationDate":"2021-02-28T22:12:00.000","Title":"VSCode and Anaconda Environments: How to have dev extensions\/environment and my code under development use different Anaconda environments","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"So I am trying to build a login dialog for my application using qt\/python.\nI got confused by QT's view\/model architecture. QT provides models and view for tables, lists etc., but how do I go about implementing a login dialog using this architecture?\nI use a ui file that I created with QtDesigner.\nShould I create a user model that interfaces with the DB and retrieves user data, handling the login process, and return this result to the view? (view and controller combined, as per QT's terminology)\nI would like to use the same architecture throughout the application, but I got confused with this one. Do I even need a model for this?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":24,"Q_Id":66425819,"Users Score":0,"Answer":"Models are for binding data to view. You can create list model with user\/password fields and use QWidgetMapper to bind it to two QLineEdits but there's no much use in it since there's no much data and no complicated interactions.","Q_Score":0,"Tags":"python,pyqt","A_Id":66425984,"CreationDate":"2021-03-01T16:23:00.000","Title":"QT View\/Model Login dialog","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"So im trying to simply just trying to make a directory with kivy and i simply cant get it to work. I a useing the os.mkdir() function.\nI have tried to just simply os.mkdir(\"a\"), but i couldnt find any directory named a (after doing a full phone search, with the phone plugged in to my pc).\nI have alos tried os.getcwd() as in os.mkdir(os.getcwd()+\"a\"), but to no avail.\nTo put it simply i am lost, can't find anything about it online either... So if you know how i would greatly appreciate to be enlightend on the subject, thx in advance.\nAnd i am importing os, also tried to run os.mkdir before importing kivy.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":354,"Q_Id":66429880,"Users Score":0,"Answer":"I have tried to just simply io.mkdir(\"a\")\n\nThere is no io.mkdir - do you mean os.mkdir?\nThe directory will be created inside the current directory of the script, which is a folder inside the app's private directory as defined by Android.\nThat means you should see your new directory in e.g. os.listdir(\".\").","Q_Score":0,"Tags":"python,android,kivy,buildozer","A_Id":66430097,"CreationDate":"2021-03-01T21:24:00.000","Title":"How would one go about making a directory (mkdir) in python with kivy on android(buildozer)?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I want to deploy a flask app with http.server (ngnix not installed by admin). I want any user who logs into the cluster to access it. Is it possible?","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":26,"Q_Id":66436982,"Users Score":1,"Answer":"HTTP server interfaces are visible to all users that are connected to a machine that has direct network access to the machine your server is running on.\nIf you need them to access the interface just provide the ip address and port where the server is running and the will be able to access it as users of the Flask app you are running. Just make sure you allow the users to access the needed resources.","Q_Score":0,"Tags":"python,linux,http,server","A_Id":66437057,"CreationDate":"2021-03-02T09:49:00.000","Title":"If I run an http server in my user account (linux cluster) how to enable other users to access it?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"For establishing many-to-many relationships, django admin has a nice widget called 'filter_horizontal'.\nThe problem is - it only displays primary key of the related table.\nHow do I add other fields from the related table?\nFor example, if I have a many-to-many relationship in my Order model with User model, in 'Order' django admin I can only see User's primary key(id). How do I add their name into the widget?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":52,"Q_Id":66443136,"Users Score":0,"Answer":"Turns out it is changed in  str method for the User model","Q_Score":0,"Tags":"python,django,admin","A_Id":66510005,"CreationDate":"2021-03-02T16:20:00.000","Title":"Django admin many-to-many - how to show additional fields?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Hey everyone I installed Python3.9 on my Mac using homebrew package manager but now I do not know how to install packages to it for use\nCan anyone please tell me, thanks !","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":642,"Q_Id":66444227,"Users Score":0,"Answer":"You should first do some research on the Python virtual environment, but the final answer to your question is to use pip install for installing Python packages. Be aware that there are other options out there, but pip is the most prevalent.","Q_Score":1,"Tags":"python,macos,homebrew","A_Id":66444366,"CreationDate":"2021-03-02T17:28:00.000","Title":"Installing packages in python installed using home-brew","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"i need to halign text in kivymd button to the left and i found solutions for default kivy like text_size: self.size and halign='left', is button still a label in kivymd like in kivy? If no then how do you align text inside it?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":213,"Q_Id":66447022,"Users Score":0,"Answer":"Try the following:\ntext_align:'center'","Q_Score":0,"Tags":"python,kivy,kivymd","A_Id":67648878,"CreationDate":"2021-03-02T20:56:00.000","Title":"how do i align text in kivymd button?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am using Windows subsystem for Linux WSL with the Ubuntu App (Ubuntu 20.04 LTS). I have installed Anaconda (Anaconda3-2020.11-Linux-x86_64) on my Windows 10 Education 1909. I have Jupyter notebook, and can run this in the Firefox on my computer and it seams to be working properly. However when I try to install packages such as:\nUbuntu console: pip install scrapy\nThen the Jupyter notebook can not find it.\nJupyter notebook: import scrapy\nI am currently working in the base environment, but I believe that Jupyter is actually running python from a different source (I also have Anaconda on my Windows).\nI confirmed this by running:\nimport sys and sys.version both in the WSL and in the Jupyter notebook.\nJupyter notebook returns: '3.6.6 |Anaconda, Inc.| (default, Oct  9 2018, 12:34:16) \\n[GCC 7.3.0]'\nWSL returns: '3.8.5 (default, Sep  4 2020, 07:30:14) \\n[GCC 7.3.0]'\nconfirming that the \"wrong python is used\".\nI am hesitant to delete my Windows Anaconda since I have my precious environments all set up there and are using them constantly.\nThe spessific package that forces me to linux can be found at \"http:\/\/www.nupack.org\/downloads\" but requires registration for downloads.\nI do not have Anaconda or python in my Windows environment variables.\nI would be happy If I either would know where to install my packages (as long as they are in Linux), or if someone knows how to force Jupyter to use the Anaconda from WSL.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":558,"Q_Id":66474736,"Users Score":0,"Answer":"Thanks to Panagiotis Kanavos I found out that I had both Anaconda3 and Miniconda3 installed and that the WSL command line used the miniconda3 version while Jupiter Notebook used Anaconda3.\nThere is probably a way of specifying which version to use but for me I simply deleted Miniconda and it now works.","Q_Score":1,"Tags":"python,jupyter-notebook,windows-subsystem-for-linux,anaconda3","A_Id":66489815,"CreationDate":"2021-03-04T12:09:00.000","Title":"Anaconda on Windows subsystem for Linux (WSL) uses the \"wrong\" anaconda when creating a Jupyther Notebook","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":1,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"An analytic task has been given to me to solve it by python and return back the result to the technical staff. I was asked to prepare the result in a jupyter notebook and such that the resulting code would be fully runnable and documented.\nHonestly, I just started using jupyter notebook and generally found it pretty useful and convenient in generating reports integrated with codes and figures. But I had to go into some level of difficulty when I wanted to use specific packages like graphviz and dtreeviz, which was beyond doing a simple pip install xxx.\nSo, how should I make sure that my code is runnable when I do not know what packages are available at the destination Jupyter notebook of the next guy who wants to run it or when they want to run it using a Jupiter Lab? especially regarding these particular packages!","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":31,"Q_Id":66483484,"Users Score":1,"Answer":"One solution for you problem would be to use docker to develop and deploy your project.\nYou can define all your dependencies, create your project and build a docker image with them. With this image, you can be sure that anyone who is using it, will have the same infrastructure like yours.\nIt shouldn't take you a lot of time to learn docker and it will help you in the future.","Q_Score":0,"Tags":"jupyter-notebook,ipython,graphviz,runnable,jupyter-lab","A_Id":66759240,"CreationDate":"2021-03-04T21:42:00.000","Title":"How to make sure my jupyter notebook is runnable on any other computer or on any jupyter Lab?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am creating an ERP web application using Django. How can i connect multiple apps inside of a project with one database. I am using the PostgreSQL database and also how can i centralized the database for all modules of ERP. How can i perform operations in other module and see if user is authenticated or not","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":220,"Q_Id":66504952,"Users Score":0,"Answer":"Your apps use only the database(s) set up in your settings.py file.","Q_Score":3,"Tags":"python-3.x,django,postgresql","A_Id":66511623,"CreationDate":"2021-03-06T11:01:00.000","Title":"Multiple applications inside a Django project","Data Science and Machine Learning":0,"Database and SQL":1,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am looking for a method to get information of a \"trend\" regarding some hashtag\/key word on Twitter. Let`s say I want to measure how often the hashtag\/key word \"Python\" is tweeted in time. For instance, today, \"Python\" is tweeted on average every 1 minute but yesterday it was tweeted on average every 2 minutes.\nI have tried various options but I am always bouncing off the twitter API limitations, i.e. if I try to download all tweets for a hashtag during the last (for example) day, only a certain franction of the tweets is downloaded (via tweepy.cursor).\nDo you have any ideas \/ script examples of achieving similar results? Libraries or guides to recommend? I did not find any help searching on the internet. Thank you.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":388,"Q_Id":66505663,"Users Score":0,"Answer":"Try a library called:\nGetOldTweets or GetOldTweets3\nTwitter Search, and by extension its API, are not meant to be an exhaustive source of tweets. The Twitter Streaming API places a limit of just one week on how far back tweets can be extracted from that match the input parameters. So in order to extract all historical tweets relevant to a set of search parameters for analysis, the Twitter Official API needs to be bypassed and custom libraries that mimic the Twitter Search Engine need to be used.","Q_Score":0,"Tags":"python,web-scraping,twitter,tweepy","A_Id":66505759,"CreationDate":"2021-03-06T12:33:00.000","Title":"Tweets scraping - how to measure tweeting intensity?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":1,"ERRORS":0,"REVIEW":0},{"Question":"I want to know how to get the most recent message sent in a channel of a discord server with discord webhooks in python? I have not tried anything yet.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":206,"Q_Id":66523058,"Users Score":0,"Answer":"Webhooks are only meant for sending messages, not reading messages in a channel. The only way to get the last message from the channel is if you have a bot user in the server that can read message history in that channel.","Q_Score":0,"Tags":"python,discord,discord.py,webhooks","A_Id":66523831,"CreationDate":"2021-03-08T00:48:00.000","Title":"How to use dhooks to find the most recent message sent in a channel","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am looking for a way to print out the raw http query string when I use the request library in python3. It's for troubleshooting purposes. Anyone has an idea how to do this. I tried to use prepared requests, but it is not what I'm looking for.Any suggestion?\nthanks","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":77,"Q_Id":66531827,"Users Score":0,"Answer":"import requests\nresponse = requests.get('https:\/\/api.github.com')\nYou can use:\nresponse.text or response.content or response.raw","Q_Score":0,"Tags":"http,python-requests","A_Id":67973369,"CreationDate":"2021-03-08T14:41:00.000","Title":"output raw query string with python requests library","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I wanted to import the albumentations package to run a deep learning task, but it has conflicts and failed when I tried to install it in the current environment, so I used conda create --name to create a new one, and in the new environment the albumentations package is installed successfully, but I can not find it in the python interpreter setting, and the project keeps showing \"No module named 'albumentations' \", so , how to fix this problem?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":18,"Q_Id":66533908,"Users Score":0,"Answer":"I just tried create a new Base environment in the Setting-->Python Interpreter--> add --> Virtualenv Environment , and in the new Base environment, the newly created interpreter will appear below the Existing environment option.","Q_Score":0,"Tags":"python,development-environment","A_Id":66537417,"CreationDate":"2021-03-08T16:53:00.000","Title":"how to add the newly created conda interpreter to a specific project","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have a problem parsing DAG with error:\nBroken DAG: [\/usr\/local\/airflow\/dags\/test.py] No module named 'airflow.providers'\nI added apache-airflow-providers-databricks to requirements.txt, and see from the log that:\nSuccessfully installed apache-airflow-2.0.1 apache-airflow-providers-databricks-1.0.1 apache-airflow-providers-ftp-1.0.1 apache-airflow-providers-http-1.1.1 apache-airflow-providers-imap-1.0.1 apache-airflow-providers-sqlite-1.0.2 apispec-3.3.2 attrs-20.3.0 cattrs-1.3.0 clickclick-20.10.2 commonmark-0.9.1 connexion-2.7.0 flask-appbuilder-3.1.1 flask-caching-1.10.0 gunicorn-19.10.0 importlib-resources-1.5.0 inflection-0.5.1 isodate-0.6.0 marshmallow-3.10.0 marshmallow-oneofschema-2.1.0 openapi-schema-validator-0.1.4 openapi-spec-validator-0.3.0 pendulum-2.1.2 python-daemon-2.3.0 rich-9.2.0 sqlalchemy-jsonfield-1.0.0 swagger-ui-bundle-0.0.8 tenacity-6.2.0 termcolor-1.1.0 werkzeug-1.0.1\nBut the scheduler seems to be stuck:\nThe scheduler does not appear to be running. Last heartbeat was received 19 hours ago.\nHow can I restart it?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":2000,"Q_Id":66561217,"Users Score":0,"Answer":"well after remove all deps in the requirements , the worker in mwaa run normally , now can try test the bad deps","Q_Score":3,"Tags":"python,airflow,scheduler,directed-acyclic-graphs,mwaa","A_Id":66655747,"CreationDate":"2021-03-10T08:45:00.000","Title":"AWS Managed Airflow - how to restart scheduler?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"I am working on Google Colaboratory, and I have to implement OCL (Object Constraint Language), I searched a lot, but I didn't find how to implement it. Can someone give me an idea please?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":221,"Q_Id":66562115,"Users Score":0,"Answer":"It is surely possible for you to implement OCL, duplicating the efforts of one of the existing Open Source implementations such as Eclipse OCL or USE. There is an official OMG specification that will define what you need to do, however it has many deficiencies that will require research to solve and design around. I would be surprised if you can implement a 'full' implementation of OCL from scratch with plausible accuracy in less than a person year.\nI suspect that you have mis-stated what you want to do or have misunderstood what someone has instructed you to do.","Q_Score":0,"Tags":"python,google-colaboratory,ocl","A_Id":66567998,"CreationDate":"2021-03-10T09:46:00.000","Title":"How to implement OCL (Object Constraint Language) in Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I want to know how I can send messages in discord, without creating a bot.\nLike I want the program to send messages through my own account. Most of the results I got when I searched this up is to create a bot. But I would like to know if there's a way to do it without creating the bot. Thanks :)","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":90,"Q_Id":66577819,"Users Score":0,"Answer":"To access discord with a bot trough your own account, you can't use a discord bot. What you could do, is to automate \"your input\" in discord. Imagine a google sheet for example and now recording your input to copy the first line, delete it afterwards, then paste it in discord and send the message. now you could repeat this for every line in the file.\n(You can find such program using google)\nBUT this solution restricts you to your input. Any events discord provides like on_member_join for example aren't useable for this approach. It's more a user bot than a discord bot","Q_Score":0,"Tags":"python,python-3.x,list,discord,bots","A_Id":66578384,"CreationDate":"2021-03-11T07:02:00.000","Title":"How to send messages in discord without using bot application","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"How do I download QtDesigner for PyQt6? If there's no QtDesigner for PyQt6, I can also use QtDesigner of PyQt5, but how do I convert this .ui file to .py file which uses PyQt6 library instead of PyQt5?","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":3695,"Q_Id":66613380,"Users Score":2,"Answer":"You can install QtCreator or use command line pyuic6 -o main.py main.ui","Q_Score":0,"Tags":"python,pyqt5,qt-designer,pyqt6","A_Id":66614227,"CreationDate":"2021-03-13T12:13:00.000","Title":"Downloading QtDesigner for PyQt6 and converting .ui file to .py file with pyuic6","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"with tokenize I know you can split text into individual words, but I am confused on how to add characters to indicate the beginning and end of sentences after tokenizing. In my case I want to put ^ to indicate the beginning of the sentence and $ to indicate the end of the sentence. I am asking because I am trying to implement bigram probability models and this is for a school assignment, which is why this is a reinvent the wheel problem.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":41,"Q_Id":66619452,"Users Score":0,"Answer":"tokenize is a part of python distribution, and intended to parse python source code. Is this actually a good tool for your problem? Have you tried nltk?","Q_Score":0,"Tags":"python,tokenize","A_Id":66619616,"CreationDate":"2021-03-13T23:07:00.000","Title":"Is there a Python function to mark the beginning and end of sentences with a specific character after tokenizing?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm working on Flutter project in Android Studio platform and I faced a problem with how to write and run python API code inside my Flutter project without letting it as a backend code in another platform? since when I run my Flutter project that connected with python API code in another platform as a backend using post method, it's worked with the emulator but it does not work with my physical android device.\nSo is there any recommend solution for either the first problem or the second.\nThanks.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":59,"Q_Id":66627916,"Users Score":0,"Answer":"No it's not possible to write python code Inside Flutter code\nBut you can write your api in different framework like Django ,mongodb and use it in your Flutter app","Q_Score":0,"Tags":"python,android,api,flutter,backend","A_Id":66627972,"CreationDate":"2021-03-14T18:07:00.000","Title":"Is it possible to write python code inside Flutter using Android Studio?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am currently starting a kind of larger project in python and I am unsure about how to best structure it. Or to put it in different terms, how to build it in the most \"pythonic\" way. Let me try to explain the main functionality:\nIt is supposed to be a tool or toolset by which to extract data from different sources, at the moment mainly SQL-databases, in the future maybe also data from files stored on some network locations. It will probably consist of three main parts:\n\nA data model which will hold all the data extracted from files \/ SQL. This will be some combination of classes \/ instances thereof. No big deal here\n\nOne or more scripts, which will control everything (Should the data be displayed? Outputted in another file? Which data exactly needs to be fetched? etc) Also pretty straightforward\n\nAnd some module\/class (or multiple modules) which will handle the data extraction of data. This is where I struggle mainly\n\n\nSo for the actual questions:\n\nShould I place the classes of the data model and the \"extractor\" into one folder\/package and access them from outside the package via my \"control script\"? Or should I place everything together?\n\nHow should I build the \"extractor\"? I already tried three different approaches for a SqlReader module\/class: I tried making it just a simple module, not a class, but I didn't really find a clean way on how and where to initialize it. (Sql-connection needs to be set up) I tried making it a class and creating one instance, but then I need to pass around this instance into the different classes of the data model, because each needs to be able to extract data. And I tried making it a static class (defining\neverything as a@classmethod) but again, I didn't like setting it up and it also kind of felt wrong.\n\nShould the main script \"know\" about the extractor-module? Or should it just interact with the data model itself? If not, again the question, where, when and how to initialize the SqlReader\n\nAnd last but not least, how do I make sure, I close the SQL-connection whenever my script ends? Meaning, even if it ends through an error. I am using cx_oracle by the way\n\n\nI am happy about any hints \/ suggestions \/ answers etc. :)","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":36,"Q_Id":66628729,"Users Score":0,"Answer":"For this project you will need the basic Data Science Toolkit: Pandas, Matplotlib, and maybe numpy. Also you will need SQLite3(built-in) or another SQL module to work with the databases.\nPandas: Used to extract, manipulate, analyze data.\nMatplotlib: Visualize data, make human readable graphs for further data analyzation.\nNumpy: Build fast, stable arrays of data that work much faster than python's lists.\nNow, this is just a guideline, you will need to dig deeper in their documentation, then use what you need in your project.\nHope that this is what you were looking for!\nCheers","Q_Score":1,"Tags":"python,python-3.x","A_Id":66628813,"CreationDate":"2021-03-14T19:32:00.000","Title":"How do I include a data-extraction module into my python project?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Created a Flash Restful API with various end points for my website. Some endpoints need the users username and password to get user specific data. I\u2019m currently sending these as parameters in the API call but I\u2019m assuming this isn\u2019t secure so how does one do this safely?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":71,"Q_Id":66639116,"Users Score":0,"Answer":"you can make a seperate api route that acts as a login and returns a sessionID\/token on a successful login that can be used for authenticating to those endpoints you mentioned.","Q_Score":0,"Tags":"python,api,flask-restful","A_Id":66639816,"CreationDate":"2021-03-15T13:40:00.000","Title":"How to safely send a user data in API call","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have created an instance on GCP to run some machine learning model for an app I am working on for a little project. I want to be able to call one of the methods in one of the files from my app and I thought a Cloud Function would be suitable.\nTo make this question simpler, let's just imagine I have a file in my instance called hello.py and a method in this file called foo(sentence). And foo(sentence) simply returns the sentence parameter.\nSo how do I call this method foo in python.py and capture the output?\nThanks","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":330,"Q_Id":66639983,"Users Score":2,"Answer":"At Google Cloud (And Google also), \"all is API\". Thus, if you need to access from a product to another one, you need to do this through API calls.\nIf your Cloud Functions needs to invoke a script hosted on a Compute Engine VM instance, you need to expose an API on this Compute Engine instance. A simple flask server is enough, and expose it only on the private IP is also enough. But you can't directly access from your Cloud Functions code to the Compute Engine instance code.\nYou can also deploy a Cloud Functions (or a Cloud Run if you need more system packages\/libraries) with the model loaded in it, and like this perform all the computation on the same product.","Q_Score":0,"Tags":"javascript,python,node.js,google-cloud-platform,google-cloud-functions","A_Id":66657007,"CreationDate":"2021-03-15T14:34:00.000","Title":"How to call function in GCP Instance from Cloud Function","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm looking to keep my mouse events in sync with my objects after resizing the screen.\nI'm told I need to create a data structure to keep track of:\n\nResizing events\n\nNew coordinates to match the resize\n\n\nHow can I accomplish this using simple algebraic equations and integrate it into a resize event for accurate updating?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":64,"Q_Id":66645103,"Users Score":1,"Answer":"Do it the other way around create a virtual game map, scale to the size of the window when drawing the scene and scale to the size of the virtual map when receiving an event.","Q_Score":2,"Tags":"python,python-3.x,pygame,pygame-surface,pygame2","A_Id":67031573,"CreationDate":"2021-03-15T20:19:00.000","Title":"In pygame how can i create a data struct that keeps track of resizing events and the coordinates of objects?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"After a click, a mini banner (or a container drawer) opens, which I should click on it, but I can't interact with it.\nI was trying the \"driver.switchTo\" command but since there is no Iframe, I don't know how to do it.\nthe body is this:\n  <a class=\"option\"> Go <\/a>","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":93,"Q_Id":66645314,"Users Score":1,"Answer":"I've had issues with this in the past, and largely I couldn't figure out what to do either.  If you can just leave your computer alone during the process you can always try to use pyautogui to kind of cheat your way through it.","Q_Score":1,"Tags":"python,selenium,switch-statement","A_Id":66645596,"CreationDate":"2021-03-15T20:36:00.000","Title":"Switch to panel - Python Selenium","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am working on a Python Turtle Snake Program, and I want to make my Turtle longer.\nBy that, I mean that I increase the 1 Cube to 2 Cubes, then 3, etcetera, for my Snake Game.\nCan you please inform how I could do that with turtle?\nThanks.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":36,"Q_Id":66647935,"Users Score":0,"Answer":"I once made a game like that. You can just create more turtles and use them as the body. Make the first turtle as the head of the snake. Then whenever it eats food,run a function that will create another turtle as a body component and put it in the previous position of head component. Repeat this everytime the snake eats a food.\nI am not so good in explaining,so sorry for any inconvenience : )","Q_Score":0,"Tags":"python-3.x,python-turtle","A_Id":69835659,"CreationDate":"2021-03-16T01:33:00.000","Title":"How to make a Turtle Longer","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am very new to python and pygame and I'm currently making a very basic experiment with it. So far, I know how to draw an image on the screen, move it around, add a background, stuff like that. But what I have always been wondering is, how do I switch between screens in a game and how do I keep the code tidy when doing so?\nEvery time I try to add a new thing to my already unstable code, it takes only a few lines to break it and it becomes a confusing mess.\nIf for example, I want a start screen that shows the title and a \"press any key to continue\" kinda thing, how do I do it?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":86,"Q_Id":66653278,"Users Score":0,"Answer":"A quick fix:\n\nMake the entire screen white and then draw the second screen onto the first one.\nThen when you need the other screen, just refill the screen with black and then continue.\nThis can be achieved by putting the screens in their own separate functions.\n\nLet me know if this helps out","Q_Score":0,"Tags":"python,pygame","A_Id":66653375,"CreationDate":"2021-03-16T10:24:00.000","Title":"How to make multiple screens in pygame? (As in, a \"menu\" screen, a \"main\" screen, a \"start\" screen, etc.)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have been playing around with django channels + angular. I have created an app that simply sends notifications to front end with a counter 1,2,3,4. It works fine, except if I open the page in multiple tabs. I am also not able to disconnect from the websocket, I can use unsubscribe but it does not really  close the connection but that's more kind of a angular question. Anyways how can I make my socket multithread, So if I make multiple requests from the same computer but from different tabs it will work and 2 different instances of the consumer will be created therefore, If I load 2 pages in the same computer the counter should be different independently increasing counter. Do I need redis for that ?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":465,"Q_Id":66662639,"Users Score":0,"Answer":"my url router was missing .as_asgi()\nthis worked:\nURLRouter([path('wscrawpredict', CrawPredictConsume.as_asgi(),name=\"wscraw\")])","Q_Score":0,"Tags":"python,django,angular,websocket,django-channels","A_Id":66829614,"CreationDate":"2021-03-16T20:08:00.000","Title":"multiple independent websockets connections","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"So the default of anaconda is python 3.8, but you can invoke python2 by running python2 a_py_script.py. The issue comes from the fact that you'll need to import things (say biopython), and you can't import them as any conda install -c conda-forge biopython or pip install biopython will be understood to automatically slot it into python3.8 packages exclusively.\nI ask this because I have some python2.7 scripts that demand packages outside the default install scope and ideally I'd like to do this without having to create a new python=2.7 env and track down everything I need.\nI've tried pip2.7 install biopython and python2.7 -m pip install biopython to no avail. Could it be that I technically don't have python 2.7 even though I'm able to invoke it from command line via python2 because python3 just naturally has some special limited backwards compatibility to run my python2 scripts? (I did notice that conda list includes only 3.8 and no mention of 2.7)\nI've tried cloning my env but I don't know how to do it in such a way that swapts just the version of python. conda create --name py27test --clone base python=2.7 says too many arguments. I'd like to know if this is even advisible as my base environment I would presume is entirely built off of v3.8 so swapping out the python versions will just be bad time hence why this seems impossible?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":493,"Q_Id":66670918,"Users Score":0,"Answer":"You can't mix Python versions in a conda environment. You can call Python executables from outside your environment, but that's unadvisable for anything requiring dependencies.  If you must use Python 2.7 and need dependencies installed, that needs to be done in a contained environment, one that does not mix Python 3 packages into it.\nIf you care about using your Python 2.7 scripts long-term, you should consider migrating them now; using unsupported software is only going to get harder over time.","Q_Score":0,"Tags":"python,pip,anaconda,conda,biopython","A_Id":66676641,"CreationDate":"2021-03-17T10:08:00.000","Title":"How do I install python2.7 packages under anaconda with python3.8 already in place?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Hi so I have been working on a notebook the last few days and showed it to my advisor yesterday and we walked through it together. I tried to start working on the project this morning and cannot find the file that I was working on. What is strange is that the directory that I was working in says it was last modified yesterday but when I look through the directory the file I am looking for cannot be found. I know that you are probably thinking \"this ding deleted the file on accident\" and although I really dont know how that could have happened, that is one suspicion of mine, but when looking at https:\/\/stackoverflow.com\/questions\/38819322\/how-to-recover-deleted-ipython-notebooks they mention that it should go to trash for my version of jupyter notebook upon deletion.\nI am asking if there is any way to possibly get the file back? or anywhere I can look for the file? I have looked in my trash can but it is not there.\nMacOS Big Sur 11.2.3\nJupyter NoteBook 6.1.5\nConda Version: 4.9.2\nConda-build version: 3.20.5\nPython: 3.8.5.final.0","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":41,"Q_Id":66672653,"Users Score":0,"Answer":"I do not know why this was the case but here is:\nI could not find the file of interest. Did all methods from before in above link, once I looked in the icloud Desktop in my finder it suddenly appeared in the normal desktop directory. Idk why, but if this happens to you, check the icloud directory corresponding to the directory you are in and it may appear in the corresponding normal directory after. Lesson learned: do some version control.","Q_Score":0,"Tags":"python,macos,jupyter-notebook,anaconda,storage","A_Id":66673358,"CreationDate":"2021-03-17T11:59:00.000","Title":"Cannot find .ipynb in directory that says it was last modified recently but has no recently modified files","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm making a simple project where I will have a downloadable scraper on an HTML website. The scraper is made in Python and is converted to a .exe file for downloading purposes. Inside the python code, however, I included a Google app password to an email account, because the scraper sends an email and I need the server to login with an available Google account. Whilst .exe files are hard to get source code for, I've seen that there are ways to do so, and I'm wondering, how could I make it so that anyone who has downloaded the scraper.exe file cannot see the email login details that I will be using to send them an email when the scraper needs to? If possible, maybe even block them from accessing any of the .exe source code or bytecode altogether? I'm using the Python libraries bs4 and requests.\nAdditionally, this is off-topic, however, as it is my first time developing a downloadable file, even whilst converting the Python file to a .exe file, my antivirus picked it up as a suspicious file. This is like a 50 line web scraper and obviously doesn't have any malicious code within it. How can I make the code be less suspicious to antivirus programs?","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":91,"Q_Id":66672822,"Users Score":0,"Answer":"Firstly, why is it even sending them an email? Since they'll be running the .exe, it can pop up a window and offer to save the file. If an email must be sent, it can be from the user's gmail rather than yours.\n\nSecondly, using your gmail account in this way may be against the terms of service. You could get your account suspended, and it may technically be a felony in the US. Consult a lawyer if this is a concern.\n\nTo your question, there's basically no way to obfuscate the password that will be more than a mild annoyance to anyone with the least interest. At the end of the day, (a) the script runs under the control of the user, potentially in a VM or a container, potentially with network communications captured; and (b) at some point it has to decrypt and send the password. Decoding and following either the script, or the network communications that it makes will be relatively straightforward for anyone who wants to put in quite modest effort.","Q_Score":1,"Tags":"python,html,download,exe,source-code-protection","A_Id":66673330,"CreationDate":"2021-03-17T12:08:00.000","Title":"Python exe - how can I restrict viewing source and byte code?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm making a simple project where I will have a downloadable scraper on an HTML website. The scraper is made in Python and is converted to a .exe file for downloading purposes. Inside the python code, however, I included a Google app password to an email account, because the scraper sends an email and I need the server to login with an available Google account. Whilst .exe files are hard to get source code for, I've seen that there are ways to do so, and I'm wondering, how could I make it so that anyone who has downloaded the scraper.exe file cannot see the email login details that I will be using to send them an email when the scraper needs to? If possible, maybe even block them from accessing any of the .exe source code or bytecode altogether? I'm using the Python libraries bs4 and requests.\nAdditionally, this is off-topic, however, as it is my first time developing a downloadable file, even whilst converting the Python file to a .exe file, my antivirus picked it up as a suspicious file. This is like a 50 line web scraper and obviously doesn't have any malicious code within it. How can I make the code be less suspicious to antivirus programs?","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":91,"Q_Id":66672822,"Users Score":1,"Answer":"Sadly even today,there is no perfect solution to this problem.\n\nThe ideal usecase is to provide this secret_password from web application,but in your case seems unlikelly since you are building a rather small desktop app.\nThe best and easiest way is to create a function providing this secret_password in a separate file,and compile this file with Cython,thing that will obcufate your script(and your secret_password) at a very good extend.Will this protect you from lets say Anonymous or a state security agency?No.Here comes the reasonable thinking about how secret and important really your password is and from who you mainly can be harmed.\nFinally before compiling you can 'salt' your script or further obscufate it with bcrypt or other libaries.\n\nAs for your second question antiviruses and specifically windows don't like programms running without installers and unsigned.\nYou can use inno setup to create a real life program installer.\nIf you want to deal with UAC or other issues related to unsigned programms you can sign your programm(will cost money).","Q_Score":1,"Tags":"python,html,download,exe,source-code-protection","A_Id":66673053,"CreationDate":"2021-03-17T12:08:00.000","Title":"Python exe - how can I restrict viewing source and byte code?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"How do I modify a np array based on the current value and the index? When I just want to modify certain values, I use e.g. arr[arr>target_value]=0.5 but how do I only modify the values of arr > target_value where also the index is greater than a certain value?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":74,"Q_Id":66706687,"Users Score":0,"Answer":"For that very specific example you would just use indexing I believe\neg arr[100:][arr[100:] > target_value]=0.5\nin general it could be conceptually easier to do these two things separately. First figure out which indices you want, then check whether they satisfy whatever condition you want.","Q_Score":0,"Tags":"python,arrays,numpy","A_Id":66706708,"CreationDate":"2021-03-19T10:45:00.000","Title":"Modify values in numpy array based on index and value","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Previous version of code wrote fine with Python 2.7 to AWS MySQL Version 8 with the following:\n\n\n\"\"\"INSERT INTO test_data(test_instance_testid,\nmeas_time,\ndata_type_name,\nvalue,\ncorner_case,\nxmit,\nstring_value)\nVALUES('15063', '2021-03-19 20:36:00', 'DL_chamber_temp', '23.4',\n'None', 'None', 'None')\"\"\"\n\nBut now, porting to Python 3.7 to the same server I get this:\n\npymysql.err.InternalError: (1366, \"Incorrect integer value: 'None' for column 'xmit' at row 1\")\n\nThis makes sense since it is a str value 'None' and not Python type None (although it used to work).\nIt is legal to fill these columns as NULL values--that is their default in the test_data table.\nIf I change the code and set the values to Python None, I get a different error which I don't understand at all:\n\n\"\"\"INSERT INTO test_data(test_instance_testid,\nmeas_time,\ndata_type_name,\nvalue,\ncorner_case,\nxmit,\nstring_value)\nVALUES('15063', '2021-03-19 20:36:00', 'DL_chamber_temp', '23.4',\nNone, None, None)\"\"\"\n\n\npymysql.err.InternalError: (1054, \"Unknown column 'None' in 'field list'\")\n\nI really appreciate any help or suggestions.\nThanks, Mike\nThanks for the help! Yes, NULL does work, but I'm stuck on how to handle value types on the fly within my method. Depending on the call I need to write a quoted value in one case and non-quoted NULL on others. For some reason my old code (illogically!) worked. I've tried everything I can think of without any luck.\nAny thoughts on how to do this?","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":788,"Q_Id":66718431,"Users Score":0,"Answer":"make default value as NULL at PhpMyAdmin","Q_Score":0,"Tags":"python,mysql","A_Id":66739265,"CreationDate":"2021-03-20T05:09:00.000","Title":"MySQL Version 8 Python 3.7 Cannot write None value as NULL","Data Science and Machine Learning":0,"Database and SQL":1,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"Does anyone have any good suggestions for where I can store my custom Python modules on Google Cloud Platform?\nI have a bunch of modules that I would like to access from the different GCP services I am using (App Engine, Compute Engine, Cloud Functions etc), without having to copy the Python files and upload to the service's Python environment each time.\nI was thinking GCS could be an option but then I am not sure how I would then get the module into, say Cloud Functions or App Engine?\nAny ideas?","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":50,"Q_Id":66726060,"Users Score":1,"Answer":"The code will eventually need to be written to your service's local storage. Python does not access code remotely during execution unless you write your code to do so (download the module and then execute). Package your code as modules and publish to PyPI and then add them as dependencies. When you deploy a service, your modules will be downloaded.","Q_Score":1,"Tags":"python,google-cloud-platform","A_Id":66726192,"CreationDate":"2021-03-20T20:14:00.000","Title":"Where to store my custom Python modules on GCP so they can be accessed by different GCP services?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":1,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Can you help with a definitive answer for MAC and PC.\nI have come across similar questions to this quite a lot on stackoverflow where a user will be using an editor such as IDLE or ATOM and they will get the module not found error, then they will go to terminal or command line prompt and try to pip install the module, and it will either install the module or say requirement already satisfied.\nOn returning to the editor and running the script it will still give the module not found error.\nI have seen the same question, but often asked about for specific modules.\nThis error started happening a lot for me when I was required to install anaconda for a course and was required to use other editors, but had previously been using a download of Python and working with IDLE.\nI often go between a MAC and a PC, where I have got the same issue, where I have an instance of anaconda installed and another instance of python installed.\nIt is very confusing how to untangle the different paths where some have modules and other don't.\nCould someone give some advice on how to rectify this?\nI wonder if there is a solution where I could do a pip install that would globally update all versions of python with a module?","AnswerCount":1,"Available Count":1,"Score":0.537049567,"is_accepted":false,"ViewCount":3151,"Q_Id":66728011,"Users Score":3,"Answer":"This could happen if you have multiple versions of Python installed on your computer. For example you have a package installed on Python 3.5 but you run your script on Python 3.8. On cmd or Powershell you could try something like py -3.8 -m pip list or py -3.5 -m pip list to check which libraries you have installed on each version of Python. Then if the library is missing from the version that you used on your script you can install it specifically for this version using something like py -3.5 -m pip install library_name.","Q_Score":1,"Tags":"python,python-3.x,module,pip,anaconda","A_Id":66728046,"CreationDate":"2021-03-21T01:20:00.000","Title":"module not found even after pip install","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":1,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"is it possible to call a web service from cooja? May be I can read from border-router then call web service (via python script for example). I can ping border-router but I dont know how to read from node or write to node in cooja.I am new to contiki-ng and cooja. thanks in advance","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":59,"Q_Id":66732962,"Users Score":0,"Answer":"You can try the websense example at the folder ~\/contiki\/examples\/ipv6\/sky-websense","Q_Score":0,"Tags":"python,web-services,serial-communication,cooja,contiki-ng","A_Id":67021154,"CreationDate":"2021-03-21T13:35:00.000","Title":"is it possible to call a web service from cooja?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"For all those who are not familiar with ren'py: It's basically python with some modifications. Since the project is coded in python, which can easily be edited by anyone it is not a good idea to include a license validation in the python files.\nAn executable starts the game, so I thought about wrapping it with a license validation in an .exe (but I honestly don't know how I can take an executable, put some code around and have one executable including the actual one). Maybe there is another way, which is safer than the one I named, suggestions?","AnswerCount":1,"Available Count":1,"Score":0.537049567,"is_accepted":false,"ViewCount":707,"Q_Id":66735373,"Users Score":3,"Answer":"You don't. Ren'Py only features basic encryption to prevent players from accidentally deleting\/modifying files.\nAs security, game encryption isn't a fight worth picking. You have to decrypt the files to run them and that will always be a weak point to exploit. Anything you put on top is just delaying whoever wants in. You can write your game in binary and it will do exactly squat to someone who really wants to take it apart.\nRen'Py is designed to be mod friendly. Nothing you do will stop someone from dropping a rpyc file into the game directory and hooking into the game. Even if you modify the engine to only read specific files, you won't stop someone who can just insert the functionality back in. All you're really doing is making it more difficult to preserve the game after you're dead.\nNintendo can't stop people from extracting assets from their games. You don't stand a chance. You should hope to be so lucky as to have people interested enough in your game to want to mess around with the assets and code.\nIf you're talking about a license players need or some sort of login mechanism, you need to implement an online server to validate the credentials they input. There is no secure front-end way to validate credentials.","Q_Score":0,"Tags":"python,renpy","A_Id":66770104,"CreationDate":"2021-03-21T17:24:00.000","Title":"How to protect my ren'py project from being copied?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":1},{"Question":"I wanna install three packages in anaconda, but I face the following error.\n Error: Could not install packages due to an OSError: [Errno 2]  No such file or directory: 'c:\\\\programdata\\\\anaconda3\\\\lib\\\\site-packages\\\\numpy-1.20.1.dist-info\\\\METADATA'.\nI have changed HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\FileSystem@LongPathsEnabled to 1, but it does not still work. There are some similar problems with pip and some solutions are provided but I could not apply them. Is there any difference between the pip\\\\METADA error and numpy\\\\METADATA error?\nI have basic knowledge and I would be thankful if someone can explain how to fix it with details. For example, some people suggested installing in another directory, but I do not know how to do this.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1096,"Q_Id":66751849,"Users Score":0,"Answer":"You could remove the folder of \"numpy-1.20.1.dist-info\" in error information firstly, and try install again.","Q_Score":2,"Tags":"python,numpy,anaconda,metadata","A_Id":69358873,"CreationDate":"2021-03-22T18:26:00.000","Title":"Could not install packages due to an EnvironmentError: [Errno 2] numpy-1.20.1.dist-infor \\\\METADATA","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"In my admin.py, I have a lot of ModelAdmin classes and I want them to all override a function, has_module_permission. I want to base the module permission off of the user's permissions for the model corresponding to the ModelAdmin, and to do that I need to know the model name in order to run request.user.has_perm('app.add_<model>') or something similar.\nI think an easy way of doing this is to create a class that has this function which is somehow able to get the model name, and then have each of the ModelAdmin classes inherit from that. The problem is that I don't know how to access the model's name from ModelAdmin. What's the best way of doing this?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":127,"Q_Id":66753140,"Users Score":0,"Answer":"If you just need the the model's name from ModelAdmin you can simply do the following: self.model.__name__","Q_Score":0,"Tags":"python,django,django-admin","A_Id":66753498,"CreationDate":"2021-03-22T20:06:00.000","Title":"Django overriding ModelAdmin classes with a function requiring Model name","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm lost with Python. After troubleshooting with a friend through Discord for literally months I am about to give up. This is my last attempt at trying to get Python fixed on my Windows 10 laptop.\nI'm using a Lenovo Legion 5, bought the laptop in November 2020. I've not been able to get anything related to Python to run in the CMD window. I can run Python no problem, but nothing I have installed through pip has ever worked. I can use virtualenvs, but only through PyCharm for example. Python has never really worked through the command line.\nYes I tried reopening the CMD window, rebooted the system many times, ran the CMD as administrator, installed the path variables for both Python and esptool.py but nothing seems to help.\nI honestly don't know where to start because none of the 250+ websites I've visited to so far that suggested a fix for any kind of issue I've been experiencing with Python has been working. I can run Python fine by the way, just none of the things installed through pip will work.\nLet's start with a use-case:\nI'm trying to run esptool.py so installed it with pip install esptool. This install worked fine, and I can confirm it is installed with pip show -f esptool.\nHowever, when running esptool.py version it told me:\n'esptool.py' is not recognized as an internal or external command, operable program or batch file.\nSo I added the local folder from the previous step to the %PATH% variables, after running esptool.py version it gave me a popup asking me with what kind of program I should open this, I didn't select to open with this kind of program from now on. This makes it so that I do not get an error, what now happens is that another window quickly opens and then exits without an error code. So I have no clue what's happening.\nWhat should happen is that it should tell me which version is installed in the CMD window.\nThere have been a few other things going on with my Windows 10 install, for one, the username that I used during the installation wasn't used to create the user directory. Windows 10 somehow instead chose a name that was related to the first 5 characters of my email address, which is totally strange as I haven't used that string in the installation of Windows 10 at all. This was a fresh install on a new laptop.\nNow, after an update of Win10 my user icon doesn't display anymore and I had to change ownership of the 'Windows Apps' folder in order to be able to access it. Changing the ownership also changed the name I now see on the login screen when I boot up the laptop. It changed from the 5 first chars of my email address to my full name in the login screen, only because I took ownership of this folder so I could access it.\nThere have been a lot of things going on that I think should not be changing all the time, things to do with administrator rights, ownership, etc.\nNow, since opening esptool.py doesn't open it, but also doesn't show me an error, I'm clueless and the only thing I can think of is doing a fresh system install, but I have a bunch of projects going on for which I need this laptop in working order and I don't have the mental health (due to corona) left to do a fresh system install. I'm worn down. Not in a dramatic way, I just don't have the spare energy to go through the whole process. So I'm hoping someone can point me in the right way to troubleshoot why my Python doesn't want to work natively.\nWhat happens when running esptool.py version is that I can see it opens a Python window, but without showing any content it closes within a few milliseconds.\nWhat is going on, how do I continue? I hope someone knows how to troubleshoot my system, to find the core of the problem.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":377,"Q_Id":66772433,"Users Score":0,"Answer":"It apparently was rather simple. First of all, thanks for the replies! And second of all, thanks for pointing me to superuser.com I wasn't aware of the site and will continue there.\nThe fix was to use python -m pip install esptool as suggested by Valentin Kuhn.\nTo answer AKD, I have a lot of experience with programming on my MacBook, but I'm not experienced with actually maintaining the system side, I'm a creative user. It's just that ever since I got a Windows laptop it's been nothing but trouble and after months of chatting about each individual issue with people on Discord nobody has been able to find a solution. I'm not expecting a GUI, just a simple \"esptool.py v3.0\" was the answer I was expecting from the command line.\nNow what I don't understand is that I've never found any hint to anyone suggesting python -m. I will get on superuser to find out more about why the standard instructions that work for most people, don't work for me.\nSorry for using the wrong site for my question, I came on here through another related question and it was past my bedtime and I wasn't thinking clear.","Q_Score":0,"Tags":"python,python-3.x,windows,pip,windows-10","A_Id":66777723,"CreationDate":"2021-03-23T22:55:00.000","Title":"PIP installed items don't want to work in Windows 10","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":1,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"I'm a student. For my Distributed Systems project, I'm expected to create a gRPC project. I'm creating the project in Eclipse.\nTwo service implementation are to be coded in Java and the other is to be done in another coding language.\nI've tried searching for help online but the results I'm getting are related to gRPC and how gRPC works, not about the coding or using other coding.\nIdeally, I would like to use Python as the other language and to create it in Eclipse if possible. Does anyone have any information, documentation or examples I could look at, so I could can reference it?\nI am able to see online searches for both Java and Python, but I'm not sure how to use both in one project.\nThank you.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":62,"Q_Id":66781091,"Users Score":0,"Answer":"So I got a lot of feedback for lecturers and classmates.\nThe server doesn't care what programming language is used.\nSo Java, Python, Node.js etc, could all be sent to the server.\nA generalised simplistic idea of how I was able to understand is: Python converts its code to binary and sends it to the server. Same with Java and Node.js.\nI don't know why, but I was digging myself deeper trying to figure out what code (i.e. the binary) that needed to be the communication between the server and code. I was trying to encapsulate Python into Java and vice versa.\nWhy did I think this? Your guess is as good as mine.","Q_Score":1,"Tags":"eclipse,grpc,grpc-java,grpc-python","A_Id":66873041,"CreationDate":"2021-03-24T12:30:00.000","Title":"gRPC - Using code other than Java to create a Service Implementation","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":1,"ERRORS":0,"REVIEW":0},{"Question":"I was trying to apply a deep learning algorithm(CNN) in python but after separating training-testing data and transforming time series to image step my Colab Notebook crashed and restarted itself again.\nIt gives an error like \"Your session crashed after using all RAM\" and when I checked app.log I saw something about tcmalloc: large alloc. I didn't find anything to fix this crashed.\nDo you have any idea how to prevent this warning and fixed this situation?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1324,"Q_Id":66787279,"Users Score":3,"Answer":"Your session ran out of all available RAM. You can purchase Colab Pro to get extra RAM or you can use a Higher RAM machine and use the Neural Network there","Q_Score":5,"Tags":"python,tensorflow,memory-management,google-colaboratory,tcmalloc","A_Id":66789185,"CreationDate":"2021-03-24T18:35:00.000","Title":"tcmalloc: large alloc python in Google Colab","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"I'm contributing to a project that is using sqlalchemy. This project has a model.py file where they define all their classes, for example Foobar(BASE). Now, I've created another module mymodel.py where I need to extend some of those classes. So for example, in mymodule.py I have Foobar(model.Foobar)   which I use to extend the parent class with new properties and functions. The problem is that when using either of those classes, I get this error from sqlalchemy: sqlalchemy.exc.InvalidRequestError: Multiple classes found for path \"Foobar\" in the registry of this declarative base. Please use a fully module-qualified path..\nMy question then is, how can I fix this error without renaming my classes? Since they are defined in a different module, how do I use a \"fully module-qualified path\"?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":737,"Q_Id":66795228,"Users Score":0,"Answer":"As stated by SQLAlchemy there a two classes found named Foobar. One is model.Foobar and the second one is mymodel.Foobar. You need to use the fully module-qualified path which is mymodel.Foobar to reference the new class.","Q_Score":0,"Tags":"python-3.x,sqlalchemy,orm","A_Id":66800246,"CreationDate":"2021-03-25T07:52:00.000","Title":"SQLAlchemy how to use a \"fully module-qualified path\"?","Data Science and Machine Learning":0,"Database and SQL":1,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"Hello I know that the key to analyzing data and working with artificial intelligence is to use the gpu and not the cpu. The problem is that I don't know how to use it with Python in the visual studio code, I use Ubuntu, I already have nvidia installed","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":1242,"Q_Id":66801401,"Users Score":1,"Answer":"You have to use with the libraries that are designed to work with the GPUs.\nYou can use Numba to compile Python code directly to binary with CUDA\/ROC support, but I don't really know how limiting it is.\nAnother way is to call APIs that are designed for parallel computing such as OpenCL, there is PyOpenCL binding for this.\nA bit limiting, but sometimes valid way - OpenGL\/DirectX compute shaders, they are extremely easy, but not so fast if you need to transfer data back and forth in small batches.","Q_Score":0,"Tags":"python,python-3.x,pandas,dataframe,visual-studio-code","A_Id":66802239,"CreationDate":"2021-03-25T14:18:00.000","Title":"how can i work with my GPU in python Visual Studio Code","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I would like to know how to convert annotations in YOLO format (e.g., center_X, center_y, width, height = 0.069824, 0.123535, 0.104492, 0.120117) to x1, y1, x2, y2 coordinates?","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":489,"Q_Id":66801530,"Users Score":1,"Answer":"Given that the upper-left corner of the image is [0,0]: For the upper-left corner you have to do [x,y] = [center_X, center_Y] - 1\/2 * [width, height] . For the bottom-right corner [x,y] = [center_X, center_Y] + 1\/2 * [width, height] .","Q_Score":1,"Tags":"python,computer-vision,yolo","A_Id":66801978,"CreationDate":"2021-03-25T14:24:00.000","Title":"How to convert YOLO format annotations to x1, y1, x2, y2 coordinates in Python?","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"It's probably a dumb question but i cant find the answer anywhere. So, I have made a simple site with Flask and it have a database in SQL(SQLite3). I'have never uploaded a site before and I don't know how to get the data after deployed. Plz help.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":76,"Q_Id":66803446,"Users Score":0,"Answer":"If your code already works locally, make sure it has a relative path like '.\/data\/sqllitedb.db'.\nPut it in a folder that isn't available to access from your website.\nWhen you deploy to your website, it should use the same relative path.\nSqlite is great because it is just a local file and as long as you use relative paths to your main site, you should be able to access it","Q_Score":2,"Tags":"python,sql,sqlite,flask","A_Id":66803891,"CreationDate":"2021-03-25T16:10:00.000","Title":"How will I access the data in my database after uploading my site to the web?","Data Science and Machine Learning":0,"Database and SQL":1,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am using Python to automate some installations in my everyday workflow.\nThe installation requires mounting a .dmg file to the system in order to start and complete the installation. Everything works fine until I try to eject\/unmount the attached volume, it gives an error that the volume is used by Python and cannot be ejected\/unmounted. The installation process is already completed by the time the unmount is executed, so in theory, files should no longer be in use.\nForce unmount helps with the unmount process, but for some reason, it interferes with subsequent subprocess.Popen command that starts the installed application and the app crashes at startup. The crash doesn't occur if the volume is not unmounted, which is a sign the issue is caused by the unmount process.\nI would like to try to unmount the volume without forcing the process, but I don't know how to unlock the files being used by Python for the installation. Is there a way to force python to unlock those files?\nThanks in advance.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":80,"Q_Id":66804331,"Users Score":0,"Answer":"The issue was related to the fact the current working directory was set to a folder inside the mounted volume. Switching the CWD to HOME before unmounting process and subprocess execution fixes the issue.","Q_Score":2,"Tags":"python,macos,file,locking","A_Id":66805352,"CreationDate":"2021-03-25T17:07:00.000","Title":"How to force python to unlock files on macOS","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"I have a problem: we are using a package that is not maintained for a while now. So we forked it in order to maintain it ourselves. The package already exists lets say it is named package_a. Most of the code and the __init__ are in the package_a\/ folder.\nNow we want to make our own package that will include our maintained code and we want to name is package_b. So far so good but the problems is that package_b wants to have the code and the __init__ in package_b\/ folder and github changes the contributions for all files when a folder is renamed. And I would like that credit for contributions stays where it is due, the 10k+ lines of code didn't just appear in my local repo out of thin air. Any suggestions how we can have package named package_b but keep the code in the original folder package_a\/?\nI am thinking along the lines of trying with some clever way of importing package_a into package_b or something along the line but I hope for a definite answer.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":57,"Q_Id":66804369,"Users Score":2,"Answer":"Instead of copying the code or trying to import A into B, extract the common code into a 3rd package which both A and B import. Or perhaps a subclass. This doesn't solve your contribution problem, but it does avoid making a big maintenance hassle by copying and pasting 10,000 lines of code.\n\nGit doesn't record copies and renames, but it can recognize when they happen. To give Git the best chance of recognizing a copy, do only the copy in its own commit. Make no changes to the content. Then in a second commit make any necessary changes to the copied code.\nIn normal Git you can nudge git log and git blame to honor copies and renames with -C. Git doesn't do this by default because it's more expensive.\nGithub will do what Github will do.\nRegardless of who Github says who wrote what line their contributions will still be in the project history. That's how it goes. You make your contribution and then others put their own work on top of it. This is normal. Their contributions remain in the history.\n\"History sheer\" is also normal, that's when a change touches many lines but is otherwise insignificant. For example, if you were to restyle the code that would cause a history sheer. git blame will say that was the last commit to touch the code. git blame -w mitigates this somewhat, and Github has an \"ignore whitespace\" option. History sheer is normal and so is learning to skip over it.\nThe tools work for us. Don't bend yourself for the benefit of the tools.\nIf you want to make a special shout out to your contributors, make a contributor's section to your README.md.","Q_Score":2,"Tags":"python,github","A_Id":66835236,"CreationDate":"2021-03-25T17:09:00.000","Title":"Rename folder in git without changing the contributors","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Sorry for my stupid question, but i dont understand how to add all permissions in my voice channel for one user. I have this await channel.set_permissions(member, some_permission), but i dont know what permission i need to use","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":304,"Q_Id":66824019,"Users Score":0,"Answer":"You should just make a role with those permissions and then give that role to the user. for example, await member.add_roles(var) var being the role and member being the member you want to add the role too.","Q_Score":0,"Tags":"python,python-3.x,discord,discord.py","A_Id":66847972,"CreationDate":"2021-03-26T20:37:00.000","Title":"How to give all permissions in voice channel discord.py","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I trained a chatbot in a file on my computer. I have everything else for my website up and running but I cannot get the python file into the site. Do you have any advice for how I can make an html messenger that uses user inputs and converses with the AI chatbot that way? Thank you!","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":69,"Q_Id":66828255,"Users Score":1,"Answer":"One easy way to do this is by building a server, where you can have your chatbot code. You can use Flask. The instant the HTML asks a question, you send an API call with the required message, which when received by the API runs that message through the chatbot and returns the response in the output. This can continuously go on in the chat.","Q_Score":0,"Tags":"python,html,css,flask","A_Id":66828292,"CreationDate":"2021-03-27T05:21:00.000","Title":"How the heck do I import my python chatbot into my html code?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Background\nI have a google sheet, who's data I need to process on my local system. The nature of processing is very tedious and long so I wrote a script for it.\nProblem\nI need to access the google sheet through the python script to process it further. Online it is mentioned that to read the private google sheet directly, I need to create a GCP project and within that project, I need to create a service account. After that I should download the credentials and share the google sheet with that service account email.\nTwo problems here are :\n\nDownloading the credentials -- insecure and my organization prohibits it.\nSharing of google sheet with service account email. organization also prohibits sharing sheet with outside organization emails.\n\nWhat I found as a solution\nI came across a solution of impersonating a service account but I could not find anything as to how can I do that. (Would appreciate any insights on that). All the other solutions suggested to download credentials which is a big NO.\nFor the sharing of sheets thing, I guess we can use drive API, but same problems are with that.\nI tried using gcloud auth login and gcloud auth application-default login but was getting errors\n\nRequest had insufficient authentication scopes.\". Details: \"Insufficient Permission: Request had insufficient authentication scopes.\n\nusing ['https:\/\/www.googleapis.com\/auth\/spreadsheets',  https:\/\/www.googleapis.com\/auth\/drive'] as scopes\nWhat I need? (Summary)\nHow to access google sheets API (or download the Sheet from google drive) without downloading any sort of credentials.json.","AnswerCount":2,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":1394,"Q_Id":66833449,"Users Score":2,"Answer":"problem\nYour only option to access private user data is to be authorized as a user who can access the file. Either logging in using Oauth2 or using a service account\n\nDownloading the credentials -- insecure and my organization prohibits it.\n\nIn order to use a google api you must first register your application on google developer console and download the client credentials then a user must authorize the application using Oauth2, which would mean both downloading the credentials.json file from google developer console and you getting user token credentials from the authorized user.\n\nSharing of google sheet with service account email. organization also prohibits sharing sheet with outside organization emails.\n\nIn order to use a service account you would again need to first register your application on google developer console and download the client credentials for the service account.  Then you would need to share the sheet with the service account.\nservice account impersonation.\nService account impersonation is used by GSuite domain. You create a normal service account again downloading the credentials, and then the GSuite admin is able to delegate authority to the service account which will allow it to impersonate a user on the domain.\nThis would require you to have GSuite domain and the owner of the file being also on the GSuite domain, and you creating a project on google developer console and downloading the credentials.json for the service account, which you already stated you couldn't do.\nconclusion\nI guess what i am saying is there is no way with the limitations imposed by your organization for you to access a private google sheet or any private user data on googles system, via any api.","Q_Score":3,"Tags":"python-3.x,google-sheets,google-cloud-platform,google-drive-api,google-sheets-api","A_Id":66834681,"CreationDate":"2021-03-27T16:13:00.000","Title":"How to read private Google Sheets using Google Sheets API without service account or downloading credentials","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"I'm working on a NLP classification problem over a large database of emails (~1 million). I need to use spacy to parse texts and I'm using the nlp.pipe() method as nlp.pipe(emails,n_process=CPU_CORES, batch_size=20) to loop over the dataset.\nThe code works but I'm facing a (maybe not so)weird behavior:\nthe processes are being created but they are all in SLEEP state but one, casually some of them go in RUN state for a few seconds and then back to sleep. So I find myself with one single process using one core at 100% but of course the script not using all the CPU cores.\nIt's like the processes don't get \"fed\" input data from pipe.\nDoes anybody know how to properly use spacy nlp pipe or anyway how to avoid this situation? no way to use nlp.pipe with the GPU?\nThank you very much!\nSandro\nEDIT: I still have no solution but i've noticed that if I set the batch_size=divmod(len(emails),CPU_CORES), the processes all starts running at 100% CPU and after a few seconds they all switch to sleeping state but one. It really looks like some element in spacy pipe gets locked while waiting for something to end.... any idea??\nEDIT2: Setting batch_size=divmod(len(emails),CPU_CORES) while processing a large dataset leads inevitably to a spacy memory error:\n\nMemoryError: Unable to allocate array with shape (1232821, 288) and data type float32\n\n*thing that is maybe not so weird as my machine has 10GB of RAM and (1232821\u00d7288\u00d732)bits \/ 8 = 1.4GB multiplied by 6 (CPU_CORES) leads to a 8.5GB of RAM needed. Therefore I guess that, having other stuff in memory already, it turns out to be plausible. *","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":1341,"Q_Id":66844380,"Users Score":0,"Answer":"Ok, I think I found an improvement but honestly the behavior it's not really clear to me. Now the sleeping processes are way less, with most of them stable running and a few sleeping or switching between the two states.\nWhat I've done was to clean and speedup all the code inside the for loop and set the nlp.pipe args like this:\nfor e in nlp.pipe(emails,n_process=CPU_CORES-1, batch_size=200):\nIf anybody have any explanation about this or any suggestion on how to improve even more, it's of course more than welcome :)","Q_Score":2,"Tags":"python,multiprocessing,sleep,spacy","A_Id":66922559,"CreationDate":"2021-03-28T17:46:00.000","Title":"Spacy, using nlp.pipe on large dataset in python, multiprocessing leads to processes going in sleep state. How to proper use all CPU cores?","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":1,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm working on a NLP classification problem over a large database of emails (~1 million). I need to use spacy to parse texts and I'm using the nlp.pipe() method as nlp.pipe(emails,n_process=CPU_CORES, batch_size=20) to loop over the dataset.\nThe code works but I'm facing a (maybe not so)weird behavior:\nthe processes are being created but they are all in SLEEP state but one, casually some of them go in RUN state for a few seconds and then back to sleep. So I find myself with one single process using one core at 100% but of course the script not using all the CPU cores.\nIt's like the processes don't get \"fed\" input data from pipe.\nDoes anybody know how to properly use spacy nlp pipe or anyway how to avoid this situation? no way to use nlp.pipe with the GPU?\nThank you very much!\nSandro\nEDIT: I still have no solution but i've noticed that if I set the batch_size=divmod(len(emails),CPU_CORES), the processes all starts running at 100% CPU and after a few seconds they all switch to sleeping state but one. It really looks like some element in spacy pipe gets locked while waiting for something to end.... any idea??\nEDIT2: Setting batch_size=divmod(len(emails),CPU_CORES) while processing a large dataset leads inevitably to a spacy memory error:\n\nMemoryError: Unable to allocate array with shape (1232821, 288) and data type float32\n\n*thing that is maybe not so weird as my machine has 10GB of RAM and (1232821\u00d7288\u00d732)bits \/ 8 = 1.4GB multiplied by 6 (CPU_CORES) leads to a 8.5GB of RAM needed. Therefore I guess that, having other stuff in memory already, it turns out to be plausible. *","AnswerCount":2,"Available Count":2,"Score":0.0996679946,"is_accepted":false,"ViewCount":1341,"Q_Id":66844380,"Users Score":1,"Answer":"I've found that using n_process=n works well for some models, like en_core_web_lg, but fails with others, such as en_core_web_trf.\nFor whatever reason, en_core_web_trf seems to use all cores with just a batch_size specified, whereas en_core_web_lg uses just one unless n_process=n is given. Likewise, en_core_web_trf fails with a closure error if n_process=n is specified.","Q_Score":2,"Tags":"python,multiprocessing,sleep,spacy","A_Id":67037039,"CreationDate":"2021-03-28T17:46:00.000","Title":"Spacy, using nlp.pipe on large dataset in python, multiprocessing leads to processes going in sleep state. How to proper use all CPU cores?","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":1,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Given an arbitrary array with real numbers as entries, I want to return an array with the same shape, whose entries are the average over the closest neighbours of the original array.\nWhat I mean by this in the case of a given array of dimension 2, is that if the array has shape (n,m) with entries a_{i,j}, then on the entry (i,j) the value of the new array should be:\naverage(i,j)=1\/4 (a_{i+1,j} + a_{i-1,j} + a_{i,j+1} + a_{i,j-1}),\nwhere the first index is taken mod n and the second mod m.\nI would like to create a function whose argument is an arbitrary array, and returns an array of the same shape and entries the averages over the entries on the closest neighbours of the given array (for a d-dimensional array there are 2d closest neighbours, obtained by summing +1 and -1 on each index)\nI know how to do this for a fixed dimension d (just generalising the above equation), using d nested for loops, but I don't know how to do it when the dimensions are not fixed.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":291,"Q_Id":66846086,"Users Score":0,"Answer":"Scipy has a scipy.ndimage.convolve function, which can do exactly this. it takes the array, and a matrix of values to multiply the neighbors with. It should work for any number of dimensions.\nHowever if you are trying to write this function manually, I'd suggest trying an iterative or recursive approach, where each iteration or layer of recursion handles a dimension. In a 3D case, you would first handle the first dimension, and have the one sixth of the value of the neighbors in that dimension. The next iteration would do the same for dimension 2, etc.\nThe factor to multiply each neighbor with is 1\/(2n), since each entry has 2 neighbors in each dimension. This should scale up to any arbitrary number of dimensions.","Q_Score":0,"Tags":"python,arrays,numpy,numpy-ndarray","A_Id":66846266,"CreationDate":"2021-03-28T20:50:00.000","Title":"How to calculate average of closest neighbours in an array in numpy","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am confused as to how to get into script mode in Python's standard IDLE. I surprisingly cannot find how to get into it on Google.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":56,"Q_Id":66863444,"Users Score":0,"Answer":"I believe you mean the simple editor that ships with Python, \"IDLE\"?\nIf you have an IDLE console window open already, go to file->New File, or press ctrl+N to get a window where you can write and save a python file like a text editor.\nWhen you've written a script in that editor you can save it as you'd expect from File->Save and run it from Run->Run Module, or press F5 as a quick shortcut. It should then output any text to the IDLE console window.\nAlso see the comments directly beneath your question for some resources :) Happy scripting!","Q_Score":0,"Tags":"python,ide","A_Id":66863531,"CreationDate":"2021-03-30T00:52:00.000","Title":"How do I get into script mode for Python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"import yfinance as yf\nterminal: ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behavior is the source of the following dependency conflicts.\nyahoo 0.1 requires requests==1.1.0, but you have requests 2.25.1 which is incompatible.\nhow can I address this issue\nRegards! :)","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":1485,"Q_Id":66880867,"Users Score":0,"Answer":"The problem is that yfinance requires a newer version of requests than yahoo. For me it said the same thing as you got when I tried.\nImporting yfinance worked for me.\nI didn't specify anything for requests and just installed the above. Generally, you can specify installation version using =x.x at the end, i.e. pip install requests==1.1.0.","Q_Score":0,"Tags":"python,finance","A_Id":66881009,"CreationDate":"2021-03-31T02:32:00.000","Title":"Addressing a pip\u00b4s dependency issue: requests==2.25.1 versus requests==1.1.0","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"import yfinance as yf\nterminal: ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behavior is the source of the following dependency conflicts.\nyahoo 0.1 requires requests==1.1.0, but you have requests 2.25.1 which is incompatible.\nhow can I address this issue\nRegards! :)","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":1485,"Q_Id":66880867,"Users Score":0,"Answer":"It sounds like you have both yahoo and yfinance installed in the same environment\/setup. I suggest creating a virtual environment with virtualenv so you can have the appropriate requests for each libraries.\nAlternatively you can submit a PR for yahoo to use a more recent version of requests","Q_Score":0,"Tags":"python,finance","A_Id":66881232,"CreationDate":"2021-03-31T02:32:00.000","Title":"Addressing a pip\u00b4s dependency issue: requests==2.25.1 versus requests==1.1.0","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am trying to code a function that will accept a list and then return the length of the list times the largest integer (not float) in the list, if the list does not contain an integer, it needs to return an empty string.\nI had been trying to use the max function but I cannot work out how to only call for the largest integer not float, or is there a way to sort the list first to only look at integers?","AnswerCount":7,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":62,"Q_Id":66887008,"Users Score":0,"Answer":"you might be able to use an if statement to check if the number is an interger","Q_Score":0,"Tags":"python,integer","A_Id":66887051,"CreationDate":"2021-03-31T11:30:00.000","Title":"python - is there a function to return the maximum integer but not float from a list","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Robot Framework supports two ways to interact with the tests and modify the test structure:\n\nthe visitor internal API\nthe listener API\n\nI would like to prepend, to specific tests, a given keyword, or even more precisely to wrap the test in a given keyword, if that test has a specific tag. Which of the two approaches should I choose, and how I should use the API of the Body of Robot Framework to wrap it in a Wait Until Keyword Succeeds?","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":582,"Q_Id":66890396,"Users Score":1,"Answer":"I think the Listener API might be the way to go but why not use the Test and Suite Setup Keywords to be able to pull off what you are trying to do. However, in general, i.e. not just in Python or Robot Framework, it is a bad idea to have one test depend on the execution of another test. Ideally, each test should be able to run on its own, whether first or last or anywhere in the sequence so perhaps there might be a need to refactor your tests and\/or Keywords to be able to achieve what you are attempting.","Q_Score":2,"Tags":"python,robotframework","A_Id":66894693,"CreationDate":"2021-03-31T15:04:00.000","Title":"Wrapping a test case in Robot Framework in keyword based on the tag of a test","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have created project and even i have client_secret.js file, when i try to run the program first time it asks to login, when I tried to login through gmail (which I have used to create project) it says\n\n\"Google hasn\u2019t verified this app\"\n\nMessage, so for that i'm looking how to get out from this step.","AnswerCount":2,"Available Count":1,"Score":-0.0996679946,"is_accepted":false,"ViewCount":71,"Q_Id":66899042,"Users Score":-1,"Answer":"This is occuring because the application you created is not verified by google so you are not able to login in that you need to verify it by google suite and then you are able to login I also get that problem when i tried to create an browser for myself","Q_Score":1,"Tags":"python-3.x,google-sheets,google-drive-api,google-oauth,google-developers-console","A_Id":66899090,"CreationDate":"2021-04-01T05:49:00.000","Title":"How to read files from Google drive through python when it says Google hasn\u2019t verified this app?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"So, i entered code below to round a column to the nearest integer, though it still shows up with decimals.\nEg. I want to round 62.040 to just 62 though once the code is entered it shows 62.0 in the output\ndata['Final'] = np.ceil(data['Total'].round())","AnswerCount":3,"Available Count":1,"Score":0.1325487884,"is_accepted":false,"ViewCount":209,"Q_Id":66912904,"Users Score":2,"Answer":"This should work pretty ok data['Final'] = round(data['Total'])\nThis converts the decimal number to it nearest integer and the returned number doesn't have a decimal point\nNote: I'm assuming that data is just dictionary that contains float numbers, since no more information was provided","Q_Score":2,"Tags":"python,python-3.x,pandas,dataframe","A_Id":66913053,"CreationDate":"2021-04-01T23:56:00.000","Title":"how can i stop showing the decimal .0 after the whole number? python","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm new with dramatiq and I do not find a way how to start dramatiq in detach mode like Celery?\nI try to start with flags --d --detach, but nothing works.\nPlease inform me how to start dramatic in detach mode when I start dramatiq app:broker","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":64,"Q_Id":66915309,"Users Score":0,"Answer":"I found it's already work on detach mode, but if you wish to read the logs you need to have your terminal in open view","Q_Score":0,"Tags":"python,dramatiq","A_Id":66949143,"CreationDate":"2021-04-02T06:31:00.000","Title":"How to run dramatiq tasks run in detach mode?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm working in python and I have an image that is represented by the shape (4,386,258), I would like to represent it with the shape (3,386,258). Is there a way to do that? I don't know how to combine the information in order to get the right map","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":25,"Q_Id":66917084,"Users Score":0,"Answer":"Assuming your image is 386 pixels by 258 pixels and you have 4 channels, it means you want to convert the colour representation to one using only 3 channels, probably RGB. You haven't specified what libraries you used to read-in the image or where it is from, but most would have methods to handle this for you, so you don't have to write the conversion manually. They should also have methods of finding what the current colour representation is.","Q_Score":1,"Tags":"python,arrays,numpy","A_Id":66917203,"CreationDate":"2021-04-02T09:17:00.000","Title":"How to map an array of shape (4,386,258) to an array of shape (3, 386,258) in python?","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":1,"ERRORS":0,"REVIEW":0},{"Question":"So i was trying to make a voice classifier, the challenge was to predict if the person talking is me or is other person, i already build a simple code that converts .wav file into an array, so all my datasets of audio files of me talking will be converted into arrays, the thing is that I am a beginner and i dont know how to only use one variable for predicting(my voice), is like saying true or false, how can i make a neural network(CNN) that works like that?\nOr should i use another type of machine learning? And not deep learning? I would like to use deep learning for this project.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":61,"Q_Id":66925505,"Users Score":0,"Answer":"Because it seems that you are relatively new to the topic, I would propose that you start with an easier machine learning model for this simple classification task. Maybe for the first model a Logistic Regression could be enough.\nSo, you say you collected some samples of your own voice (your positve class), but did you also collect some negative samples from other people?\nAfter this, I would suggest to chunk the converted samples into equal siced sequences and label them (your voice or another?).\nNow with this as basis, you can test some easier models like the Logistic Regression or the KNN. You then might move forward to some simple Feed-Forward-Neural-Networks and then go on to some advanced models like CNN's or RNN's.","Q_Score":1,"Tags":"python,machine-learning,deep-learning,conv-neural-network,classification","A_Id":66926217,"CreationDate":"2021-04-02T21:34:00.000","Title":"CNN classified only one variable if it is true or false","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":1},{"Question":"If I send out a request to a user for them to reply to a yes or no question, how can I make it such that after a certain amount of time, the question expires and is no longer accepting replies?\nBackground\nI'm currently working on a discord.py bot, and I'm getting to the part where I start scanning the messages for user input. How it works is that somebody can challenge someone to a game of tic tac toe, and then the challenged person has 10 seconds to reply with yes or no. How can I make it such that after 10 seconds, the challenge expires?\nExamples\nOne example I thought of is the bot Dank Memer. If you challenge someone to a tic tac toe game on there, then the challenged person has to respond to you within a time limit, or else the challenge expires. It also works with commands like pls trivia, where after 10 seconds it stops accepting answers to the question.\nI'm pretty sure that people have already asked this question, but I have looked over and over on Google and I can't find a solution. It's probably because of my wording, I think.\nIt's also hard for me to do a minimal-reproducible example, as that would require you guys to have to create a discord account and token for the bot, which is not at all efficient.","AnswerCount":3,"Available Count":1,"Score":0.1325487884,"is_accepted":false,"ViewCount":279,"Q_Id":66926822,"Users Score":2,"Answer":"You can use a await client.wait_for(check=check). Check is a function you must define that needs to return either true or false. Within check, you can add various conditions and actions if you need to. I made a command that does a math equation with it, if you'd like to see an example.","Q_Score":1,"Tags":"python,discord,discord.py","A_Id":66926879,"CreationDate":"2021-04-03T00:54:00.000","Title":"Is there a way to make it such that the user must answer within a time limit on discord.py?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Is there a way to display a list of the widgets or the items inside a list view? the items were also added by buttons, then next thing that i want to do is to display a list of the added items in another screen? how would i do this?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":93,"Q_Id":66926981,"Users Score":0,"Answer":"You can provide an id to your ListView and later on access it in your code where you want it. After accessing ListView you can just call lstvw.children (assuming you accessed it as lstvw). It will provide you list of all the children.","Q_Score":0,"Tags":"python,python-3.x,kivy,kivy-language,kivymd","A_Id":66940104,"CreationDate":"2021-04-03T01:29:00.000","Title":"Displaying a list of all the items\/widgets inside a ListView Kivy\/KivyMD","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I would think it's obvious that it should uninstall all packages when removing an environment, since how would they be accessed otherwise, but I haven't seen documentation saying so, so I'm checking here if all packages need to be removed first.","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":1349,"Q_Id":66932971,"Users Score":1,"Answer":"The conda environment will be deleted. Sometimes some packages stay behind, although they are not bound to any environment. You can delete these under\n<your anaconda folder> -> envs -> <the env you deleted>.","Q_Score":5,"Tags":"python,anaconda,conda","A_Id":66934267,"CreationDate":"2021-04-03T15:41:00.000","Title":"If I remove a conda environment will it automatically remove all packages?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am planning to use a same user model for two different users with some additional fields in one model. Is it possible to do this in Django? If it is possible, how can I do it?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":42,"Q_Id":66943719,"Users Score":0,"Answer":"You have two options :\nFirstly\nYou create a new Model (call it ExtendedUser) and you put the extra fields in that model.\nYou then set your ExtendedUser model to inherit from your MainUser model. This will create two tables with a one to one link between them.\nThe advantage of this is that your ExtendedUser model will inherit any methods defined in your original MainUser model, and you only need add methods to the ExtendedUser model if you absolutely have to. You can also write functions which can deal with both the MainUser and ExtendedUser models easily, since they are all instances of the MainUser model. One of the benefits of using inhertiance is if you write a query on the ExtendedUser model fetching all fields, it well fetch the MainUser fields too.\nA Second (worse) option :\nHave a single extended model with a flag on it which says whether to use the extra fields. This can be made to work, but will make your queries more complex, and if you need the extra fields to be indexed, the indexes are likely to be a bit less efficient.\nNote : having a second table with a relationship between the two is no bad thing in SQL - that is how data is normally managed. Having special optional fields for some types of users isn't great as mentioned.","Q_Score":0,"Tags":"python,django,authentication","A_Id":66943833,"CreationDate":"2021-04-04T16:55:00.000","Title":"Different user with more fields in the same model in Django","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I've tried conda install -c anaconda boost and I get the error fatal error C1083: Cannot open include file: 'boost\/python.hpp': No such file or directory. I've added the boost download to the system and user paths, I've followed the direction on how to install boost python on Windows. What am I missing? What else can I do? I get the same error regardless of what I try.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":395,"Q_Id":66959565,"Users Score":0,"Answer":"My answer comes quite late, but I hope it will be of use for other people. In fact the arborescence has changed in an update\nfor instance in my case with Anaconda\n\nin the 1.67 version , python.hpp is in \\anaconda3\\envs\\myenv\\Library\\include\\boost\nin newer version (tested with 1.73) ,  python.hpp is in \\anaconda3\\envs\\myenv\\Library\\include\\boost\\python which prevents it from encountering it\n\nYou can either modify the path referencing these files or install the version that works","Q_Score":0,"Tags":"python,boost","A_Id":68359174,"CreationDate":"2021-04-05T20:44:00.000","Title":"How to install boost python on anaconda with windows 10","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"I'm using Pygame.midi and you can select from 127 instruments.\nI want to know how I can change\/add midi instruments to this list.\nIs there a list of pygame.midi instruments anywhere and if not what libraries is pygame using to actually do midi?\nI've seen something called PortMidi and I'm wondering if this is what Pygame is using.\nI just want to know how I can access pygame.midi and add instruments.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":108,"Q_Id":66975443,"Users Score":1,"Answer":"Pygame is not providing the instruments.  It's just sending MIDI commands to your system's built-in synthesizer, usually part of your sound card.  MIDI allows for 127 instruments at a time.  There is a standard called \"General MIDI\" that tries to define a baseline of 127 instruments, and that's probably what your system is using.\nYou use \"sysex\" (system exclusive) messages to tell the synthesizer to change the instrument-to-channel assignments.  pygame supports that with the write_sys_ex command, but you have to know the internals of your synthesizer to know which commands to send.","Q_Score":1,"Tags":"python,pygame,midi,pyportmidi","A_Id":66975564,"CreationDate":"2021-04-06T19:39:00.000","Title":"How to access and change Pygame.midi?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm just picking up some async Python and trying to write a simple TCP port scanner using the Asyncio module.\nI can open a full-fledged TCP connection with 3-way handshakes via asyncio.open_connection. However, I want to create an SYN-ACK half-open connection\u2014similar to what nmap uses\u2014using asyncio. I was rummaging through the streams API but couldn't find anything. Is there a high-level method to do this? If not, how do I do this?","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":203,"Q_Id":66976054,"Users Score":1,"Answer":"asyncio doesn't give you such control on TCP\/IP stack layers and even hides some complex tasks such as callbacks, low-level protocols, transports.\nYou can do it using a raw socket.\nModules that can be useful\n\npython-nmap\nscapy","Q_Score":1,"Tags":"python,asynchronous,tcp,async-await,python-asyncio","A_Id":67002079,"CreationDate":"2021-04-06T20:30:00.000","Title":"Is there an easy way to do half open TCP connection via Python Asyncio?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm wondering how to install two different versions of a module for python. I host some scripts on a server and some particular ones require older version of the module because some things just doesn't work in the newer version and vice versa, some things doesn't work on the older version.\nI know i can use pkg_resources and require a certain version, but if i try to install and use another version it just replaces the other one.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":66,"Q_Id":66976414,"Users Score":2,"Answer":"Easiest solution would be to use virtual environments for one or both of your scripts. This is however not recommended in the long run if you want to scale and manage. You should switch up the script using the older version or move to something like a docker based solution.","Q_Score":1,"Tags":"python,pip,python-module","A_Id":66976513,"CreationDate":"2021-04-06T21:02:00.000","Title":"How to install different versions of modules for python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":1,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm new to Python and Pandas, and i'm struggling to create a frequency distribution table form my df.\nMy dataframe is something like this:\n\n\n\n\nBalances\nWeight\n\n\n\n\n10\n7\n\n\n11\n15\n\n\n12\n30\n\n\n13\n20\n\n\n10\n15\n\n\n13\n20\n\n\n\n\nedit: The balance numbers are its respective ID\nI need the frequency of each balance used (in this example, balance 10 would be 2 and so on) the min, max and mean of the measurements results.\nI was to use df.groupby(['balances']) but how can i use the results form using df.groupby to creat a new table? Is that the way?","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":573,"Q_Id":66988987,"Users Score":1,"Answer":"df.groupby(['balances']).count() should solve what you're looking for","Q_Score":2,"Tags":"python,pandas,frequency-distribution,frequency-table","A_Id":66989052,"CreationDate":"2021-04-07T15:12:00.000","Title":"Creating a frequency distribution table in Python","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have documents in different MongoDB databases referencing each other (mongoengine's LazyRefereneceField), so each time I need to get the field's value, I need to connect and disconnect from the field's relevant database, which I find very inefficient.\nI've read about connection pooling, but I can't find a solution on how to implement it using MongoEngine. How can I create a connection pool and reuse connections from it every time I need to the value for a LazyReferenceField?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":366,"Q_Id":66989859,"Users Score":0,"Answer":"MongoEngine is managing the connection globally (i.e once connected, it auto-magically re-use that connection), usually you call connect just once, when the application\/script starts and then you are good to go, and don't need to interfere with the connection.\nLazyReferenceField is not different from any other field (ReferenceField, StringField, etc) in that context. The only difference is that it's not doing the de-referencing immediatly but only when you explicitly request it with the .fetch method","Q_Score":0,"Tags":"python-3.x,mongodb,connection-pooling,mongoengine","A_Id":66993289,"CreationDate":"2021-04-07T16:04:00.000","Title":"Use connection pool with MongoEngine","Data Science and Machine Learning":0,"Database and SQL":1,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I salute all brethren here. Please I was tasked by my superior in a pharmacy outlet to generate barcode taking into consideration drug's country of origin ID or code, supplier code, product code and product classification as in pain killer etc. All these must be serialize into a readable barcode. So it means this must link to a database. Please brethren, how do I go about this in python kivy?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":43,"Q_Id":67000886,"Users Score":0,"Answer":"Too opened question I think ?\nYou encapsulate:\n\nInstall kivy\nWrite your program\nDeploy it\n\nI suppose you want to focus on how to program it and you will manage to learn how to install and deploy it.\nI suppose that you want to use the phone's camera to analyse the barcode.\nI have an application that need to take photos and analyze the text on it to write it in a form. I didn't manage to make it work personnaly. Try to know if the kivy cam is \"stable enough\" to allowed saving\/loading\/real_time_analyze on Android.\nIf you manage to make your camera work, you will need to focus on the analyse of the barcode. I think that you can reuse working library and use it on your application (or on a AWS lambda as a micro-service).","Q_Score":0,"Tags":"python,kivy,barcode","A_Id":67004327,"CreationDate":"2021-04-08T09:14:00.000","Title":"Barcode with kivy","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm trying to find the correlation between categorical and numerical columns in my dataset using Python, can anyone help?\nHere is the data that I have.\nThank you in advance.\n\n\n\n\nLight_Sensor_Reading\nLight_Sensor_Status\n\n\n\n\n231\nDim\n\n\n231\nDim\n\n\n231\nDim\n\n\n231\nDim\n\n\n231\nDim\n\n\n231\nDim\n\n\n231\nDim\n\n\n231\nDim\n\n\n231\nDim\n\n\n232\nDim\n\n\n950\nVery_bright\n\n\n988\nVery_bright\n\n\n987\nVery_bright\n\n\n986\nVery_bright\n\n\n986\nVery_bright\n\n\n986\nVery_bright\n\n\n986\nVery_bright\n\n\n986\nVery_bright\n\n\n986\nVery_bright\n\n\n986\nVery_bright\n\n\n986\nVery_bright\n\n\n986\nVery_bright\n\n\n986\nVery_bright\n\n\n985\nVery_bright\n\n\n985\nVery_bright","AnswerCount":4,"Available Count":1,"Score":0.049958375,"is_accepted":false,"ViewCount":5742,"Q_Id":67021061,"Users Score":1,"Answer":"it doesn't mean anything to calculate the correlation between two variables if they are not quantitative.\nI think what you want to do is to study the link between them.\nThe purpose is to explain the first variable with the other one through a model.\nYou can use the logistic regression.\nBut you will only know if there is a link between these two variables with a T-Test or a wilcoxon test depending on the normality of the data","Q_Score":2,"Tags":"python,correlation","A_Id":67024223,"CreationDate":"2021-04-09T12:20:00.000","Title":"how to find the correlation between categorical and numerical columns","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"When I run time.mktime(datetime.strptime(\"2012-03-09\", \"%Y-%m-%d\").timetuple())\nI get the value 1331251200.0.\nNow I want to know how can I invert this? So if I pass in 1331251200.0, how do I get as output 2012-03-09? I know strftime is the inverse of strptime, but I don't see how to invert the whole thing because of the timetable function.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":31,"Q_Id":67029057,"Users Score":0,"Answer":"So the way to do this is by time.strftime(\"%Y-%m-%d\", time.localtime(time.mktime(datetime.strptime(\"2012-03-09\", \"%Y-%m-%d\").timetuple()))).\nI didn't know strftime would turn the timetable to a string before I asked.","Q_Score":0,"Tags":"python,datetime,python-datetime","A_Id":67029130,"CreationDate":"2021-04-09T22:35:00.000","Title":"How do I find the date string from the numeric value?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am unfamiliar with the instaboy.py python package. I am wondering if there are any security issues with this package like possibly getting information leaked. I am wondering how does the API work if there are a lot of people using this package. Wouldn't you need your own personal Instagram API token? I am confused by the whole concept and if anyone could explain even just a little bit it will be much appreciated.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":427,"Q_Id":67041693,"Users Score":0,"Answer":"Bots are now easily detected by Instagram. Your account could be banned for 3 days, 7 days, 30 days or definitively if Instagram detects too many attempts\nUsually bots simulate a browser via Sellenium and then create a \"browse like a human\" bot to create likes, follow, unfollow, etc.","Q_Score":0,"Tags":"python,api,instagram-api,facebook-access-token,instagram-graph-api","A_Id":67127196,"CreationDate":"2021-04-11T05:16:00.000","Title":"Is instabot.py safe to use?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I would like to programatically delete image placeholders which are full (PlaceholderPicture objects in the python-pptx API)\nand replace them with empty ones (PicturePlaceholder), the goal being to \"refresh\" pictures instead of always having to fill out an empty presentation.\nI think I know how to delete a shape, but creating a new PicturePlaceholder proves harder than expected.\nWhen I try to create one I am asked to provide a sp and a parent and I cannot find in the documentation what these parameters refer to.\nDoes my approach make sense, and if so is it possible to create new placeholders programmatically? Could anyone explain what are the parameters I should pass to the constructor?\nThanks in advance.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":100,"Q_Id":67054615,"Users Score":0,"Answer":"python-pptx has no API support for this, which means you would need to directly manipulate the underlying XML of the slide to accomplish it (and be outside the python-pptx \"safety net\").\nsp is the shape element (generally an <p:sp> element, hence the name) and parent would be a reference to the slide.\nAs a general approach, I would create an empty placeholder and compare its XML to that of a \"filled\" placeholder which is the same in every respect. Then the job is to make one into the other.\nNote that a picture placeholder has a relationship to the \"image part\" (e.g. PNG file) stored elsewhere in the PPTX package (.pptx file). This will need to be dealt with and not left dangling.\nAnother possibility is just to swap the image and leave everything else in place, which on paper at least would be less disruptive.\nBecause none of these options has API support, pursuing them involves taking on responsibility for a lot of details that python-pptx takes care of for you and learning a fair amount about the internals. If that sounds like something you'd rather avoid then you'll want to find another way to accomplish the broader outcome you have in mind.","Q_Score":0,"Tags":"automation,powerpoint,python-pptx","A_Id":67062581,"CreationDate":"2021-04-12T07:59:00.000","Title":"How can I replace a full image placeholder by an empty one?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":1,"ERRORS":0,"REVIEW":0},{"Question":"I use the below statement, extracting cell content as legend name (I have 3 set of values to plot on y-axis, thus need 3 legend parameters)\nplt.legend(df.iat[0, 0], df.iat[0, 1], df.iat[0, 2])\nthe compiled error says that 'legend only accepts two non-keyword arguments'\nI print out the df.iat[0, 0], df.iat[0, 0], df.iat[0, 0], all these 3 are the cell content I expect.\nAnyone know how I can fix it?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":316,"Q_Id":67055120,"Users Score":0,"Answer":"You have to put the values in a list:\nplt.legend([df.iat[0, 0], df.iat[0, 1], df.iat[0, 2]])","Q_Score":0,"Tags":"python,pandas,csv,matplotlib","A_Id":67055221,"CreationDate":"2021-04-12T08:34:00.000","Title":"pandas plt.legend issue. error says that 'legend only accepts two non-keyword arguments'","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"Is a very simple page, that have some buttons redirecting to external links. That external links have to change arbitrarely when certain people decides it.\nI was wondering about making a login screen in other page and depending which user logs in, set the link writting it in a txt file that would be recovered by the main page. Don't need security so i just would make the user go to the other page and login and that would change the link in a txt file hosted in the same directory that the index.html is.\nThe problem is that i cannot make that idea (writing a .txt in the project folder) with JavaScript (or i think so), and i don't think that using a database worth it (neither want to because i read that would have to use node.js or something like that and i really don't know those tecnologies, only some python and sql server -that is in fact not supported by my hosting service-), cause are just 3 people associated to 1 link each. I can easily make that task with python but don't know how to call it from JS and neither if Ajax request would be useful for this case.\nI hope someone can help me!\nedit - the changes have to apply for the page itself not in the user session, so everyone who enters see the page with the changes\nedit 2 - absolutely all the info (users and links) are always the same, doesnt change so i can put it in variables, are just 4 or 5 so i can easily use an array, the only thing that i would have to register is which one to pick (since it depends on who decides it).","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":31,"Q_Id":67057096,"Users Score":0,"Answer":"IT seems you want to use some sort of client side storage across different html pages - for that, you can use cookies, localSotrage or sessionStorage.","Q_Score":0,"Tags":"javascript,python,html,css","A_Id":67057191,"CreationDate":"2021-04-12T10:52:00.000","Title":"How can I make an one-user input have consequences in the behaviour of all page?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Today I faced a problem regarding pip3 in Ubuntu. Ubuntu comes with python 3.8 but I wanted to use latest versions of python, like 3.9 or maybe 3.10. So I installed it using 'ppa:deadsnakes' repository and also installed pip. But the problem is I want to use pip in python 3.9 instead of version 3.8. So I changed the default python version to 3.9 and everything crashed.\nSo reverted to python 3.8. Whenever I install some package it gets installed using python 3.8.\nHelp me, how can I use python 3.9 pip and install packages in python 3.9 without changing the default version.\nAny help is appreciated.\n--> Thing I want is that when I want to install python package using\npip3 install <package_name> it must install in python3.9 and not in python3.8","AnswerCount":4,"Available Count":3,"Score":0.0,"is_accepted":false,"ViewCount":7823,"Q_Id":67059399,"Users Score":0,"Answer":"you can use pip for python3.9 by pip3.9 install <package-name>","Q_Score":2,"Tags":"python,python-3.x,ubuntu-20.04","A_Id":67059454,"CreationDate":"2021-04-12T13:35:00.000","Title":"How to use pip for python 3.9 instead of inbuilt python 3.8 in Ubuntu?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":1,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Today I faced a problem regarding pip3 in Ubuntu. Ubuntu comes with python 3.8 but I wanted to use latest versions of python, like 3.9 or maybe 3.10. So I installed it using 'ppa:deadsnakes' repository and also installed pip. But the problem is I want to use pip in python 3.9 instead of version 3.8. So I changed the default python version to 3.9 and everything crashed.\nSo reverted to python 3.8. Whenever I install some package it gets installed using python 3.8.\nHelp me, how can I use python 3.9 pip and install packages in python 3.9 without changing the default version.\nAny help is appreciated.\n--> Thing I want is that when I want to install python package using\npip3 install <package_name> it must install in python3.9 and not in python3.8","AnswerCount":4,"Available Count":3,"Score":0.1488850336,"is_accepted":false,"ViewCount":7823,"Q_Id":67059399,"Users Score":3,"Answer":"Hello everyone I fixed my issue.\nThe problem is we cannot override default python version in Ubuntu as so many things depend on it.\nSo I just made an alias as : alias pip3='python3.9 -m pip' and alias for python : alias python3='\/usr\/bin\/python3.9'\nIf anyone face this issue please do what I specify and you will be good to go.\nNow all my packages are being installed in python3.9.","Q_Score":2,"Tags":"python,python-3.x,ubuntu-20.04","A_Id":67078527,"CreationDate":"2021-04-12T13:35:00.000","Title":"How to use pip for python 3.9 instead of inbuilt python 3.8 in Ubuntu?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":1,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Today I faced a problem regarding pip3 in Ubuntu. Ubuntu comes with python 3.8 but I wanted to use latest versions of python, like 3.9 or maybe 3.10. So I installed it using 'ppa:deadsnakes' repository and also installed pip. But the problem is I want to use pip in python 3.9 instead of version 3.8. So I changed the default python version to 3.9 and everything crashed.\nSo reverted to python 3.8. Whenever I install some package it gets installed using python 3.8.\nHelp me, how can I use python 3.9 pip and install packages in python 3.9 without changing the default version.\nAny help is appreciated.\n--> Thing I want is that when I want to install python package using\npip3 install <package_name> it must install in python3.9 and not in python3.8","AnswerCount":4,"Available Count":3,"Score":1.0,"is_accepted":false,"ViewCount":7823,"Q_Id":67059399,"Users Score":6,"Answer":"You don't need to install pip separately\nYou should be able to refer to it as such\npython3.9 -m pip install","Q_Score":2,"Tags":"python,python-3.x,ubuntu-20.04","A_Id":67059447,"CreationDate":"2021-04-12T13:35:00.000","Title":"How to use pip for python 3.9 instead of inbuilt python 3.8 in Ubuntu?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":1,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I made a sample app that just says hello world with kivy and I am trying to put it on an android tablet I bought.\nI used a virtual machine (Virtual box) and use bulldozer to loaded to the tablet. However when I run it the terminal just prints in a loop\n#waiting for the application to start\nany idea on what could be the problem, or how can I start the application","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":1169,"Q_Id":67081236,"Users Score":0,"Answer":"I had trouble with this too. But if it runs that far then it should've successfully compiled the .apk. It should be in the same folder that you ran the buildozer command. You can even run an HTTP server with buildozer serve and access it via localhost:THE_PORT_NUMBER_HERE. Then you can just transfer or download the .apk to your device. And then install and run it after accepting the correct permissions.","Q_Score":1,"Tags":"python,kivy,kivy-language,buildozer,kivymd","A_Id":71406743,"CreationDate":"2021-04-13T19:27:00.000","Title":"kivy app in adroid with buildozer, terminal loops on \"#waiting for application to start\"","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I made a sample app that just says hello world with kivy and I am trying to put it on an android tablet I bought.\nI used a virtual machine (Virtual box) and use bulldozer to loaded to the tablet. However when I run it the terminal just prints in a loop\n#waiting for the application to start\nany idea on what could be the problem, or how can I start the application","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":1169,"Q_Id":67081236,"Users Score":0,"Answer":"Make sure you have enabled developer mode on the phone, the phone must be plugged in to the VM (In VirtualBox: Devices -> USB -> {phone}) and that the screen is unlocked.\nOn the phone you should see a \"USB debugging connected\" notification when it's plugged in.\nIf the phone is properly connected, you'll see it in Android Studio in a number of places, including the LogCat and right at the top of the screen in a little dropdown to the left of the run button.\nLastly, you can run the app manually and then connect the debugger if you want. Just run the app on the phone, then click the little icon in the top right with the green bug with an arrow over it.","Q_Score":1,"Tags":"python,kivy,kivy-language,buildozer,kivymd","A_Id":67081320,"CreationDate":"2021-04-13T19:27:00.000","Title":"kivy app in adroid with buildozer, terminal loops on \"#waiting for application to start\"","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am developing a code using python and Django for web scraping. I have provided the required url and already fetched the data.\nBut there is a tab on the url saying \"show more results\".\nHow can I make my Django project to click on that tab of \"show more results\" on the url and the fetch the new results now.\nI have used Beautiful Soup library for web scraping\/","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":25,"Q_Id":67103986,"Users Score":0,"Answer":"BeautifulSoup is an HTML parser and nothing more, if you want to automate clicking and so on you have to use other tools such as selenium.\nAnother idea might be getting the URL of \"Show more results\" and scrape the stuff that it loads. I assume it is loading the thing dynamically so look at your Network Tab (Ctrl+Shift+i then Network) and see which URL it is loading you may be able to scrape it.","Q_Score":0,"Tags":"python,python-3.x","A_Id":67104104,"CreationDate":"2021-04-15T07:22:00.000","Title":"how to make django project click on a particular tab of a url","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am trying to scrape information off of a website (on Chrome) where I need to click on each subpage to get the information I need. After about 7, I get blocked by the website. I think if I was able to switch IPs either each time or once I get blocked, that would work.\nI am using Selenium to open the site and navigate to the subpages. I have tried using a try-catch block so far and a while loop but I am getting errors I do not know how to address.\nDoes anyone have an alternative approach or previous success doing this?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":292,"Q_Id":67111892,"Users Score":0,"Answer":"You can use rotating proxies to change your IP per request or with a time interval but If you don't want to use any proxy you can restart your router to get a new IP address from your ISP but If you have a static IP from your ISP even through you restar your router your IP will stay the same.","Q_Score":2,"Tags":"python,python-3.x,selenium-webdriver,web-scraping,ip-address","A_Id":67113586,"CreationDate":"2021-04-15T15:57:00.000","Title":"In python with selenium, how do you rotate IP addresses?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":1},{"Question":"I'm doing a segmentation task. Now I successfully segmented the area of interest and find the contour of the area. How can I calculate the min\/max axis length of the contour? The axis does not have to be orthogonal.\nWhat I already got are:\ncoordinates of points on the contour.\ncentroid of the contour.\nWhat I already tried:\nI have found a fitting-ellipse of the contour. However, fitting-ellipse can only find the orthogonal axis which might not be the minimum or maximum length across the centroid.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":58,"Q_Id":67118098,"Users Score":0,"Answer":"Since you already have the contour, you might want to do this:\nfor alpha = 0 to 45 degrees, rotate the contour by alpha, draw a line over the centroid of your contour that is parallel to X-axis, find out the intersection points of this line and the contour, that is one \"axis\" at current angle alpha. continue rotating the contour and find more of such \"axis\", find the longest one as your max axis, shortest one as your min axis.","Q_Score":0,"Tags":"python,geometry,medical-imaging","A_Id":67711250,"CreationDate":"2021-04-16T01:53:00.000","Title":"how to find min\/max axis length across the centroid of a closed curve","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm working on a Python application where the desired functionality is that the webcam is used to take in a live video feed and based on whether a condition is true, an image is clicked and uploaded to a database.\nThe database I am using is MongoDB. As far as I can understand, uploading images straight-up to a database is not the correct method. So, what I wanted to do is the following:\n\nan image is clicked from the webcam\nthe image is uploaded to an S3 bucket (from the same Python script, so using boto3 perhaps)\na URL of the uploaded image is retrieved (this seems to be the tricky part)\nand then this URL along with some other details is uploaded to the database. (this is the easy part)\n\nMy ideal workflow would be a way to take that image and upload it to an S3 bucket, retrieve the URL and then upload this URL to the database all in one .py script.\nMy question is: how do I upload an image to an S3 bucket and then retrieve its public URL all through boto3 in a Python script?\nI also welcome any suggestions for a better approach\/strategy for storing images into MongoDB. I saw on some pages that GridFS could be a good method but that it is not recommended for the image uploads happening frequently (and really that using AWS is the more preferable way).","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":302,"Q_Id":67120896,"Users Score":1,"Answer":"You don't need to 'retrieve' the public url, you get to specify the bucket and name of the s3 object when you upload it, so you already have the information you need to know what the public url will be once uploaded, its not like s3 assigns a new unique name to your object once uploaded.","Q_Score":0,"Tags":"python,mongodb,amazon-web-services,amazon-s3,boto3","A_Id":67125119,"CreationDate":"2021-04-16T07:29:00.000","Title":"How to upload an image to MongoDB using an S3 bucket and Boto3 in Python","Data Science and Machine Learning":0,"Database and SQL":1,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"since i couldn't find the best way to deal with my issue i came here to ask..\nI'm a beginner with Python but i have to handle a large dataset.\nHowever, i don't know what's the best way to handle the \"Memory Error\" problem.\nI already have a 64 bits 3.7.3 Python version.\nI saw that we can use TensorFlow or specify chunks in the pandas instruction or use the library Dask but i don't know which one is the best to fit with my problem and as a beginner it's not very clear.\nI have a huge dataset (over 100M  observations) i don't think reducing the dataset would decrease a lot the memory.\nWhat i want to do is to test multiple ML algorithms with a train and test samples. I don't know how to deal with the problem.\nThanks!","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":61,"Q_Id":67126819,"Users Score":0,"Answer":"This question is high level, so I'll provide some broad approaches for reducing memory usage in Dask:\n\nUse a columnar file format like Parquet so you can leverage column pruning\nUse column dtypes that require less memory int8 instead of int64\nStrategically persist in memory, where appropriate\nUse a cluster that's sized well for your data (running an analysis on 2GB of data requires different amounts of memory than 2TB)\nsplit data into multiple files so it's easier to process in parallel\n\nYour data has 100 million rows, which isn't that big (unless it had thousands of columns).  Big data typically has billions or trillions of rows.\nFeel free to add questions that are more specific and I can provide more specific advice.  You can provide the specs of your machine \/ cluster, the memory requirements of the DataFrame (via ddf.memory_usage(deep=True)) and the actual code you're trying to run.","Q_Score":0,"Tags":"python,pandas,tensorflow,out-of-memory,dask","A_Id":69481669,"CreationDate":"2021-04-16T14:12:00.000","Title":"Import and work with large dataset (Python beginners)","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":1},{"Question":"I am tinkering with redis and mysql to see how caching can improve performance. Accesing data from Cache is\/should be faster than accessing it from database.\nI calculated the time required for both the case in my program and found out that accesing from cache was much slower than accesing from the database . I was\/am wondering what might be the cause(s).\nSome points to consider:\n\nI am using Azure Redis Cache.\nThe main application is on VM instance.\nI hosted MYSQL server on another VM instance.\nThe table is very small with 200-300 records.\nThere is no error in the time calculation logic.\n\nEDIT:\nLoad time for cache=about 1.2s\nLoad time for mysql= about 15ms\nTurns out my application and MySQL server were in a same region while the redis cache was in a different region across the globe causing much higher latency.\nBut I would still want someone to explain why the fetch time for sql was much more smaller.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":218,"Q_Id":67141393,"Users Score":0,"Answer":"If the table of 200-300 rows is fully cached in MySQL's \"buffer_pool\", then it won't take much time to fetch all of them and send them back to the client.  15ms is reasonable (though it depends on too many things to be more specific).\nIf you are fetching 1 row, and you have an index (esp, the PRIMARY KEY) to locate that one row, I would expect it to be even faster than 15ms.\nI'm summarizing a 40K-row table; it is taking under 2ms.  But note: client and server are on the same machine.  15ms could represent the client and server being a few hundred miles apart.\nHow long does a simple SELECT 1 take?  That will give you a clue of the latency, below which you cannot go without changing the physical location of machines.","Q_Score":0,"Tags":"mysql,redis,mysql-python,mysql-connector","A_Id":67152749,"CreationDate":"2021-04-17T18:02:00.000","Title":"Accessing Cache Slower than Accessing Database","Data Science and Machine Learning":0,"Database and SQL":1,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":1},{"Question":"Currently, I have two python bots running on VDS, both of them are using selenium and running headless chrome to get dynamically generated content. While there was only one script, there was no problem, but now, it appears that the two scripts fight for the chrome process (or driver?) and only get it once the other one is done.\nHave to mention, that in both scripts, Webdriver is instantiated and closed within a function, that itself is ran inside a Process of multiprocessing python module.\nRunning in virtual environment didn't do anything, each script has their own file of chrome driver in their respective directories, and by using ps -a I found that there are two different processes of chromedriver running and closing, so I am positive that scripts aren't using the same chrome. \nSometimes, the error says \"session not started\" and sometimes \"window already closed\".\n\nMy question is - how do I properly configure everything, so that the scripts don't interfere with each other?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":47,"Q_Id":67144301,"Users Score":0,"Answer":"For anyone having the same problem - double-triple-quadriple-check that the function, that you're passing in the Process, is the one instantiating Webdriver. I can't believe this problem is fixed just like that.","Q_Score":2,"Tags":"python,selenium,selenium-webdriver,python-multiprocessing,ubuntu-18.04","A_Id":67184590,"CreationDate":"2021-04-18T00:50:00.000","Title":"How to manage several selenium scripts running at once on VDS?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"I'm new to LDA and I want to calculate the topic similarity between words. Can I get the topic distribution of a word? If so, how can I do this in gensim.ldamodel?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":92,"Q_Id":67148633,"Users Score":0,"Answer":"Gensim's LDA mallet wrapper has a load_word_topics() function (I would assume this is true for its python LDA implementation as well).  It returns a matrix that is words X topics.  From that, you can get a vector of frequencies each word in each topic.  That would be the topic-word distribution for a given word.","Q_Score":0,"Tags":"python,gensim,lda,topic-modeling","A_Id":67153031,"CreationDate":"2021-04-18T12:40:00.000","Title":"Can I get topics distribution of a word in LDA?","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have a template where I'm showing with a 'for' my elements, and those elements have a Edit button, so what I want to do, is when the user clicks edit, a pop up appears with the form and the information of that item.\nSo I don't know how to do that:(","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":29,"Q_Id":67154813,"Users Score":0,"Answer":"so if you are using Javascript in your template then you can get the row index of clicked button and then get information from there and bind it to your popup.","Q_Score":1,"Tags":"python,django,popup","A_Id":67154916,"CreationDate":"2021-04-19T01:04:00.000","Title":"How can I pass information from an item to a Modal in django to edit it?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I would like to know how to get the first message in a channel.\nBut more preferably could you point me to the part of the documentation that explains this, please?","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":511,"Q_Id":67154885,"Users Score":2,"Answer":"TextChannel has a history method.\nIf you type await channel.history() you can get all messages in that text channel. But this starts from last message. To start from first message, use oldest_first=True in method. Also you can limit the amount of message with a keyword argument limit.","Q_Score":0,"Tags":"python,python-3.x,discord,discord.py","A_Id":67155078,"CreationDate":"2021-04-19T01:17:00.000","Title":"How to get the first message in a channel","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I work on one project in that code in python script.py and with help of pyinstaller build exe file but issue is that I want to add publisher name in exe file. FREE\nexe with publisher name\nI browse on google but I do not get a solution.\n\ni don't have a code sign certificate.\nI don't have a signtool\ni don't know how to connect a self sign certificate with an exe file.\n\nPlease guide me.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1068,"Q_Id":67162747,"Users Score":0,"Answer":"There is no way to do this for free.  If you want to sign your executables, you will need to buy a code-signing certificate and use signtool to sign them.  Code signing certificates cost about $300 per year.  signtool is part of the Windows SDK; you can get it in the free \"community\" editions of Visual Studio.","Q_Score":0,"Tags":"python,windows-installer,pyinstaller,signtool","A_Id":67173656,"CreationDate":"2021-04-19T13:14:00.000","Title":"how to add Publisher Name in Pyinstaller exe file","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Please can you provide an example of how this can used in a python notebook environment with docplex. I see examples with java on ATSP problem. The point is I do not know how to create these cuts upfront. Given a LP root node, I can generate the cut. So, \"add_user_cut_constraint(cut_ct, name=None)\" should in a way take in as input the root node. How do I retrieve that in a generic way?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":73,"Q_Id":67163382,"Users Score":0,"Answer":"Look at this code in my contribs repository:\nhttps:\/\/github.com\/PhilippeCouronne\/docplex_contribs\/blob\/master\/docplex_contribs\/src\/cut_callback.py\nIt is not a notebook, but you'll get the idea on how to interface callbacks with Docplex.","Q_Score":0,"Tags":"python,jupyter-notebook,docplex","A_Id":67165020,"CreationDate":"2021-04-19T13:54:00.000","Title":"Examples in docplex to use the user cut callback method technology","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"OOBPermutedVarDeltaError states that\n\nFor any variable, the measure is the increase in prediction error if the values of that variable are permuted across the observations. This measure is computed for every tree, then averaged over the entire ensemble and divided by the standard deviation over the entire ensemble\n\nTo find its equivalent would I need to calculate the increase in prediction error across observations and then average it across the entire ensemble? Being fairly new to ML, I am not sure how I would implement it even. Any help would be most appreciated.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":26,"Q_Id":67172243,"Users Score":0,"Answer":"No, there arent any. Python and Matlab, does not scale 1:1","Q_Score":1,"Tags":"python,matlab","A_Id":72350666,"CreationDate":"2021-04-20T03:57:00.000","Title":"Is there any python equivalent of OOBPermutedVarDeltaError from Matlab?","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"recently I made a little program that generates a country with a bit of info, like the country name, size and most importantly cities.\nIt generates a random number of cities and towns and villages based on the country's size, this is all text based so that is why I would give it a nice flare with some graphics.\nNow, I have been researching a bit and it seems that my best option would be Perlin noise or some form of noise, so my question is, how would I go about doing this? Where do I start? Are there other ways of accomplishing this?\nSo, in short, how do I take the randomly generated text cities and towns and villages in my program and randomly generate them on some form of map? I hope this all makes sense. Also, my program is written in python.","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":181,"Q_Id":67176945,"Users Score":1,"Answer":"There is lots of problem in what you saying. What platform are you using? Arcade? PyGame? etc. I will write the arcade code for you so you can use. To use arcade, type pip install arcade in Windows, or pip3 install arcade on Linux.\nEdit:\nPlease can you post your code so I can implement?","Q_Score":0,"Tags":"python,noise","A_Id":67177343,"CreationDate":"2021-04-20T10:17:00.000","Title":"How would I go about generating cities and countries with perlin noise?","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I would like to generate some data (position of the snake, available moves, distance from the food...) to create a neural network model so that it can be trained on the data to play the snake game. However, I don't know how to do that. My current ideas are:\n\nPlay manually (by myself) the game for many iterations and store the data (drawback: I should play the game a lot of times).\nMake the snake do some random movements track and track their outcomes.\nPlay the snake with depth-fist search or similar algorithms many times and store the data.\n\nCan you suggest to me some other method or should I choose from one of those? Which one in that case?\nP.S. I don't know if it is the right place to ask such a question. However, I don't know whom\/where to ask such a question hence, I am here.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":109,"Q_Id":67177184,"Users Score":1,"Answer":"If using a neural network, start simple. Think inputs and outputs and keep them simple too.\nInputs:\n\nHow many squares to the left of the head are free\nHow many squares to the right of the head are free\nHow many squares forward of the head are free\nRelative position of next food left\/right\nRelative position of next food forward\/back\nLength of snake\n\nkeep inputs normalized to the minimum and maximum possible values to keep inputs in range -1.0 to 1.0\nOutputs:\n\nTurn Left\nTurn Right\nStraight Ahead\n\n(choose the output with highest activation)\nNext problem is training. Typical application might be use a genetic algorithm for all the weights of the above neural network. This randomizes and tests new versions of the neural network every life. After X attempts, create a new evolution and repeat to improve. This is pretty much doing random moves automatically (your second choice)\nNext problem is fitness for training. How do you know which neural network is better? Well you could simply use the length of the snake as a fitness factor - the longer the snake, the better and more 'fit'","Q_Score":0,"Tags":"python,neural-network,reinforcement-learning","A_Id":67346604,"CreationDate":"2021-04-20T10:33:00.000","Title":"Generate the data for A.I. to play the Snake game","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Is there a way to add a comment to an order's timeline via the REST API ?\nIf so, what's the scope access ? And how to do this.\nThanks","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":683,"Q_Id":67186251,"Users Score":2,"Answer":"You cannot add a comment to the timeline. You can see your App's interactions with an order on the timeline, exposed by Shopify, but you cannot inject stuff yourself. If you want to decorate an order with comments, you would add your comment to the order notes. That works fine, but as you can tell, it is not timestamped by Shopify, so it lacks an \"official\" standing... nonetheless. Just use Notes.","Q_Score":1,"Tags":"python,rest,shopify,shopify-api","A_Id":67187016,"CreationDate":"2021-04-20T20:56:00.000","Title":"Add comment to an order's timeline in Shopify","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"So in my table there are a number and a timestamp row, there are multiple numbers per day\nits like:\n\n\n\n\nnumber\ntimestamp\n\n\n\n\n3\n20.02.2021 16:05:00\n\n\n7\n20.02.2021 16:10:00\n\n\n20\n20.02.2021 16:15:00\n\n\n5\n21.02.2021 16:00:00\n\n\n\n\nnow i want the average of the numbers of the day of 20.02.2021 but i don't know how i should do that with SQLAlchemy\nany suggestions?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":38,"Q_Id":67194732,"Users Score":0,"Answer":"Not sure if this will fully answer your question, but to get just the date portion of a timestamp you can recast the timestamp as date by:\nselect your_timestamp_column::date","Q_Score":0,"Tags":"python,postgresql,flask,sqlalchemy","A_Id":67195487,"CreationDate":"2021-04-21T11:13:00.000","Title":"How to query only the date in a timestamp","Data Science and Machine Learning":0,"Database and SQL":1,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm trying to make a small data science tool (kinda like a mini version of WEKA). Now, I have these datasets that have large amounts of features (70-100+), and they're mostly categorical. I'm using Python sklearn for the Machine Learning logic and I need to convert these categories into numeric values according to the sklearn errors I've gotten.\nGiven this, One Hot Encoding isn't an option because it will enlarge the dimensionality too much.\nI've researched other ways that may work like frequency encoding, label encoding, etc. But I'm not really sure what to choose in my case.\nAlso, would anyone know how WEKA actually handles these? I inputted my datasets in WEKA and they worked fine, they gave me good results!\nAny help would be greatly appreciated. Thanks!","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":147,"Q_Id":67197522,"Users Score":0,"Answer":"That depends on the algorithm: Some handle categorical attributes natively, like J48 (Weka's C4.5 implementation), which performs multi-way splits on categorical attributes. Others have to convert the data, like SMO (support vector machine), which binarizes nominal attributes and increases the number of attributes to learn from.","Q_Score":0,"Tags":"python,machine-learning,scikit-learn,weka,categorical-data","A_Id":67203824,"CreationDate":"2021-04-21T14:07:00.000","Title":"What is the best way to encode a large number of categorical features?","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":1},{"Question":"I have a programming project in mind, but have only scratched the surface of my programming experience. I'm just about done with my first Python class, so that's about how much experience I have.\nNow my question, is it possible to read and recognize an image (business card\/playing card\/ image with text) and produce an operation based on the information read? The image would be at a distance, and I would be using a camera or xbox kinect.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":20,"Q_Id":67199323,"Users Score":0,"Answer":"yeah it's possible, you can train machine learning models.","Q_Score":3,"Tags":"python,image,image-processing","A_Id":67199350,"CreationDate":"2021-04-21T15:56:00.000","Title":"Recognizing images and incorporating into code","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm trying to create something and I don't know if it's possible or \"clean\" :\n\nFrom python, call function A of my C++ code to compute something complicated\nThe C++ code returns just the pointer to the python\nDo other things in python...\nFrom python, call function B of my C++ code, it takes the pointer and other things as arguments.\n\nI really don't need to use my complicated C++ class in my Python algorithm, that's why I just want to save the pointer in python.\nAnyone has any advice on how to do that ?\nEdit : In the end I wrapped the c++ class in python, thank you everyone.","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":66,"Q_Id":67227334,"Users Score":1,"Answer":"A pointer is just data that can be marshaled and sent to anything. It is however a very bad idea because when doing that, you have to assure that that pointer remains valid as long as the python part has the pointer. There is no possibility to check whether the pointer is still valid, so dereferencing a pointer that you receive from an external party could crash your program.\nA better idea in a lot of situations is to send a key to a table. When that key is sent back, it can be used to get the needed information from that table and it can be handled when the table doesn't have the key anymore. It is easiest to use std::map for the table. Of course, you could store the pointer in a container and check for that, but a string or number is easier to debug.","Q_Score":1,"Tags":"python,c++,cython","A_Id":67227563,"CreationDate":"2021-04-23T09:22:00.000","Title":"How save a C++ pointer in python to pass it again later?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm trying to create something and I don't know if it's possible or \"clean\" :\n\nFrom python, call function A of my C++ code to compute something complicated\nThe C++ code returns just the pointer to the python\nDo other things in python...\nFrom python, call function B of my C++ code, it takes the pointer and other things as arguments.\n\nI really don't need to use my complicated C++ class in my Python algorithm, that's why I just want to save the pointer in python.\nAnyone has any advice on how to do that ?\nEdit : In the end I wrapped the c++ class in python, thank you everyone.","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":66,"Q_Id":67227334,"Users Score":0,"Answer":"It would be better to create a class in C++ and store that pointer in the class itself as private. Then create function calls to access those pointers.\nOnce the class is implemented generate the .so file of your lib and import it in python. This way you can simply use your C++ code in python and also will not have to save the pointer.","Q_Score":1,"Tags":"python,c++,cython","A_Id":67227731,"CreationDate":"2021-04-23T09:22:00.000","Title":"How save a C++ pointer in python to pass it again later?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I can't figure out how to write regex that matches these:\n\neveryone hi\nhi everyone\nhi\n\nBut not this:\n\neveryone hi everyone\n\nThe regex (?:everyone )?hi(?: everyone)? will match the latter as well (which is not what I want). How to make such a regex? Or is it just not possible? I couldn't do enough research because I couldn't express the problem in correct words. Sorry if I posted a duplicate","AnswerCount":3,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":67,"Q_Id":67232268,"Users Score":3,"Answer":"You could explicitly make a regex for each case (the first will capture two), utilizing beginning and end of line tokens\n(^hi( everyone)?$)\n(^everyone hi$)","Q_Score":4,"Tags":"python,regex","A_Id":67232530,"CreationDate":"2021-04-23T14:57:00.000","Title":"Regex match no groups, 1st group OR 2nd group but not both. Something like 'NAND'","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"can anyone tell me how to fix this?\nModuleNotFoundError: No module named 'sklearn.linear_model._logistic'\nFile \"c:\\users\\chintan\\appdata\\local\\programs\\python\\python37\\lib\\site-packages\\streamlit\\script_runner.py\", line 332, in _run_script\nexec(code, module.dict)\nFile \"C:\\Users\\chintan\\Desktop\\streamlit\\Final_year_project\\App.py\", line 329, in \nmain()\nFile \"C:\\Users\\chintan\\Desktop\\streamlit\\Final_year_project\\App.py\", line 264, in main\nloaded_model = load_model(\"logistic_regression_hepB_model.pkl\")\nFile \"C:\\Users\\chintan\\Desktop\\streamlit\\Final_year_project\\App.py\", line 96, in load_model\nloaded_model = joblib.load(open(os.path.join(model_file),\"rb\"))\nFile \"c:\\users\\chintan\\appdata\\local\\programs\\python\\python37\\lib\\site-packages\\sklearn\\externals\\joblib\\numpy_pickle.py\", line 588, in load\nobj = _unpickle(fobj)\nFile \"c:\\users\\chintan\\appdata\\local\\programs\\python\\python37\\lib\\site-packages\\sklearn\\externals\\joblib\\numpy_pickle.py\", line 526, in _unpickle\nobj = unpickler.load()\nFile \"c:\\users\\chintan\\appdata\\local\\programs\\python\\python37\\lib\\pickle.py\", line 1088, in load\ndispatchkey[0]\nFile \"c:\\users\\chintan\\appdata\\local\\programs\\python\\python37\\lib\\pickle.py\", line 1376, in load_global\nklass = self.find_class(module, name)\nFile \"c:\\users\\chintan\\appdata\\local\\programs\\python\\python37\\lib\\pickle.py\", line 1426, in find_class\nimport(module, level=0)","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":131,"Q_Id":67235806,"Users Score":0,"Answer":"Try to install a version like: pip install scikit-learn==0.22","Q_Score":0,"Tags":"python,scikit-learn","A_Id":67241490,"CreationDate":"2021-04-23T19:24:00.000","Title":"getting an issue in sklearn.linear_model._logistic in ml","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am working on a project that just scrapes data from 3 devices (2xserial and 1xssh). I have this part implemented no problem.\nI am now heading towards the second part where I need be be able to send the data I need using protobuf to the clients computer where they will receive and display on their own client.\nThe customer has provided examples of their GRPC servers, and it's written in C#.\nCurrently, for security reasons, our system uses RedHat 8.3 and I am using a SSH Protocol Library called Paramiko for the SSH part. Paramiko is a Python library. Also the machine I am extracting data from only runs on Linux.\n\nHere are my main questions, and I apologize if I got nowhere.\n1.) The developer from the client side provided us with a VM that has a simulator and examples written in C# since their side was written in C#. He says that it's best to use the C# because all examples can be almost re-used as it's all written, etc. While I know it's possible to use C# in Linux these days, I've still have no experience doing so I don't know how complicated\/tedious this can get.\n2.) I write code in C# and wrap all the python code, which is also something I've never done, but I would be doing this all in RedHat.\n3.) I keep it in python because sending protobuf messages works across languages as long as it is sent properly. Also from the client side, I'm not sure if they will need to make adjustments if receiving protobuf messages written in Python(I don't think this is the case because it's just serialized messages, yea?).\nAny advice would be appreciated. I am looking to seek more knowledge outside my realm.\nCheers,\nZ","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":332,"Q_Id":67237330,"Users Score":0,"Answer":"If you're happy in Python, I would use option 3. The key thing is to either obtain their .proto schema, or if they've used code-first C# for their server: reverse-engineer the schema (or use tools that generate the schema from code). If you only have C# and don't know how to infer a .proto from that, I can probably help.\nThat said: if you want to learn some new bits, option 1 (using C# in your system) is also very viable.\nIMO option 2 is the worst of all worlds.","Q_Score":1,"Tags":"python,c#,protocol-buffers,grpc,redhat","A_Id":67240519,"CreationDate":"2021-04-23T22:05:00.000","Title":"GRPC: Sending messages from Python to C#, best method?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Python: how to get unique ID and remove duplicates from column 1 (ID), and column 3 (Description), Then get the median for column 2\n\n\n\n\nID\nValue\nDescription\n\n\n\n\n123456\n116\nxx\n\n\n123456\n117\nxx\n\n\n123456\n113\nxx\n\n\n123456\n109\nxz\n\n\n123456\n108\nxz\n\n\n123456\n98\nxz\n\n\n121214\n115\nabc\n\n\n121214\n110\nabc\n\n\n121214\n103\nabc\n\n\n121214\n117\nabz\n\n\n121214\n120\nabz\n\n\n121214\n125\nabz\n\n\n151416\n114\nzxc\n\n\n151416\n135\nzxc\n\n\n151416\n127\nzxc\n\n\n151416\n145\nzxm\n\n\n151416\n125\nzxm\n\n\n151416\n121\nzxm\n\n\n\n\nProcced table should look like:\n\n\n\n\nID\nxx\nxz\nabc\nabz\nzxc\nzxm\n\n\n\n\n123456\n110\n151\n0\n0\n0\n0\n\n\n121214\n0\n0\n132\n113\n0\n0\n\n\n151416\n0\n0\n0\n0\n124\n115","AnswerCount":4,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":180,"Q_Id":67243543,"Users Score":0,"Answer":"Well you have e.g. 6 'ID' with value '123456'. If you only want unique 'ID', you need to remove 5 'ID' rows, by doing this you will not have duplicate 'Description' values anymore. The question is, do you want unique ID or unique Description values (or unique combination of both)?","Q_Score":0,"Tags":"python","A_Id":67244109,"CreationDate":"2021-04-24T13:54:00.000","Title":"Python: how to get unique ID and remove duplicates from column 1 (ID), and column 3 (Description), Then get the median for column 2 (Value) in Pandas","Data Science and Machine Learning":1,"Database and SQL":1,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm running a jupyter notebook remotely on a server by\n\nconnecting to the server: ssh server:address\ninitialize the jypter notebook ipython notebook --no-browser --port=7000\nusing another terminal window, stabilish remove connection to the notebook ssh -N -f -L localhost:6001:localhost:7000 server:address \nfinally I access it throw localhost:6001 in my browser.\n\nThe thing is: I'd like to keep the notebook running when I turn my computer off. Any ideas on how can I do it?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":200,"Q_Id":67253338,"Users Score":0,"Answer":"You could create a crontab on your remote server with your command ipython notebook --no-browser --port=7000 to manage the execution of Jupiter notebook, that could be the way go.","Q_Score":1,"Tags":"python,ssh,jupyter-notebook,remote-access","A_Id":67253456,"CreationDate":"2021-04-25T12:20:00.000","Title":"Jupyter Notebook remote browser without disconnecting","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm not sure what to search for this.\nI am writing a piece of code using python fire to create a command line interface.\npython test.py function argument\nis there a way to make the shell interpret the following like the command above:\ntest function argument\nSimilar to how I can just call jupyter lab and it will open a notebook etc.\nI have a feeling this is more to do with setting up my bashrc or similar instead of something I can do in Python.","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":52,"Q_Id":67258005,"Users Score":0,"Answer":"Add the hashbang (at the start of the file, in case you don't know) \n#!\/usr\/bin\/env python \nor\n#!\/usr\/bin\/env python3\nReplace the 3 with whatever version you have installed and want that file to run\nSave the file to an already existing PATH or add the file location to PATH\nNow you can hopefully run it by typing test.py function argument\nRename test.py to test \nNow you should be able to run it as test function argument\nAlso make sure your file is set as executable","Q_Score":1,"Tags":"python,linux,python-fire","A_Id":67258132,"CreationDate":"2021-04-25T20:32:00.000","Title":"Command line interface for python module","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm not sure what to search for this.\nI am writing a piece of code using python fire to create a command line interface.\npython test.py function argument\nis there a way to make the shell interpret the following like the command above:\ntest function argument\nSimilar to how I can just call jupyter lab and it will open a notebook etc.\nI have a feeling this is more to do with setting up my bashrc or similar instead of something I can do in Python.","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":52,"Q_Id":67258005,"Users Score":0,"Answer":"You're correct that it has to do with adding to your .bashrc. You want to set an alias.\n\nMake sure your code has an appropriate shebang line at the top, ex. #!\/usr\/bin\/python3\nAdd the following to .bashrc, ex. alias test=python3 \/path\/to\/test.py\n\nFrom there, you can use sys.argv in your code to handle arguments within the program.","Q_Score":1,"Tags":"python,linux,python-fire","A_Id":67258041,"CreationDate":"2021-04-25T20:32:00.000","Title":"Command line interface for python module","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"We know that when generating a class in Python2, if there is a metaclass attribute, it will be generated by the metaclass referenced by the attribute. Bug when the class is not generated, it should have no attribute, how does it control the generation of the class?","AnswerCount":2,"Available Count":1,"Score":0.2913126125,"is_accepted":false,"ViewCount":37,"Q_Id":67267316,"Users Score":3,"Answer":"Because the body of the class definition statement is evaluated before the creation of the class object.\nSo indeed, the class doesn't have that attribute, the class doesn't even exist yet. But the class definition statement has been evaluated.","Q_Score":0,"Tags":"python,python-2.x,metaclass","A_Id":67267545,"CreationDate":"2021-04-26T13:12:00.000","Title":"If __metaclass__ is a class attribute, how does it control the generation of the class?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Can you advise me on the analogs of the socket library on Python? The task is this, I need to write a very simple script with which I could execute remote commands in cmd windows. I know how this can be implemented using the socket library, but I would like to know if there are any other libraries for such a case.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":33,"Q_Id":67272337,"Users Score":0,"Answer":"Sockets is a low level mechanism by which two systems can communicate each other. Your OS provides this mechanism, there's no analogs.\nNext examples come from the application layer and they work with sockets in their lower communication layers: a socket open by your http server, usually 80 or 443 or a websocket open by your browser to communicate with your server. Or the DNS query that your browser executes when tries to resolve a domain name, also works with sockets between your PC and the DNS server.","Q_Score":0,"Tags":"python,sockets","A_Id":67279572,"CreationDate":"2021-04-26T19:00:00.000","Title":"analogs of socket in python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm currently dealing with a material science dataset having various information.\nIn particular, I have a column 'Structure' with several pymatgen.core.Structure objects.\nI would like to save\/store this dataset as .csv file or something similar but the problem is that after having done that and reopening, the pymatgen structures lose their type becoming just formatted strings and I cannot get back to their initial pymatgen.core.Structure data type.\nAny hints on how to that? I'm searching on pymatgen documentation but haven't been lucky for now..\nThanks in advance!","AnswerCount":2,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":104,"Q_Id":67283018,"Users Score":2,"Answer":"pymatgen.core.structure object can be stored with only some sort of fixed format, for example, cif, vasp, xyz... so maybe you, first, need to store your structure information to cif or vasp. and open it and preprocess to make it \"csv\" form with python command.(hint : using python string-related command).","Q_Score":0,"Tags":"python,pandas,dataframe,encoding,pymatgen","A_Id":69388052,"CreationDate":"2021-04-27T12:25:00.000","Title":"Saving\/Storing pymatgen Structures","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I want to make a bot with discord.py that can stream videos from mp4 into a voice channel. Is it possible? and if it is possible how would I be able to do it (and sorry if this is a stupid question i am a beginner)","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":104,"Q_Id":67286450,"Users Score":0,"Answer":"At the moment it isn't possible, you can only stream audio.","Q_Score":1,"Tags":"python,discord.py","A_Id":67286558,"CreationDate":"2021-04-27T15:50:00.000","Title":"how to make a video stream bot for discord.py?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"my goal is to make a bot that is able to show youtube videos through screen sharing or camera. Does anyone know how to do it?\nI tried to find out how to do it but I have not managed to find something similar on internet, even on stack overflow.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":100,"Q_Id":67299823,"Users Score":0,"Answer":"It happens that zoom will share a video in the way that you want.","Q_Score":0,"Tags":"python,api,youtube","A_Id":67604712,"CreationDate":"2021-04-28T11:58:00.000","Title":"how to make a discord bot in python that can show a youtube video?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Let's say i need to have the javascript in a seperate file, then how can i add a {{variable}} for example in the javascript file without having to use a <script> tag in the HTML?\nIs that even possible with jinja?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":404,"Q_Id":67301684,"Users Score":0,"Answer":"You are not limited to generating HTML files with Jinja. You can generate a JS file that uses a {{ variable }}.","Q_Score":0,"Tags":"javascript,python,flask,jinja2","A_Id":67301778,"CreationDate":"2021-04-28T13:57:00.000","Title":"How to use jinja tags inside Javascript file?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have a Django server running in an elastic beanstalk environment. I would like to have it render HTML templates pulled from a separate AWS S3 Bucket.\nI am using the Django-storages library, which lets me use static and media files from the bucket, but I can't figure out how to get it to render templates.\nThe reasoning for doing it like this is that once my site is running, I would like to be able to add these HTML templates without having to redeploy the entire site.\nThank you","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":250,"Q_Id":67305256,"Users Score":0,"Answer":"To my best knowledge, Django-storages is responsible for managing static assets and media files, it doesn't mount the S3 bucket to the file system, what you might be looking for is something like S3Fuse which will mount the bucket on the File System, which will allow you to update the template and have them sync. This might not be the best solution because even if you got the sync to work, Django might not pick those changes and serve the templates from memory.\nI believe what you're looking for is a Continuous Delivery pipeline, that way you won't be worried about hosting.\nGood Question though.","Q_Score":0,"Tags":"django,amazon-web-services,amazon-s3,amazon-elastic-beanstalk,python-django-storages","A_Id":67306154,"CreationDate":"2021-04-28T17:38:00.000","Title":"DJango use templates from seperrate AWS S3 Bucket","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have two USB to CAN devices (can0 and can1), they both are connected to a Linux machine which has socketcan installed in it. I have read the basics of CANopen protocol, i have not seen any example that can establish communication between two CANopen devices using Python CANopen library.\nI read in the documentation that each devices must have a .eds file, so I took a sample .eds file from the Python CANopen library from christiansandberg github and trying to establish communication and make them talk to each other using PDO's, but I could not able to do that.\nWe have a battery and wanted to communicate with it, the battery works on can-open protocol and they have provided the .eds file for the battery. I guess a usb2can device with the CANopen Python library can do the work. But I just don't know how to establish communication between the usb2can device and the battery. It would be helpful with any insights in framing the packets.","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":760,"Q_Id":67318027,"Users Score":1,"Answer":"This is what you need to do:\n\nGet the necessary tools for CAN bus development. This means some manner of CAN listener in addition to your own application. It also means cables + terminating resistors. The easiest is to use DB9 dsub connectors. An oscilloscope is also highly recommended.\nRead the documentation about the device to figure out how to set node id and baudrate, or at least which default settings it uses.\nFind out which Device Profile the device uses, if any. The most common one is CiA 401 \"generic I\/O module\". In which case the default settings will be node id 1, baudrate 125kbps.\nYour application will need to act as NMT Master - network managing master - on this bus. That is, the node responsible for keeping track of all other nodes.\nIf the device is CANopen compliant and you've established which baudrate and node id it uses, you'll get a \"NMT bootup\" message at power up. Likely from node 1 unless you've changed the node id of the device.\nYou'll need to send a \"NMT start remote node\" message to the device to bring it from pre-operational to operational.\nDepending on what Device Profile the device uses, it may now respond with sending out all its enabled PDO data once, typically with everything set to zero.\nNow check the documentation of the device to find out which data that resides in which PDO. You'll need to match TPDO from the device with RPDO in your application and vice versa. They need to have the same COBID - CAN identifiers, but also the same size etc.\nCOBID is set in PDO communication settings in the Object Dictionary. If you need to change settings of the device, it needs to be done with SDO access of the device Object Dictionary.\nMore advanced options involve PDO mapping, where you can decide which parts of the data you are interested in that goes into which PDO. Not all devices support dynamic PDO mapping - it might use static PDO mapping in which case you can't change where the data comes out.\nOther misc useful stuff is the SAVE\/LOAD features of CANopen in case the device supports them. Then you can store your configuration permanently so that your application doesn't need to send SDOs at start-up for configuration every time the system is used.\nHeartbeat might be useful to enable to ensure that the device is up and running on regular basis. Your application will then act as Heartbeat consumer.","Q_Score":0,"Tags":"pdo,can-bus,canopen,python-can","A_Id":67330251,"CreationDate":"2021-04-29T13:06:00.000","Title":"CANopen protocol communication between two nodes using python canopen package","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have a number of free functions in a couple of Python modules and I need to create a UML Class Diagram to represent my entire program.\nCan I represent a free functions in a Class Diagram somehow or do I need to create a Utility Class so I can represent them in my Class Diagram?","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":486,"Q_Id":67319694,"Users Score":0,"Answer":"You will need to have some class in order to represent a \"free function\". You are quite free in how to do that. What I usually do is to create a stereotyped class. And it would be ok to use \u00abutility\u00bb for that. Anything else would work, but of course you need to document that in your domain.\nUsually a stereotype is bound to a profile. But most tools allow to use freely defined stereotypes. Though that is not 100% UML compliant it is quite a common practice.","Q_Score":2,"Tags":"python,uml,class-diagram","A_Id":67321801,"CreationDate":"2021-04-29T14:46:00.000","Title":"How to represent free functions in a Class Diagram Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have a number of free functions in a couple of Python modules and I need to create a UML Class Diagram to represent my entire program.\nCan I represent a free functions in a Class Diagram somehow or do I need to create a Utility Class so I can represent them in my Class Diagram?","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":486,"Q_Id":67319694,"Users Score":0,"Answer":"Even though UML was conceived in a time, when object orientation was hyped, it doesn't mean that it cannot be used for functions. What many don't realize is, that Behavior in the UML is a Class. Therefore, any Behavior can be shown in a class diagram. Just put the metaclass in guillemets above the name, e.g. \u00abactivity\u00bb. If you plan to describe the function with an activity diagram, that makes perfect sense. However, if you plan to describe it in (pseudo) code or in natural language, you can use \u00abfunction behavior\u00bb which is defined as a behavior without side effects. Or, if it can have side effects, just use \u00abopaque behavior\u00bb.","Q_Score":2,"Tags":"python,uml,class-diagram","A_Id":67333418,"CreationDate":"2021-04-29T14:46:00.000","Title":"How to represent free functions in a Class Diagram Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am developing a virtual stock market application on django and came upon the following problem. In any stock market application, there is an option of limit buy, stop loss and target sell. This essentially means to buy a share if it ever touches a price which is lower than the current price, to sell a share if it touches a very low price and to sell a share if it touches a high price respectively. For this, the server needs to constantly monitor the live data coming in from the API of a particular stock and perform the action if it happens. However, during this time no one may be making any requests on the site so how do I get django to monitor the prices of the stocks every 5 seconds or so to check if the order needs to be executed or not?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":84,"Q_Id":67330016,"Users Score":0,"Answer":"The common approaches here would be to create a Django management command that performs the checks, you can then use a cronjob on your server to schedule this every minute.\nAlternatively, you can use an asynchronous worker, which can also be used to schedule repetitive tasks frequently. The most commonly used solution is Celery but it does have a bit of a learning curve (which tends to manifest itself in reliability) that some other solutions such as Dramatiq seem to be trying to improve upon. Celery is probably the easiest to find instructional information for though.","Q_Score":0,"Tags":"javascript,python,django","A_Id":67330636,"CreationDate":"2021-04-30T07:37:00.000","Title":"Is there a way to run django constantly on the server to update a database based on live data","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm wondering how does it work with python package repositories for CentOS (and also other distributions) as I can't find any article about that. Where do python packages\/version come from?\nMy question comes from fact that I want to install python package Quart, and it offers only 2-years old package version 0.6.15 on both CentOS 7 and 8, while on Ubuntu it offers latest 0.14.1.","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":44,"Q_Id":67335869,"Users Score":1,"Answer":"The Quart 0.6.* releases are the last ones to support Python 3.6. If you install Python 3.7+ you can then install the latest Quart versions.","Q_Score":0,"Tags":"python,centos,package,repository,quart","A_Id":67367680,"CreationDate":"2021-04-30T14:43:00.000","Title":"Python package repositories on CentOS\/Ubuntu","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I was reading about the Django UserPassesTestMixinmixin, and I came across the term CBV Mixin. What is this, and how is it useful? Is a CBV Mixin a general type of mixins, and are there CBV mixins in any other framework apart from Django?","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":190,"Q_Id":67337324,"Users Score":0,"Answer":"CBV is just a shortcut from Class-based views, which is a generic term for any view in Django that is defined as a class in your code, especially one inheriting from django.views.View.\nSo the CBV Mixin is just any mixin that can be used in a Class-based view.","Q_Score":2,"Tags":"python,django,mixins","A_Id":67337582,"CreationDate":"2021-04-30T16:25:00.000","Title":"What is a CBV mixin in Django?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have a React Native app where I want to send an image to my Flask backend to do some image processing (annotations) then return this new image back to React Native to display it.\nI spent a whole day trying to figure this out but was unsuccessful. Does anyone have any ideas on how to achieve this?\nI plan on using Firebase's storage system to store these images so I wouldn't mind using that either if that makes things easier.\nWhat I've tried so far is sending the image uri to Flask and read the image file and was able to do the image processing however I couldn't figure out how to send the new image back to React Native...","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":287,"Q_Id":67343272,"Users Score":0,"Answer":"How are you sending the image to Flask right now?\nTypically you could implement an async function on RN that awaits a response.\nIn plain English:\nA function that uploads an image to the back end and awaits for the image to be processed.\nExpects in return a URL of the image on the back-end (or Firestore).","Q_Score":0,"Tags":"python,firebase,react-native,flask,api-design","A_Id":67344272,"CreationDate":"2021-05-01T05:52:00.000","Title":"How to send image between React Native and Flask?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"So, here is the problem I ran into, I am trying to build a very small-scale MVP app that I will be releasing soon. I have been able to figure out everything from deploying the flask application with Dokku (I'll upgrade to something better later) and have been able to get most things working on the app including S3 uploading, stripe integration, etc. Here is the one thing I am stuck on, how do I generate SSL certs on the fly for customers and then link everything back to the Python app? Here are my thoughts:\nI can use a simple script and connect to the Letsencrypt API to generate and request certs once domains are pointed to my server(s). The problem I am running into is that once the domain is pointed, how do I know? Dokku doesn't connect all incoming requests to my container and therefore Flask wouldn't be able to detect it unless I manually connect it with the dokku domains:add command?\nIs there a better way to go about this? I know of SSL for SaaS by Cloudflare but it seems to only be for their Enterprise customers and I need a robust solution like this that I don't mind building out but just need a few pointers (unless there is already a solution that is out there for free - no need to reinvent the wheel, eh?). Another thing, in the future I do plan to have my database running separately and load balancers pointing to multiple different instances of my app (won't be a major issue as the DB is still central, but just worried about the IP portion of it). To recap though:\nClient Domain (example.io) -> dns1.example.com -> Lets Encrypt SSL Cert -> Dokku Container -> My App\nPlease let me know if I need to re-explain anything, thank you!","AnswerCount":2,"Available Count":1,"Score":-0.0996679946,"is_accepted":false,"ViewCount":271,"Q_Id":67352618,"Users Score":-1,"Answer":"Your solutions is a wildcard certificate, or use app prefixing.\nSo I'm not sure why you need a cert per customer, but let's say you are going to do\ncustomer1.myapp.com -> routes to customer1 backend. For whatever reason.\nLet's Encrypt lets you register *.myapp.com and therefore you can use subdomains for each customer.\nThe alternative is a customer prefix.\nSay your app URL looks like www.myapp.com\/api\/v1\/somecomand\nyou could use www.myapp.com\/api\/v1\/customerID\/somecommand and then allow your load balancer to route based on the prefix and use a rewrite rule to remove the customerID back to the original URL.\nThis is more complicated, and it is load balancer dependent but so is the first solution.\nAll this being said, both solutions would most likely require a separate instance of your application per customer, which is a heavy solution, but fine if that's what you want and are using lightweight containers or deploying multiple instances per server.\nAnyway, a lot more information would be needed to give a solid solution.","Q_Score":5,"Tags":"python,nginx,ssl,flask,lets-encrypt","A_Id":67421642,"CreationDate":"2021-05-02T03:01:00.000","Title":"Generating SSL Certs for Customer Domains and integrating with Python Flask","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have a dataset with thousands of rows. Each row is a person, that I need to insert into 4 clusters. I know that have many possibles to do that and to find the best clusters, but in this case, I know the characteristics of each cluster. Generally, with ML, the clusters are find with IA.\nFor example, imagine that I have 4 columns to look: money_spending, salary, segment, days_to_buy. Also, I have:\nCluster 1 -> money_spending: 350-700\nsalary: 700-1000\nsegment: farmacy\ndays_to_buy: 12\nCluster 2 -> money_spending: 500-950\nsalary: 1000-1300\nsegment: construction material\ndays_to_buy: 18\nCluster 3 -> money_spending: 900-1400\nsalary: 1200-2000\nsegment: supermarket\ndays_to_buy: 20\nCluster 4 -> money_spending: 250-600\nsalary: 550-1000\nsegment: farmacy\ndays_to_buy: 30\nWhat's the best way to apply this to my dataset? I would use k-nearest, but I don't know how to use my cluster information.\nCan someone help me?\nPlus: If I have more columns or more clusters the solution keeps works?\nEdit: My original dataset only have the columns. The clusters are knowing, but are not in dataset. The job is exactly apply this cluster information to dataset. I don't have any idea how to do that.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":73,"Q_Id":67363770,"Users Score":0,"Answer":"You can try the following approach:\n\nRun K means and find the best number of k using the Elbow method or Silhouette graph.\n\nUse the cluster labels as a class.\ne.g. if 4 is the optimal number of the cluster then class=0,1,2,3 ( which will be the cluster labels)\n\nMerge the class with the original dataset and treat it as a supervised learning problem\n\nTry running any classification model after the train test split.\n\nSee the classification report to check model performance.\n\n\nPS\n\nTry using data with normalization too as many clustering algorithms are sensitive to outliers.\n\nPlease see if the class is somewhat equally distributed like  1000,800,1150,890 and not 1500,80,150,..etc as it will create data imbalance for the classifiers.","Q_Score":3,"Tags":"python,machine-learning,jupyter-notebook,artificial-intelligence,cluster-analysis","A_Id":67363871,"CreationDate":"2021-05-03T05:13:00.000","Title":"Clustering in Python","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":1,"ERRORS":0,"REVIEW":0},{"Question":"I try to use Coverage-Gutters. But the documentation is quite complicated and I kinda don't understand on how can it be used. I already installed the extension but I tried a number of things and it seems to be not working. Is there anyone know how to use it?","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":731,"Q_Id":67380420,"Users Score":1,"Answer":"The gutters are based on coverage output file, for example the coverage.xml file.\nConfigure a coverage plugin, run your tests with the coverage plugin and let Coverage-gutters watch.\nAn example for a Django:\n$ coverage python manage.py test\n$ coverage xml\nA generated coverage.xml has now been written in your project's root and your VSCode Coverage-Gutters should now be visible.","Q_Score":1,"Tags":"python,visual-studio-code,coverage.py","A_Id":68545748,"CreationDate":"2021-05-04T07:25:00.000","Title":"Coverage-Gutter on Visual Studio Code","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":1,"ERRORS":0,"REVIEW":0},{"Question":"so I have more of a general question that I can't wrap my head around, and I haven't seen explicitely explained within the docs. So let's take a random two events from my simulation (what they exactly are shouldn't matter in the scope of this question)\n10.1622 Customer02: Do something\n13.6176 Customer08: Do somethiing\nThe first column is the internal time these events took place. Can I ask someone to explain what is the interpretation of these numbers? Are these simply meant to be real world seconds, meaning that 3.5~~  real world seconds passed between the first event and the second in the simulation and that the first event took place 10 real world seconds into the simulation?\nWhat is the practice if I want times in my simulation (like interval between customers arriving, the time it takes to serve a customer) etc. to be expressed in real-world time? Let's say I have a variable \"intervalbetweencustomers\" which is set at \"10.0\" at the moment. If I want it to have the value of a real-world minute, how do i do that?","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":57,"Q_Id":67393592,"Users Score":1,"Answer":"The \"tick\" of the simpy clock can be in any unit you want (seconds, minutes, hours, ect)\nTick are not integers so you can have half a tick.\nJust pick a unit and convert everything to that unit when you need a time related parameter for a simpy function like env.timeout\nsimpy does not have a time units as a parameter so any conversion you will need to do yourself.  There are python libraries if you need to convert dates, or the difference between two dates, to a number","Q_Score":0,"Tags":"python,simulation,simpy","A_Id":67394000,"CreationDate":"2021-05-05T00:00:00.000","Title":"Interpretation of the default time system within Simpy","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"TLDR:\nIs there a way to create a hex value between 0x20 and 0x7E with 5 volts? Is there a cheap component on the market or circuit logic that can achieve this?\nI'm not sure what the proper terminology for this is, but here's what I'm trying to do:\nI have a bluetooth module connected to my pico via UART0 TX and UART0 RX. The use for this is a bit long to explain, but essentially, I want the bluetooth module to work without my pico attached to it. I have a device that outputs a signal, the pico reads the signal, then it tells the bluetooth module to transmit to the receiver. However, since the data to transmit isn't actually important, it makes sense to cut out the pico and simply have the bluetooth module read the signal directly then transmit.\nI have the device that outputs exactly when I want, but it outputs the equivalent of 00 in hex. My computer is connected via bluetooth and can read it just fine. However, the pico, reading the input through RX, can't. I've found no way for micropython using UART to read 00 - UART.any() and UART.read() want a character, and 00 only corresponds to NULL.\nSo essentially, I need some way to transmit a hex value between 0x20 and 0x7E without using the raspberry pi pico. Is there some kind of component that is able to do this? In practice, the bluetooth module will be connected to 5V power with up to 5 amps.\nAny idea on how to get the Pico to read 00 in hex through the RX pin is welcomed too. The purpose of this is to not need multiple Picos, since the receiver and the transmitter will be a good distance from each other.","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":59,"Q_Id":67394926,"Users Score":1,"Answer":"I found the issue. The pico actually can accept 0 through the UART RX pin. The issue was me having a wire misplaced. My computer saw the 0 input which made me think the pico couldn't handle it, but in fact it was never receiving it. Thanks for the help Kotzjan. Would have been interesting to fake a value into the port though!","Q_Score":0,"Tags":"bluetooth,micropython,raspberry-pi-pico","A_Id":67407788,"CreationDate":"2021-05-05T03:44:00.000","Title":"Component that can create a hex value?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I want to know the difference between a pyspark dataframe and a createOrReplaceTempView\nI know that with pyspark dataframe I have to use python, and with the createOrReplaceTempView  it is SQL, but in terms of memory, using the cluster, parallelizing, both are the same?\nFor example if I use .toPandas() I will put all the data in memory, does something similar happends with createOrReplaceTempView ? or is still distributed?\nAlso I would like to know, if I use CREATE OR REPLACE TEMP VIEW tablename how do I pass this table to a pyspark dataframe\nRegards","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":64,"Q_Id":67408249,"Users Score":0,"Answer":"I want to know the difference between a pyspark dataframe and a createOrReplaceTempView\n\n\nI know that with pyspark dataframe I have to use python, and with the createOrReplaceTempView it is SQL, but in terms of memory, using the cluster, parallelizing, both are the same?\n\nThey're both should be similar\n\nFor example if I use .toPandas() I will put all the data in memory, does something similar happends with createOrReplaceTempView ? or is still distributed?\n\n.toPandas() collect all data and return to driver's memory, createOrReplaceTempView is lazy","Q_Score":0,"Tags":"python,sql,pyspark","A_Id":67645843,"CreationDate":"2021-05-05T20:19:00.000","Title":"What is the difference between createOrReplaceTempView and pyspark dataframe","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I followed the official mediapipe page but without any result so can someone help to install mediapipe in raspberry pi 4 in windows it is easy to install it and use it but in arm device like raspberry pi i did not find any resources.","AnswerCount":4,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":7421,"Q_Id":67410495,"Users Score":0,"Answer":"I ran the command sudo pip3 install media pipe-rpi4. This worked. When I try to import the module in python I get  ModuleNotFoundError: No module named \u2018mediapipe.python._framework_bindings\u2019","Q_Score":5,"Tags":"python-3.x,deep-learning,raspberry-pi4,mediapipe","A_Id":70965111,"CreationDate":"2021-05-06T00:44:00.000","Title":"how to install and use mediapipe on Raspberry Pi 4?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I followed the official mediapipe page but without any result so can someone help to install mediapipe in raspberry pi 4 in windows it is easy to install it and use it but in arm device like raspberry pi i did not find any resources.","AnswerCount":4,"Available Count":2,"Score":0.049958375,"is_accepted":false,"ViewCount":7421,"Q_Id":67410495,"Users Score":1,"Answer":"if you use python3 you can try sudo pip3 install mediapipe-rpi4","Q_Score":5,"Tags":"python-3.x,deep-learning,raspberry-pi4,mediapipe","A_Id":70729637,"CreationDate":"2021-05-06T00:44:00.000","Title":"how to install and use mediapipe on Raspberry Pi 4?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am trying to run my code in Solaris environment with Python 3.7.4 [GCC 7.3.0] on sunos5. When importing necessary libraries from scipy import stats I face this issue. Does anybody know how can I fix this?\nThank you in advance.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":70,"Q_Id":67415061,"Users Score":0,"Answer":"This is a library linking issue. Try the following, as it may need re-installing, or updated:\npip install pyhull\nIf that doesn't work, you may have to recompile python, and any additional libraries or utilities (coreutils, binutils, glibc, even gcc).\nIf you have the Oracle C compiler, you can try that by using cc, or gcc if that is easier. The Oracle C compiler would be specific to your Solaris installation and may work better.\nIf you do not want to do that, you might want to try a packaged version of python for your version of SunOS \/ Solaris and then install pyhull or qhull using pip.","Q_Score":0,"Tags":"python,scipy,statistics,solaris,sunos","A_Id":71289568,"CreationDate":"2021-05-06T09:08:00.000","Title":"ImportError: relocation error: R_AMD64_32: \/scipy-1.6.2-py3.7-solaris-2.11-i86pc.64bit.egg\/scipy\/spatial\/qhull.cpython-37m.so: symbol (unknown)","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"how to check whether the user is logged in or not from admin panel\nwhat are the changes i need to make in models.py and admin.py to achieve this\nfrom django.contrib.auth.models import User","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":119,"Q_Id":67459935,"Users Score":0,"Answer":"You can't really. Django Contrib Admin doesn't track this information. The most you can get is if User has is_staff or is_superuser to check if they could potentially visit django.contrib.admin interface.","Q_Score":0,"Tags":"python,django,django-models","A_Id":67461568,"CreationDate":"2021-05-09T16:22:00.000","Title":"Check who is logged in Django admin panel","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"lack of indentation color, occurs problem where the indentation is missing. is there anyone who can help me to configure IDLE to show color (light\\dim color) in each indentation.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":122,"Q_Id":67466957,"Users Score":0,"Answer":"'Show color in each indentation?\"\nIn my Python 3.7 IDLE, I managed to distinguish the multiple levels of indentation in iterations (by default, the IDLE would show orange color for starting code text). It seems that we only able to adjust the indentation space (default is 4 spaces for python) and the color of entire coding text.\nWe can adjust the properties in Python shell --> Options --> Configure IDLE.","Q_Score":0,"Tags":"python,python-idle","A_Id":68064696,"CreationDate":"2021-05-10T08:11:00.000","Title":"how can i configure python IDLE, so that it shows color in each indentation?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have created a chatbot using nltk, keras and tkinter . And i have also created a website using python and flask . how can i intergrate both of them. i.e i can i make my chatbot run after the website gets open(run)\nwhen i am importing the chatgui.py(this is chat bot file) and executing it in my main.py(this is the python file file that is building the website using the flask framework) , only any one of them is running, not the both.\nPlz suggest me some idea , how can i make both of them run.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":69,"Q_Id":67468883,"Users Score":0,"Answer":"When a client visits your site, the client computer will not execute python code. Only the server side will execute the python code, so the tkinter part of your app is not needed. The user's gui is rendered with html\/javascript in their browser.\nThere are a lot of ways to go about it, but I think the most common approach would be to scrap the GUI part written with tkinter, and instead re-create a javascript based GUI that will be served by flask. Have chats instead pass between the client and server with javascripts fetch api.","Q_Score":0,"Tags":"python,flask,tkinter,keras,nltk","A_Id":67469041,"CreationDate":"2021-05-10T10:32:00.000","Title":"How to run a chatbot created using nltk , keras and tkinter on a website created using python and flask?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm trying to figure a way to know how to differentiate between methods and property\/attribute, and how to use them correctly without getting mixed up (when to use parenthesis when not to)\nFrom what I understand, (correct me if I am wrong):\n\nMethods are functions that takes in an input (exp a value) and returns an output;  *exp .sum()\n\n\nProperty\/attribute tells you additional information or describe the characteristics  *exp .index .shape .columns\n\nMy question is, .info() and .describe() are somewhat similar to .shape and .index which give you the description and info but why is it a method and not an attribute\/property?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":42,"Q_Id":67469800,"Users Score":0,"Answer":"The rough rule of thumb I would offer is to use an attribute for data that can be used as stored, and a function for data that needs to have something done to it before it's returned.\nIn your example, .shape just returns the tuple as it is stored by the system. It's a straightforward attribute.\nBy comparison, .info() and .describe() both apply filtering\/formatting etc to the data before it is returned. You can also optionally pass them parameters to specify how the data is filtered\/formatted before it is returned to you.\nThere are other reasons why attributes might be accessed through functions, such as using getters and setters to access protected attributes, but in your present examples it's because the functions don't just return the data, they do something to the data first.","Q_Score":0,"Tags":"python,methods,attributes","A_Id":67470473,"CreationDate":"2021-05-10T11:42:00.000","Title":"Why does.info() and .describe() in pandas have ()?","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I want to mimic the function that my keyboard's rgb software does using a piece of python code so I need to find what info the software sends to the keyboard.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":29,"Q_Id":67470158,"Users Score":0,"Answer":"you can use the Event Viewer if you are using Windows 10.\nStart Windows Event Viewer through the graphical user interface. Use the below steps to open Event Viewer on Windows:\n\nOpen Event Viewer by clicking the Start button.\nClick Control Panel.\nClick System and Security.\nClick Administrative Tools.\nClick Event Viewer.","Q_Score":0,"Tags":"python,python-3.x,usb,libusb","A_Id":67470233,"CreationDate":"2021-05-10T12:08:00.000","Title":"how to find what information is being sent to a usb device by a software?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":1,"ERRORS":0,"REVIEW":0},{"Question":"I'm making a cyberbullying detection discord bot in python, but sadly there are some people who may find their way around conventional English and spell a bad word in a different manner, like the n-word with 3 g's or the f word without the c. There are just too many variants of bad words some people may use. How can I make python find them all?\nI've tried pyenchant but it doesn't do what I want it to do. If I put suggest(\"racist slur\"), \"sucker\" is in the array. I can't seem to find anything that works.\nWill I have to consider every possibility separately and add all the possibilities into a single dictionary? (I hope not.)","AnswerCount":3,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":224,"Q_Id":67471755,"Users Score":0,"Answer":"You could try looping through the string that you are moderating and putting it into an array.\nFor example, if you wanted to blacklist \"foo\"\nx=[[\"f\",\"o\",\"o\"],[\" \"], [\"f\",\"o\",\"o\",\"o\"]]\nthen count the letters in each word to count how many of each letter is in each word:\ny = [[\"f\":\"1\", \"o\":\"2\"], [\" \":\"1\"], [\"f\":\"1\", \"o\":\"3\"]]\nthen see that y[2] is very similar to y[0] (the banned word).\nWhile this method is not perfect, it is a start.\nAnother thing to look in to is using a neural language interpreter that detects if a word is being used in a derogatory way. A while back, Google designed one of these.\nThe other answer is just that no bot is perfect.\nYou might just have to put these common misspellings in the blacklist.\nHowever, the automatic approach would be awesome if you got it working with 100% accuracy.","Q_Score":2,"Tags":"python,security","A_Id":67471979,"CreationDate":"2021-05-10T13:52:00.000","Title":"how do i make python find words that look similar to a bad word, but not necessarily a proper word in english?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm making a cyberbullying detection discord bot in python, but sadly there are some people who may find their way around conventional English and spell a bad word in a different manner, like the n-word with 3 g's or the f word without the c. There are just too many variants of bad words some people may use. How can I make python find them all?\nI've tried pyenchant but it doesn't do what I want it to do. If I put suggest(\"racist slur\"), \"sucker\" is in the array. I can't seem to find anything that works.\nWill I have to consider every possibility separately and add all the possibilities into a single dictionary? (I hope not.)","AnswerCount":3,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":224,"Q_Id":67471755,"Users Score":0,"Answer":"Unfortunately, spell checking (for different languages) alone is still an open problem that people do research on, so there is no perfect solution for this, let alone for the case when the user intentionally tries to insert some \"errors\".\nFortunately, there is a conceptually limited number of ways people can intentionally change the input word in order to obtain a new word that resembles the initial one enough to be understood by other people. For example, bad actors could try to:\n\nduplicate some letters multiple times\nadd some separators (e.g. \"-\", \".\") between characters\ndelete some characters (e.g. the f word without \"c\")\nreverse the word\npotentially others\n\nMy suggestion is to initially keep it simple, if you don't want to delve into machine learning. As a possible approach you could try to:\n\nmanually create a set of lower-case bad words with their duplicated letters removed (e.g. \"killer\" -> \"kiler\").\n\nmanually\/automatically add to this set variants of these words with one or multiple letters missing that can still be easily understood (e.g. \"kiler\" +-> \"kilr\").\n\nextract the words in the message (e.g. by message_str.split())\n\nfor each word and its reversed version:\na. remove possible separators (e.g. \"-\", \".\")\nb. convert it to lower case and remove consecutive, duplicate letters\nc. check if this new form of the word is present in the set, if so, censor it or the entire message\n\n\nThis solution lacks the protection against words with characters separated by one or multiple white spaces \/ newlines (e.g. \"killer\" -> \"k i l l e r\").\nDepending on how long the messages are (I believe they are generally short in  chat rooms), you can try to consider each substring of the initial message with removed whitespaces, instead of each word detected by the white space separator in step 3. This will take more time, as generating each substring will take alone O(message_length^2) time.","Q_Score":2,"Tags":"python,security","A_Id":67472358,"CreationDate":"2021-05-10T13:52:00.000","Title":"how do i make python find words that look similar to a bad word, but not necessarily a proper word in english?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have a vector of floats V with values from 0 to 1. I want to create a histogram with some window say A==0.01. And check how close is the resulting histogram to uniform distribution getting one value from zero to one where 0 is correlating perfectly and 1 meaning not correlating at all. For me correlation here first of all means histogram shape.\nHow one would do such a thing in python with numpy?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":31,"Q_Id":67474375,"Users Score":0,"Answer":"You can create the histogram with np.histogram. Then, you can generate the uniform histogram from the average of the previously retrieved histogram with np.mean. Then you can use a statistical test like the Pearson coefficient to do that with scipy.stats.pearsonr.","Q_Score":0,"Tags":"python,numpy","A_Id":67478274,"CreationDate":"2021-05-10T16:39:00.000","Title":"How to check if a vector hirogramm correlates with uniform distribution?","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am new in python and I want to make writing bot with PyAutoGui. It works good but it cant write character like this \"\u010d\", \"\u0161\", \"\u0159\", \"\u017e\".How to write this special symbols?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":90,"Q_Id":67484104,"Users Score":0,"Answer":"Ok, after some time I finally know how to do this. I just use another plugin \"keyboard\"","Q_Score":2,"Tags":"python-3.x,pyautogui","A_Id":68822032,"CreationDate":"2021-05-11T09:33:00.000","Title":"PyAutoGui how to write special characters","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"We have an existing python application (let's call it control app) that does operation data logging as well as smaller controlling tasks on a machine. We want to extend this application with a web interface, which is based on flask (let's call it web app). Both parts, the control app as well as the web app, are already present, however, the setup feels somehow fishy. In the process of rethinking the setup, I'm somehow undecided on how to structure those two parts.\nAt the moment, the control app gathers machine data and stores it in a postgres database. Based on several machine states, additional operations are performed that provide new input for the PLCs that control the machine.\nThe web app currently polls the database to react to machine states to e.g. update visualisation data, change some (state representing) images and such things.\nThe web app polling the database is the part that somehow smells. So my idea was to unify both apps into one to have the web app tightly coupled to the control app to be able to react on machine state changes instead of polling the database for those state changes.\nBased on that idea, I'm wondering how to add a flask app to an existing python app. When I'm not mistaken, the flask app consumes the application's main thread, which would break to already existing logic. Thus I would need to have one of the two parts running on another thread. Thinking about this problem, I'm further wondering whether this merging is a good idea at all.\nSo, the questions are: Is it a good idea to merge both applications? If yes, how to merge them without breaking one of them? If not, how else should I try to get rid of the database polling (how to synchronize and also move some data from the web app to the control app)?","AnswerCount":1,"Available Count":1,"Score":0.537049567,"is_accepted":false,"ViewCount":62,"Q_Id":67499881,"Users Score":3,"Answer":"It's not a good idea to merge them per se -- problems in one part will affect the other, and this sort of tight coupling is a bad idea both because you can't run the two parts of the program on separate machines and because if one crashes, so does the other one. It's better to have them communicating over some sort of protocol.\nIf I were designing this, I would probably do the same thing as you did, except that instead of using an SQL database for this, I would use something like Redis which stores its data in memory. Redis allows you to subscribe to events rather than poll for updates, and polling for updates is cheaper because it's in memory.","Q_Score":0,"Tags":"python,postgresql,flask","A_Id":67500138,"CreationDate":"2021-05-12T08:25:00.000","Title":"Add flask based web interface to existing application","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":1},{"Question":"So I was wondering there is a way to directly change the x and y coordinate of a canvas object after you created it. I know .move function but it only changes the coordinate but not directly setting it.","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":1381,"Q_Id":67516876,"Users Score":1,"Answer":"You can use .moveto(item_id, x, y) to move the canvas item to absolute position (x, y).","Q_Score":0,"Tags":"python,tkinter","A_Id":67517153,"CreationDate":"2021-05-13T09:25:00.000","Title":"how to change the position of a canvas object after you created it in Python Tkinter?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am writing a trading bot in python for Binance platform. I have selected 300 cryptos. Binance has a websocket API for each  pair. I am able to fetch price data for one pair. I need to parallely fetch prices for 300 cryptos and do some calculations. The data is pushed every 100ms. Each pair has a different url. So I guess I need to open 300 websocket connections in parallel.\nAll of this should be done under 100 ms and store the data in a single list. I haven't used multiprocessing, multithreading, asyncio etc so I have no I idea how to do this in python.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":162,"Q_Id":67537138,"Users Score":0,"Answer":"I would try with:\n\nUse a *.yaml with all urls as config file\nHave an empty and global list in the main thread where you will store the newest value (list) or more (dict) sent by each socket url\nOpen 1 socket per url in an own Thread with threading.thread.\nCheck if you have to ping from time to time so your client isnt disconnected.","Q_Score":0,"Tags":"python,python-3.x,multithreading,websocket,python-multiprocessing","A_Id":67694531,"CreationDate":"2021-05-14T15:45:00.000","Title":"Need help regarding parallelization for 300 websocket connections in python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am creating a bot for my server but someone is removing the reaction on my server, so I want to detect that who is removing the reaction. But I have no idea how to do that or even if it is possible or not.\nYour help is highly appreciated","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":523,"Q_Id":67545320,"Users Score":0,"Answer":"Unfortunately, The API does not give the information on who removed the reaction.","Q_Score":1,"Tags":"python,discord,discord.py","A_Id":67549401,"CreationDate":"2021-05-15T09:40:00.000","Title":"How to detect that who removed the reaction discord.py","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I currently have a socketio webserver using WSGI and I host it with gunicorn. I also have set up a javascript client which uses a web browser. I've managed to get these two to be able to communicate.\nI'm working on creating an information service which takes events which happen in a game from a log and then parses it through a seperate python script to create a readable GUI. But that bit doesn't really matter.\nOnce I have my string of text from my seperate python program, how do I send it to all clients connected to my webserver? The program isnt part of the socketIO server so, as far as I'm aware, can't use emit().\nMy idea was to create a seperate python client which connected to the socketio server and do it that way. I've illustrated the flow below:\n\nsocketIO python Client -- DATA --> socketIO server\nsocketIO server -- DATA --> ALL socketIO clients.\n\nI'm struggling to be able to work out a way to perform this? Could anyone help or suggest a more efficient way? Let me know if my explanation is unclear.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":33,"Q_Id":67550430,"Users Score":0,"Answer":"Thanks Miguel, I hadn't seen that in the documentation. Despite reading it over and over, I was stuck for a while. My stupid mind didn't come across the thought that I'd need to install Redis-server...\nAll working now!\nLesson learned: check requirements for my program...","Q_Score":0,"Tags":"python-socketio","A_Id":67661308,"CreationDate":"2021-05-15T19:18:00.000","Title":"Sending data generated from a seperate python program to socketIO clients with a socketIO server","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have an app using twilio.\nI have made the twilio number public and setup call forwarding from that number to my personal number to show alerts both on the app and my phone.\nThe issue is that I am unable to identify the caller on my phone as it shows the twilio number instead of caller number on my phone.\nIs there a possible way to show the caller's number on my phone when forwarding the call.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":53,"Q_Id":67551555,"Users Score":1,"Answer":"This is possible. Just don\u2019t set the callerId attribute of the Dial verb and it will pass the callerId of the inbound call leg.","Q_Score":0,"Tags":"twilio,twilio-api,twilio-programmable-voice,twilio-python","A_Id":67551831,"CreationDate":"2021-05-15T21:58:00.000","Title":"How to show number of caller when forwarding call in twilio","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I coded my own virtual assistant in python. I know how to start apps through my voice via os.system or os.startfile, but I don't know how to close the current window ?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":83,"Q_Id":67558580,"Users Score":0,"Answer":"os.system('taskkill \/F \/IM processname')\ne.g:  os.system('taskkill \/F \/IM chrome.exe')","Q_Score":0,"Tags":"python","A_Id":67558742,"CreationDate":"2021-05-16T15:39:00.000","Title":"How to close any window using OS library in python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Can anyone please suggest me how to implement this specific use case?\nEvery morning a python job from on premise server\n\nclears the S3 folder contents and then\nextracts files on premise from db and then\nuploads the extracted files to the above S3 folder.\n\nSometimes, the python script which is scheduled to run through windows task scheduler job is just starting and finishing in seconds without doing any work.\nIn order to send an alert notification when this happens, I am thinking of writing a lambda that is scheduled to run after like 5 minutes to see if the folder contents is deleted or not in the last few minutes to an SNS topic. Is this doable? Here the lambda trigger is not an S3 event but a scheduled event that can able to read S3 delete action.","AnswerCount":3,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":90,"Q_Id":67559448,"Users Score":1,"Answer":"Sure, you could do that.\nAn easier method might be to add a step at the end of the Windows task that basically says \"The job completed successfully\". It could upload this file to S3.\nThen, the scheduled AWS Lambda function could simply check the LastModified date of that file. If it is older than one hour (or whatever), then send an alert via Amazon SNS.","Q_Score":0,"Tags":"python,amazon-web-services,aws-lambda,amazon-sns","A_Id":67563150,"CreationDate":"2021-05-16T17:06:00.000","Title":"Alert if the contents of an S3 folder is not deleted by specific time","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Can anyone please suggest me how to implement this specific use case?\nEvery morning a python job from on premise server\n\nclears the S3 folder contents and then\nextracts files on premise from db and then\nuploads the extracted files to the above S3 folder.\n\nSometimes, the python script which is scheduled to run through windows task scheduler job is just starting and finishing in seconds without doing any work.\nIn order to send an alert notification when this happens, I am thinking of writing a lambda that is scheduled to run after like 5 minutes to see if the folder contents is deleted or not in the last few minutes to an SNS topic. Is this doable? Here the lambda trigger is not an S3 event but a scheduled event that can able to read S3 delete action.","AnswerCount":3,"Available Count":2,"Score":0.0665680765,"is_accepted":false,"ViewCount":90,"Q_Id":67559448,"Users Score":1,"Answer":"On AWS:\nYou can set up an event notifier on the s3 bucket supporting event type s3:ObjectRemoved:, s3:ObjectCreated:, where the event notification can be on SNS Topic\n[https:\/\/docs.aws.amazon.com\/AmazonS3\/latest\/userguide\/enable-event-notifications.html]","Q_Score":0,"Tags":"python,amazon-web-services,aws-lambda,amazon-sns","A_Id":67571354,"CreationDate":"2021-05-16T17:06:00.000","Title":"Alert if the contents of an S3 folder is not deleted by specific time","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"We want to implement attribute prediction and image search model in single application.\nStep1. Upload of image ,will give attribute details.\nexample ,If we upload dog image, then attribute details will display like color, breed.\nstep2. On click of any attribute will show similar matching result.\nexample on click of attribute  like breed it will display matching breed  dog images from image data.\nPlease suggest ,how we can achieve that","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":47,"Q_Id":67581498,"Users Score":1,"Answer":"With step 1, I recommend you should use a multi-label images classification. It will help you get attribute of input image like what object in in the image, what color is it,...\nWith step 2, you can query the attribute in your database or you can use a recommendation system for more advance.","Q_Score":0,"Tags":"python,machine-learning,computer-vision,artificial-intelligence","A_Id":67582589,"CreationDate":"2021-05-18T07:10:00.000","Title":"How we can implement attribute prediction and image search model as one?","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have a string that I would like to check for comparison.\ndf['ACCOUNTMANAGER'][0] this value has some special character that I cannot compare using string comparison. I tried to compare using bytes but it failed. I would like to check how the data is stored there for comparison. Is there a way to do this?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":43,"Q_Id":67597520,"Users Score":0,"Answer":"I figured it out. It was being stored as utf-8 encoded format and now comparison works. I used for comparison byte b'\\x8a' in if statement.","Q_Score":0,"Tags":"python,pandas,dataframe","A_Id":67601588,"CreationDate":"2021-05-19T05:39:00.000","Title":"how to check python bytes for dataframe string field?","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm new to python (and to programming in general). I have no experience with GitLab, but I've been given a directory in GitLab that should have all the scripts I need to install all the python modules I need, but I'm not sure how to do that. I can download the directory as tar.gz or tar.bz2 or tar, but I'm not familiar with these types of files and not sure which I need or what to do with it? Any help would be greatly appreciated.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":31,"Q_Id":67626016,"Users Score":0,"Answer":"If you have git installed, you can clone the project to your computer with the command:\ngit clone <url>\nYou can get the URL from GitLab, there are for HTTP or ssh.\nAfter it, if the project has a requirenment.txt file, you can install all requirements with: pip install -r requirements.txt.  Else, you will need to install all libraries with pip or conda.","Q_Score":0,"Tags":"python,installation,module,download,gitlab","A_Id":67626112,"CreationDate":"2021-05-20T18:22:00.000","Title":"How do you extract scripts in GitLab and install the module in Python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I made a wrapper for aws cloudwatch in python with boto3.\nAnd I am doing the unit test with moto, everything go smoothly in my local PC.\nAfter I pushed my code to Azure Repo to trigger the pipeline, I always get the error message.\nI want to know how is the compatibility of Azure pipeline to run the 'moto' library.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":83,"Q_Id":67633829,"Users Score":0,"Answer":"After testing for few days I found the problem finally.\nI have to scale my searched day to contain my logs timestamp\nIt means my timestamp of metrics is datetime.today(), and I need to set the Metric Data Queries start date and end date parameter to datetime.today() -(+) timedelta(1) to scale the query date, I don't really know why it work without the scaling in local PC.","Q_Score":0,"Tags":"python,azure,azure-devops,amazon-cloudwatch,moto","A_Id":67665918,"CreationDate":"2021-05-21T09:04:00.000","Title":"Unit test failed with moto in azure pipeline","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"I try to establish a website-connection(web-login) via python. The login appears to need 3 keys (next to password and username of course). 2 of them are handed over via get and the third one is a csrf-key. The csrf-key is not contained in the html body of the current page nor is it in the link. (I checked this explicitly by using strg+f)\nWhat other common ways are there to generate the csrf-key on the fly? (I explicitly checked by inspecting the post request that the csrf is included in the request, but I don't understand how it gets there)","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":24,"Q_Id":67648915,"Users Score":0,"Answer":"The csrf key must be somewhere in the webpage you are trying to access.\nThe csrf key is not generated by the user, instead, it is a unique secret value generated by the server-side application and transmitted to the client.","Q_Score":0,"Tags":"python,html,authentication","A_Id":67659054,"CreationDate":"2021-05-22T11:22:00.000","Title":"csrf-key not as hidden input or as get: How can it be generated?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm trying to make a 3D game in Ursina. I managed to have a working FirstPersonController, but it is using WASD. I'm french, and thus have an AZERTY keyboard, which isn't really convenient... Do you know how I could change my controls to move the FirstPersonController ?\nI'd also like to be able to use \"special\" buttons of my mouse. For exemple, the \"forward\" and \"backward\" ones, to sprint and jump !","AnswerCount":3,"Available Count":2,"Score":0.1325487884,"is_accepted":false,"ViewCount":382,"Q_Id":67669320,"Users Score":2,"Answer":"You can either copy the code, which you're probably going to do if you need custom movement anyway, or you can rebind the keys with input_handler.rebind(to_key, from_key)","Q_Score":0,"Tags":"python,python-3.x,game-engine","A_Id":67690532,"CreationDate":"2021-05-24T09:02:00.000","Title":"Ursina : change FirstPersonController controls","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm trying to make a 3D game in Ursina. I managed to have a working FirstPersonController, but it is using WASD. I'm french, and thus have an AZERTY keyboard, which isn't really convenient... Do you know how I could change my controls to move the FirstPersonController ?\nI'd also like to be able to use \"special\" buttons of my mouse. For exemple, the \"forward\" and \"backward\" ones, to sprint and jump !","AnswerCount":3,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":382,"Q_Id":67669320,"Users Score":0,"Answer":"For changing keys you need to scroll up and when you see\"ursina.prefabs.first_person_controller import FirstPersonController\" then\nyou do ctrl + click on \"first_person_controller\". Next, you scroll down until you get to the line 44-45 and you change .If it doesn't work use visual studio code.","Q_Score":0,"Tags":"python,python-3.x,game-engine","A_Id":71570078,"CreationDate":"2021-05-24T09:02:00.000","Title":"Ursina : change FirstPersonController controls","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have tried searching everywhere but to no avail. Can anyone guide me as to how to pass data from typescript to python? The data is such that I will use it to do webscraping using beautifulSoup over in python. As I'm not putting any implementations here, any general guidance will do :)","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":491,"Q_Id":67672734,"Users Score":0,"Answer":"Have you tried creating an api on python?\nI guess you can pass the data from typescript to python using Http in the form of json or just save the file using typescript and read it using python and edit it as you want.","Q_Score":0,"Tags":"python,typescript","A_Id":67672827,"CreationDate":"2021-05-24T13:17:00.000","Title":"Connecting TypeScript to python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm trying to create a magic Square function out of 2d list: [[8, 1, 6], [3, 5, 7], [4, 9, 2]], where It checks if all the columns adds up to 15 from a 3x3 square. I'm stuck on how to write function checks for the sum of columns if anyone can help out that will be highly appreciative. Without using numpy","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":41,"Q_Id":67683262,"Users Score":0,"Answer":"My advice would be compare the two answers thus far and pick the performance and readability answer  and write a test for the method ensuring people do not break it.","Q_Score":0,"Tags":"python","A_Id":67691762,"CreationDate":"2021-05-25T07:08:00.000","Title":"How to Count columns from a 3x3 square","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Is there anyway to install a lightweight version of TensorFlow for prediction only?\nI built a Docker image with TensorFlow 2.5 and python 3.8 slim. The image size is 1.8Gb but I need it to be 1Gb maximum.\nAs I will only use this Docker image for prediction, I guess there must be a way to reduce TensorFlow and install only the needed modules.\nIf you know if TF lite or TF serving can help me to reach this out, please tell me how.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":93,"Q_Id":67708131,"Users Score":0,"Answer":"I think the only way yo use TF in a lightweight mode is using TFlite or TFLite Micro. For this to work yo need to convert your frozen inference graph to a .tflite file.","Q_Score":1,"Tags":"python,docker,tensorflow","A_Id":67716146,"CreationDate":"2021-05-26T15:32:00.000","Title":"TensorFlow lightweight for prediction","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I need to make a python3.7 installation for CentOS8, so I can install that via rpm\/yum rather than building from source on the target machine (need to avoid installing gcc and other build deps there).\nIs that a reasonable possibility? I'm comfortable building python from source, but I don't know how to package up the resulting install in a portable way (portable to other machines running the same OS). RPM would be ideal but I'd be happy with a tgz and a known set of yum runtime dependencies.\nNote that there is no official CentOS8 python 3.7, only 3.6 and 3.8. I specifically need 3.7.\nGoogling for \"build python distribution\" or \"build python RPM\" just shows how to build python modules for distribution, not python itself.\n(I know miniconda\/miniforge is an alternative way to get this done, but I'd prefer to do the build myself.)","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":47,"Q_Id":67723558,"Users Score":0,"Answer":"I didn't figure out how to build an RPM, but it turns out it's good enough just to build with --prefix=\/opt\/python37 and then tar that up. On the target machine, untar and add the shared lib to ld.so.conf and it works fine.","Q_Score":0,"Tags":"python,rpm,centos8","A_Id":67727182,"CreationDate":"2021-05-27T13:49:00.000","Title":"How can I build an rpm or tgz of a particular python version, specifically python3.7 for CentOS8","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am trying to introduce dynamic workflows into my landscape that involves multiple steps of different model inference where the output from one model gets fed into another model.Currently we have few Celery workers spread across hosts to manage the inference chain. As the complexity increase, we are attempting to build workflows on the fly. For that purpose, I got a dynamic DAG setup with Celeryexecutor working. Now, is there a way I can retain the current Celery setup and route airflow driven tasks to the same workers? I do understand that the setup in these workers should have access to the DAG folders and environment same as the airflow server. I want to know how the celery worker need to be started in these servers so that airflow can route the same tasks that used to be done by the manual workflow from a python application. If I start the workers using command \"airflow celery worker\", I cannot access my application tasks. If I start celery the way it is currently ie \"celery -A proj\", airflow has nothing to do with it. Looking for ideas to make it work.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":495,"Q_Id":67725304,"Users Score":0,"Answer":"Thanks @DejanLekic. I got it working (though the DAG task scheduling latency was too much that I dropped the approach). If someone is looking to see how this was accomplished, here are few things I did to get it working.\n\nChange the airflow.cfg to change the executor,queue and result back-end settings (Obvious)\nIf we have to use Celery worker spawned outside the airflow umbrella, change the celery_app_name setting to celery.execute instead of airflow.executors.celery_execute and change the Executor to \"LocalExecutor\". I have not tested this, but it may even be possible to avoid switching to celery executor by registering airflow's Task in the project's celery App.\nEach task will now call send_task(), the AsynResult object returned is then stored in either Xcom(implicitly or explicitly) or in Redis(implicitly push to the queue) and the child task will then gather the Asyncresult ( it will be an implicit call to get the value from Xcom or Redis) and then call .get() to obtain the result from the previous step.\n\nNote: It is not necessary to split the send_task() and .get() between two tasks of the DAG. By splitting them between parent and child, I was trying to take advantage of the lag between tasks. But in my case, the celery execution of tasks completed faster than airflow's inherent latency in scheduling dependent tasks.","Q_Score":1,"Tags":"python,celery,airflow,celery-task","A_Id":67856388,"CreationDate":"2021-05-27T15:26:00.000","Title":"Use existing celery workers for Airflow's Celeryexecutor workers","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I began my project without creating a virtual environment. Now I am wondering how big of a mistake was that. pip install Pillow not executing no matter what I do to include an image in my classs Model. Can or should I migrate my files to a new virtual environment. Or should I start coding from scratch.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":40,"Q_Id":67730136,"Users Score":6,"Answer":"You don't have to start coding from the scratch. You can create a new virtual env using python -m venv <name-of-the-env> and install your dependencies.","Q_Score":0,"Tags":"python,django,virtualenv","A_Id":67730166,"CreationDate":"2021-05-27T21:20:00.000","Title":"Should I start over my project in a new Django Virtual Environment","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am creating an app that allows me to edit users on the frontend. Before doing this I wish to have all the users listed in a page. They are categorized by their group. Users that are in a group show up how they are supposed to. I want to also display users that are not in a group.\nThis is how I fetch the users in a specific group:\ngroupuser = User.objects.filter(groups__name='mygroup').\nHow do I display a user without any group in my template?\nI am new to Django and don't know much about this.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":73,"Q_Id":67738678,"Users Score":5,"Answer":"You can use the field lookup __isnull.\nUser.objects.filter(groups__isnull=True) gives you all the users that do not belong to any group.","Q_Score":0,"Tags":"python,django,usergroups","A_Id":67738746,"CreationDate":"2021-05-28T12:16:00.000","Title":"Display users without a group in a template Django","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I've got Pycharm installed on my chromebook by enabling linux apps. I've started to learn Python using a tutorial by 'Programming by Mosh'. In one of the projects that he does in the tutorial, he adds an .xlsx file to a project in Pycharm. Mosh (he uses a Mac) did this by right clicking on project and then clicking 'Reveal in Finder' and then pasting the file onto the window that opens. Could you explain how I can do this on my chromebook, because I can't seem to find the 'Reveal in Finder' option.","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":112,"Q_Id":67748429,"Users Score":0,"Answer":"Both the operating systems are quite different. If you want to create an Excel file(.xlsx is used by Microsoft Excel), you can use Office Online and then download it to your project directory in Chromebook.\nI would actually prefer you to use Google sheets instead if you're using Chrome OS.","Q_Score":0,"Tags":"python,excel,pycharm,google-chrome-os","A_Id":67748653,"CreationDate":"2021-05-29T06:28:00.000","Title":"Adding a .xlsx file to Pycharm on a chromebook","Data Science and Machine Learning":0,"Database and SQL":1,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":1,"ERRORS":0,"REVIEW":0},{"Question":"I've got Pycharm installed on my chromebook by enabling linux apps. I've started to learn Python using a tutorial by 'Programming by Mosh'. In one of the projects that he does in the tutorial, he adds an .xlsx file to a project in Pycharm. Mosh (he uses a Mac) did this by right clicking on project and then clicking 'Reveal in Finder' and then pasting the file onto the window that opens. Could you explain how I can do this on my chromebook, because I can't seem to find the 'Reveal in Finder' option.","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":112,"Q_Id":67748429,"Users Score":0,"Answer":"Go to the dropdown menu of  'Project' at the top and then click 'Project files'. Then just paste your file into it.","Q_Score":0,"Tags":"python,excel,pycharm,google-chrome-os","A_Id":67748811,"CreationDate":"2021-05-29T06:28:00.000","Title":"Adding a .xlsx file to Pycharm on a chromebook","Data Science and Machine Learning":0,"Database and SQL":1,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":1,"ERRORS":0,"REVIEW":0},{"Question":"I would like to know how to do the average, standard deviation and mode statistics of an NxN matrix.\nCan anybody suggest how to do this in python?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":59,"Q_Id":67757234,"Users Score":0,"Answer":"As pointed out in a comment,  this is easily found by a search.\nThe scipy library offers functions for all of these, either for the whole array or for specified axes. scipy.stats.describe will give the mean and variance all at once, and standard deviation is easily computed from variance. For mode use scipy.stats.mode\nAlternatively for mean and standard deviation, there are numpy.mean and numpy.std respectively.","Q_Score":0,"Tags":"python,matrix,statistics,mean,standard-deviation","A_Id":67757331,"CreationDate":"2021-05-30T02:44:00.000","Title":"How to make the mean, standard deviation and mode statistics of an NxN matrix","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am coding with the latest version of Visual Studio Code with Python. For some reason I get those red underlines on my code, where there would be a \"problem\". The annoying part of this is that I get it even while still typing the code. Could someone please tell how to remove it?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":269,"Q_Id":67795438,"Users Score":0,"Answer":"I think you may also be able to press Ctrl(or command) + Shift+P then type disable error squiggles then disable it like that. This works for c\/c++ so I am not sure if it will work on python! This also disables it showing all errors","Q_Score":0,"Tags":"python,visual-studio-code","A_Id":67795544,"CreationDate":"2021-06-01T20:10:00.000","Title":"How to disable red underlines in Visual Studio Code?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Before running buildozer I put a java file in ga\/chatme\/web\/WebHandler.java.\nThen, I set the android.add_src to ga\/chatme\/web but, I cant seem to import it with autoclass('ga.chatme.web.WebHandler')","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":51,"Q_Id":67795515,"Users Score":0,"Answer":"I fixed it by putting everything in an src folder then pointing android.src to it","Q_Score":1,"Tags":"python-3.x,pyjnius","A_Id":67796207,"CreationDate":"2021-06-01T20:17:00.000","Title":"how do I compile java files and import them with pyjnius with kivy","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Can the xlrd module change the file propeties? Such as author,title,subject,etc..\nI want to change a .xls file's properties and don't know how to do that.","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":30,"Q_Id":67805039,"Users Score":1,"Answer":"As far as i know that's not possible with xlrd. The rd part of the name means \"read-only\". You would need to use the xlwt library for writing or one of the newer options like XlsxWriter.","Q_Score":2,"Tags":"python,excel,properties,xls,xlrd","A_Id":67805373,"CreationDate":"2021-06-02T12:23:00.000","Title":"Can the xlrd module change the file properties?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I've recently started learning how to use Django and I was wondering whether or not you could create a button in HTML that can directly call a python function without changing the URL. I was told this was possible with JS but I wanted to know if you could do that in Python.\nThanks for your time reading this!","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":102,"Q_Id":67829100,"Users Score":0,"Answer":"Depending on your application you may want to look into Django forms. Otherwise JS (ajax) is the way to go. More details could always help.","Q_Score":0,"Tags":"python,html,django,function,button","A_Id":67830450,"CreationDate":"2021-06-03T21:52:00.000","Title":"Call python function with Django","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm trying to figure out how to implement a workflow so that a sensor task wait for external dag to complete, for only wait for a certain number of days. It's a daily job so I'd like a sensor job to wait for example 3 days, and on the forth day send out an email, and either waiting or do some other task.\nCould someone please help to shed some light on how to achieve this? Also how do we communicate the \"days counter\" from one day to another? Many thanks for your help.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":715,"Q_Id":67837592,"Users Score":4,"Answer":"You can use a ExternalTaskSensor with the following configurations:\n\ntimeout = 3 * 24 * 60 * 60 - 3 days in seconds, after that time sensor will fail\npoke_interval = 12 * 60 * 60 - 12h between sensor checks, you can adjust  it to let say a check every hour. It will reduce number of times when you check the external dag state\nmode = \"reschedule\" - in this way the sensor will not occupy worker slot for 3 days, it will be scheduled, executed and if condition is not met it will be rescheduled to be executed in next poke_interval seconds. It's a good practice to use this mode for long running tasks.\n\nAdditionally you can build your waiting DAG as wait_task >> [success_task , fail_task] where\n\nwait_task is your sensor\nsuccess_task has trigger rule all_success and is followed when   the sensors succeeds\nfail_task with all_failed trigger rule and handles scenario when sensor finally return false or timeouts","Q_Score":2,"Tags":"python,airflow-scheduler,airflow","A_Id":67838242,"CreationDate":"2021-06-04T12:53:00.000","Title":"Airflow sensor task only wait for a certain period","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have a script that downloads a CSV from Outlook, does some things in Excel, and then sends an email out to people.\nWhen I run it manually with Outlook open, it runs perfectly. But when I try to run it with Task Scheduler, I get this error\n\"com_error(-2146959355, 'Server execution failed', None, None)\"\nIf I close Outlook and run it using Task Scheduler, it works.\nMy issue is that I want to run this during the workday so I don't have to remember to send it. During the workday, I always have Outlook open.\nDoes anyone know how to get it so that the scheduled task can run during the day with Outlook open? Any help would be appreciated!","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":197,"Q_Id":67841627,"Users Score":0,"Answer":"Is it possible that there is a mismatch in security contexts? Try running the script or Outlook (or both) \"as administrator.\"","Q_Score":0,"Tags":"python,windows,outlook","A_Id":67843450,"CreationDate":"2021-06-04T17:28:00.000","Title":"Python program not working when run in Task Scheduler if Outlook is open","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"What I'm trying to figure out is how to go back a position in a string.\nSay I have a word and I'm checking every letter, but once I get to a \"Y\"\nI need to check if the character before was a vowel or not. (I'm a beginner in this language so I'm trying to practice some stuff I did in C which is the language I'm studying at college).\nI'm using a For loop to check the letters in the word but I don't know if there's any way to go back in the index, I know in C for example strings are treated like arrays, so I would have a For loop and once I get to a \"Y\", that would be my word[i] (i being the index of the position I'm currently at) so what I would normally do is check if word[i-1] in \"AEIOUaeiou\" (i-1 being the position before the one I'm currently at). Now I don't know how that can be done in python and it would be awesome if someone could give me a hand :(","AnswerCount":5,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":308,"Q_Id":67846636,"Users Score":0,"Answer":"in Python, strings are iterable, so you can get the [i-1] element of a string","Q_Score":1,"Tags":"python,arrays,string,algorithm,loops","A_Id":67846652,"CreationDate":"2021-06-05T05:39:00.000","Title":"How to go back a character in a string in Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":1,"ERRORS":0,"REVIEW":0},{"Question":"I have a dataset of postal codes for each store and nearby postal codes for each. It looks like the following:\n\n\n\n\nPostalCode\nnearPC\nTravel Time\n\n\n\n\nL2L 3J9\n[N1K 0A1', 'N1K 0A2', 'N1K 0A3', 'N1K 0A4', '...\n[nan,nan,9,5,nan...]\n\n\n\n\nI know I can explode the data but that would result in tons more rows ~40M. Another preprocessing step I can perform is to remove the values in each list where the travel time is not available. However, then I would need to remove it from the nearPC list.\nIs there a way to incorporate networkx to create this graph? I've tried using\nG = nx.from_pandas_edgelist(df,'near_PC','PostalCode',['TravelTime'])\nbut I don't think it allows lists as the source or targets.\nTypeError: unhashable type: 'list'\nIs there a way around this? If not how can I remove the same indices of a list per row based on a conditional in an efficient way?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":37,"Q_Id":67876969,"Users Score":0,"Answer":"You've identified your problem, although you may not realize it.  You have a graph with 40M edges, but you appropriately avoid the table explosion.  You do have to code that explosion in some form, because your graph needs all 40M edges.\nFor what little trouble it might save you, I suggest that you write a simple generator expression for the edges: take one node from PostalCode, iterating through the nearPC list for the other node.  Let Python and NetworkX worry about the in-line expansion.\nYou switch the nx build method you call, depending on the format you generate.  You do slow down the processing somewhat, but the explosion details get hidden in the language syntax.  Also, if there is any built-in parallelization between that generator and the nx method, you'll get that advantage implicitly.","Q_Score":0,"Tags":"python,pandas,networkx","A_Id":67877145,"CreationDate":"2021-06-07T18:30:00.000","Title":"What is the best way to create a graph from a compact pandas dataframe?","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":1},{"Question":"I am building a website for myself and family in Django and React. Every time I ask them to check my process and get their opinions they get a webpage not found error or this site can't be reached. How do I make is so that anyone on my local network can check my page when its running. This is the default in flask, I don't understand why django runs like this? (safety maybe?) I can't find any good information on how to add an allow all to the ALLOWED_HOSTS section in the settings of the main app.\nI also know that you can add IP address, But I'm a noob and I don't follow how to get the ip address of all my families devices without alot of work?? Does anyone have a good solution for this??","AnswerCount":4,"Available Count":1,"Score":0.049958375,"is_accepted":false,"ViewCount":533,"Q_Id":67877796,"Users Score":1,"Answer":"It is very simple\n\njust go to your command line and type ipconfig if its windows and ifconfig if it is linux\nNote your ip address on your local network\nWrite that address in allowed hosts in settings.py\nRun command python manage.py runserver :\nTake any device connect to your local network and in its browser window type servers ip:port number\nFor eg 192.168.25.1:8080","Q_Score":0,"Tags":"python,django,networking,web-development-server","A_Id":67878659,"CreationDate":"2021-06-07T19:42:00.000","Title":"How do I make Django Website public on my local network?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":1,"ERRORS":1,"REVIEW":0},{"Question":"I want to find out when an alert happens so I can automatically accept. I've placed self.driver.switch_to.alert.accept() in various places in the code but I always get a selenium.common.exceptions.NoAlertPresentException. When I don't place it anywhere I get an selenium.common.exceptions.UnexpectedAlertPresentException. When I use expected_conditions I get a selenium.common.exceptions.TimeoutException. I don't know what to do at this point. Can anyone help?\nPython\/Django Backend. Using Selenium (Firefox)","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":47,"Q_Id":67878975,"Users Score":0,"Answer":"I don't think there's a method for that, but if you know it will happen, make a while loop with try-catch block until the alert happens","Q_Score":0,"Tags":"python,django,selenium,firefox","A_Id":67879012,"CreationDate":"2021-06-07T21:34:00.000","Title":"python selenium - how can i find out exactly when an alert happens?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I was finally able to get python 3.9.0 installed(was using 3.4.2) on my raspberry pi, however I cannot use pygame now stating \"ModuleNotFoundError: no module named 'pygame'. I know where pygame is located, but I have no idea how to get python 3.9.0 to see where it is to read it.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":62,"Q_Id":67879601,"Users Score":1,"Answer":"You have to re-install all of your packages when you upgrade to a new major version of Python.  You'll need to pip3 install xxxx again.","Q_Score":0,"Tags":"python,pygame,raspberry-pi","A_Id":67879645,"CreationDate":"2021-06-07T23:05:00.000","Title":"Newer version of python cannot find module pygame","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have been trying to import dlib, cv2, and os into my python project. I have successfully downloaded cv2 and os on the base(root) environment on conda, but i couldn't do it with dlib, so i created a virtual environment to download it, which worked. Now what i know the answer to is, when i wanna import all three at the same time, how can i access both the environments? I am currently using the base environment and therefore was able to import cv2 and os, but when it try it with dlib, i keep getting the error message \"no module named 'delib'.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":158,"Q_Id":67882128,"Users Score":0,"Answer":"Since you have used a virtual environment to install dlib, it can only be accessed inside that specific environment and not anywhere else.\nYou can install both cv2 and os in the above-mentioned virtual environment and use it for your further works instead of using the base environment.","Q_Score":0,"Tags":"python,conda,environment,dlib,virtual-environment","A_Id":67882329,"CreationDate":"2021-06-08T05:56:00.000","Title":"how can i import dlib on spyder using conda?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"I have a flask app in which it has a button to download an HTML report. The download button when hit creates an xlsx file. It worked fine until that app was running on my local server because the python code found my Downloads directory no matter what os it is using python's os module.\nNow the app is deployed on a remote server, in this case, how do you let the system know the client's download directory path where this xlsx file can then be created? Or any other pointers for a better solution if I'm missing something?","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":344,"Q_Id":67894605,"Users Score":1,"Answer":"If i understand correctly - you want to specify a directory to which the file should be downloaded on users computer when he\/she hits download button.\nThis is not possible, and is handled fully by the browser.\nBrowser processes the request\/stream of special type and then creates the output file in the  location specified by the user in browser settings. The os library which you mentioned  relates to your server machine not client, so any os opertaions that you provide in  your code will be executed on your server (like creating a file). So that's why it worked on your local machine - which was server and client at once.\nWhy it's dissalowed?\nImagine a \"virus file\" being uploaded to your C:\\Windows\\System32. Web applications could be granted control over your machine with a simple button download. The huge security issue doesnt allow for client's machine access from web application","Q_Score":0,"Tags":"python,django,flask,operating-system","A_Id":67895357,"CreationDate":"2021-06-08T21:09:00.000","Title":"Downloading a file in downloads directory - flask, python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have a  list = [D1, D2, D3, ...]  where each DX is a 2d Array of simmilar dimensions (let's say 4x5). I now want to average the DX. So my result 2d Array should for example be:\n result[0,0] = (D1[0,0] + D2[0,0] + ...) \/ len(list)\n result[0,1] = (D1[0,1] + D2[0,1] + ...) \/ len(list)\netc.\nIs there a neat function for this? I somehow can't find the correct terms for googeling this..","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":74,"Q_Id":67900753,"Users Score":0,"Answer":"You should try to use numpy.mean() . Probably you can create the same list with numpy, and then calculate the mean for axis=None, and you can get the average of the whole list of matrices.","Q_Score":3,"Tags":"python","A_Id":67900933,"CreationDate":"2021-06-09T08:53:00.000","Title":"average across list of 2d arrays [python]","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"May I know how to merge 2 excel into 1 like this in python.\nI've tried Pandas to merge it by \"name\" and keep the sequence \"index\", but no luck. as there are more than 1 location. so, the result should have 2or more location in row.\nMany thanks\n\n\n\n\nindex\nname\nprice\n\n\n\n\n1\napple\n2\n\n\n2\norange\n3\n\n\n3\ngrape\n7\n\n\n4\nbanana\n1\n\n\n5\nkiwi\n2.5\n\n\n6\nlemon\n1\n\n\n\n\n\n\n\nindex\nname\nlocation\n\n\n\n\n1\napple\nUS\n\n\n2\napple\nUK\n\n\n3\nbanana\nColumbia\n\n\n4\nbanana\nCosta Rica\n\n\n5\nkiwi\nItaly\n\n\n6\nlemon\nUS\n\n\n\n\n\n\n\nindex\nname\nprice\nlocation_1\nlocation_2\n\n\n\n\n1\napple\n2\nUS\nUK\n\n\n2\norange\n3\nN\/A\nN\/A\n\n\n3\ngrape\n7\nN\/A\nN\/A\n\n\n4\nbanana\n1\nColumbia\nCosta Rica\n\n\n5\nkiwi\n2.5\nItaly\n\n\n\n6\nlemon\n1\nUS","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":26,"Q_Id":67901251,"Users Score":0,"Answer":"you can try pd.concat to combine them.","Q_Score":0,"Tags":"python,excel","A_Id":67901292,"CreationDate":"2021-06-09T09:23:00.000","Title":"Python Merge 2 excel table in row, with not unique key","Data Science and Machine Learning":1,"Database and SQL":1,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"i can t use #%% anymore as a jupyternotebook cell. Its not marked as one or visuallized in any way. I tried reinstalling but didn t work.\nI recently had a weird message which said something like \"save code browsing activated\" and casually just clicked away.\nAny ideas how to get it back to normal?\nI programm with #%% 99% of the time so i am kind of lost right now :D\nregards martin","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":81,"Q_Id":67929520,"Users Score":0,"Answer":"Check that you are in the right Python virtual environment, inside your VS Code. If you are in a virtual environment where you do not have the ipython packages installed, that would explain it.","Q_Score":0,"Tags":"python,visual-studio-code,jupyter-notebook,interactive","A_Id":67929544,"CreationDate":"2021-06-10T23:21:00.000","Title":"VS Code Interactive notebook","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"In a python defaultdict object (like obj1), I can call obj1['hello','there'] and get item. but when the input list is variable (for example: input_list), how I can call obj1[input_list]?\nwhen I call obj1[input_list], python raise this error:\nTypeError: unhashable type: 'list'\nwhen use obj1[*input_list], python returns:\nSyntaxError: invalid syntax\nSo what is the correct way to put list as variable in defaultdict?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":28,"Q_Id":67948977,"Users Score":1,"Answer":"The error TypeError: unhashable type: 'list' states that list is not hashable, but a dict always needs a hashable key!\nIf you test my_normal_dict[2,3] you can see that it actually treats these two numbers as the tuple (2,3) because the error is KeyError: (2, 3), so you need to input a hashable iterable like a tuple.\nFor example, my_dict[tuple(my_list)] should work, as long as all the elements of the tuple itself are hashable!\nNote though: If your list is large, it may be relevant that this needs to copy all elements into a tuple.","Q_Score":0,"Tags":"python-3.x,defaultdict","A_Id":67949067,"CreationDate":"2021-06-12T12:42:00.000","Title":"how to put variable in python defaultdict call","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have a select tag, and what my logic is that after the user selects an option, we would send that response and search through the db to find similar records. The problem is how to access that data.\nAfter the user has selected an option, I would take them to other page which is just a GET request page. So how to access the select tag data(which is a POST request data) on a GET request page.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":16,"Q_Id":67951522,"Users Score":0,"Answer":"You can send selected data to server with POST and save data in SESSION\nand Redirected to Next Page","Q_Score":0,"Tags":"python,html,django,django-models","A_Id":67951583,"CreationDate":"2021-06-12T17:49:00.000","Title":"Problem while transferring data between POST request and GET in django","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm working on price drop notification application and I'm thinking of using Scrapy for that but, I am not sure how to use it for that, do i need to check the product price regularly after specific interval or is there any other way of doing that.","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":77,"Q_Id":67957259,"Users Score":1,"Answer":"Scrapy is a good way of scraping the data, but then you still need to figure out how to store the old value, and repeatedly run the scraper to check against it, and send a notification.\nFor simpler sites, without much page navigation, only using requests and BeautifulSoup is usually easier, I'd only add Scrapy into that mix to handle crawling through multi-page navigation.\n\nZyte (made by creators of Scrapy, formerly ScrapingHub) have a PaaS offering for doing automatic hourly scrapes, and within that you can call external services for notifications.","Q_Score":0,"Tags":"python,web-scraping,beautifulsoup,scrapy,scrapy-splash","A_Id":68021234,"CreationDate":"2021-06-13T10:33:00.000","Title":"How to use Scrapy for price update","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":1},{"Question":"I've been trying to save the state_dict of a Pytorch model with \ntorch.save(agent.qnetwork_local.state_dict(), filename) where  filename = datetime.now().strftime('%d-%m-%y-%H:%M_dqnweights.pth')\ntype(filename) returns str which shouldn't be a problem with torch.save() and it should output a non-empty file. Instead I get an empty file with just the date and time and nothing after that. Putting the date and in the middle of the filename results in an empty file with everything after the date and time cut off.\ntorch.save(agent.qnetwork_local.state_dict(), 'checkpoint1.pth') and any time I hardcode the string works and gives me the expected non-empty file.\nWhat is going on and how do I fix this?\nI am running this code in a Python v3.6.8 virtualenv with Pytorch v1.8.1+cpu on Windows 10.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":354,"Q_Id":67958129,"Users Score":0,"Answer":"The colon was the problem in filename = datetime.now().strftime('%d-%m-%y-%H:%m_dqnweights.pth') since it was running on windows.\nChanging it to filename = datetime.now().strftime('%d-%m-%y-%H_%M_dqnweights.pth') works as expected.","Q_Score":0,"Tags":"python,pytorch,state-dict","A_Id":68005440,"CreationDate":"2021-06-13T12:14:00.000","Title":"Save Pytorch model state_dict with datetime in filename","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I know that TextBlob ignore the words that it doesn\u2019t know, and it will consider words and phrases that it can assign polarity to and averages to get the final score.\nAre there any other problems and defects that I don't know about?\nAlso, I would like to know how it is possible to fix them.\nConsidering that we can use TextBlob both with a dictionary and through machine learning, I think a solution could be to use a larger dictionary and improve the train set.\nAre my intuitions right?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":191,"Q_Id":67977030,"Users Score":0,"Answer":"Most of the Challenges in NLP sentiment analysis tasks are semantic ones like Irony and sarcasm ambiguity in th text,Multipolarity...\nThay why TextBlob may not yield the best resulat depending on your text and if it contains multiples languges , you can add new models or languages through extensions .","Q_Score":0,"Tags":"python,sentiment-analysis,textblob","A_Id":67977101,"CreationDate":"2021-06-14T20:48:00.000","Title":"What are the cons and potenzial problems of using TextBlob to perform sentiment analysis? How could they be solved?","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Can we insert elements in the Queue if maxsize = 0 ?\nwhat Does this means:- 'A max size of zero \u20180\u2019 means an infinite queue'?\nIf we will put maxsize= 0 how can it have  infinite queue??","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":195,"Q_Id":67996374,"Users Score":0,"Answer":"When the documentation says \"the queue size is infinite\", it doesn't mean that infinite memory has been allocated for the queue, nor that you somehow could add an infinite number of elements to it. This is of course not possible, as there are always finite memory constraints.\nWhen you provide 0 to the constructor, the Queue implementation does not itself pose any limit on how many items you could add to the queue. It will dynamically allocate more memory as needed while items are being added to it. It will never \"block\" an insertion, as it would do in the case of a non-zero limit. The only constraint is available memory.","Q_Score":0,"Tags":"python,queue,stack,python-3.8","A_Id":68001759,"CreationDate":"2021-06-16T04:35:00.000","Title":"If we put maxsize = 0 in Queue . What happens then and can we insert elements after this?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am trying to use kivy as the graphical system and yet i dont know how to put inside a button and a label at the same time where label shows text and button closes popup also there is one import ant thing here it must be a function that can have editable title and contents and buttob(text) and can be launched like: self.popup(text1, text1, text3) Does anyone know how do it?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":36,"Q_Id":68001485,"Users Score":0,"Answer":"Kivy popup contents: What do you want ? Nobody can answer this !!! Give a precise question (here are some propositions for your next SO post).\nI am trying to use kivy as the graphical system: How to use kivy app as a graphical system ?\nand yet i dont know how to put inside a button and a label at the same time where label shows text and button closes popup\n\nKivy: how to add a widget (Label\/Button) to an app ?\nKivy: how to change Label text ?\nKivy: how to bind a function on a button click ?\nKivy: How to close a popup ?\n\nalso there is one import ant thing here: .\nit must be a function that can have editable title and contents and buttob(text):\n\nI think you should check out what theses terms are: POO, Inheritance, attribute, method.","Q_Score":0,"Tags":"python,python-3.x,kivy","A_Id":68016110,"CreationDate":"2021-06-16T11:07:00.000","Title":"Kivy popup contents","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I need to make an algorithm in which the person types a login and password and he has three attempts, I did a \"while x <= 3\" (ox has a value of 0) and then an if inside the while with the login and password condition . But how do I stop while asking for login and password 3 times even hitting the login and password on the first or second attempt?","AnswerCount":4,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":58,"Q_Id":68011222,"Users Score":0,"Answer":"What about the break keyword. When you want to stop the loop just use the break","Q_Score":0,"Tags":"python","A_Id":68011242,"CreationDate":"2021-06-16T23:43:00.000","Title":"Python: Stop a while when a condition do if it's true?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm using a NodeJS server to catch a video stream through a WebRTC PeerConnection and I need to send it to a python script.\nI use NodeJS mainly because it's easy to use WebRTC in it and the package 'wrtc' supports RTCVideoSink and python's aiortc doesn't.\nI was thinking of using a named pipe with ffmpeg to stream the video stream but 3 questions arose :\n\nShould I use python instead of NodeJS and completely avoid the stream through a named pipe part ? (This means there is a way to extract individual frames from a MediaStreamTrack in python)\n\nIf I stick with the \"NodeJS - Python\" approach, how do I send the stream from one script to the other ? Named pipe ? Unix domain sockets ? And with FFMpeg ?\n\nFinally, for performance purpose I think that sending a stream and not each individual frames is better and simpler but is this true ?\n\n\nThanks all !","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":293,"Q_Id":68014505,"Users Score":0,"Answer":"Finally, I found that the MediaStreamTrack API of Python's aiortc has recv().\nIt's a Coroutine that returns the next frame. So I will just port my NodeJS script to python using this coroutine to replace RTCVideoSink. No piping or whatsoever !","Q_Score":0,"Tags":"python,node.js,ffmpeg,webrtc,mkfifo","A_Id":68017298,"CreationDate":"2021-06-17T07:07:00.000","Title":"Sending video stream from NodeJS to python in real time","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I've deinstalled and reinstalled a bunch of Python Versions and edited my system variables in order to clean up the quagmire of pip not being able to install packages to the right locations. Long story short: Sublime now can't find numpy (or any 3rd party module), because it somehow figured that the python 2.3 version that comes with ChemDraw is the one I really want to use, not the 3.9 version I had used previously.\nI've tried a bunch of tutorials online (such as resetting everything to factory settings) however nothing seems to unlink the python build system from that python 2.3 version that came with ChemDraw. Even deinstalling everything and installing Sublime 4 keeps that association. Like...how?\nSo here's my problem: My build system for python is linked to the wrong python version and I don't know how to link it to the python 3.9 that's located in AppData\/Programs.\nHow can I associate the python.exe of python 3.9 in AppData with my python Build System instead of the current python 2.3, which is located ProgramFiles?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":177,"Q_Id":68022896,"Users Score":0,"Answer":"Ok, so the problem was that there was a system variable called PYTHONPATH, which I don't remember setting. It seems that Chemdraw, if installed with ChemScript, installs it's own python installation, which is 2.X.\nThat python install seems to set its own system variable called PYTHONPATH, which Sublime seems to prioritize for it's default python build system.\nDelete whatever incorrect path is set in PYTHONPATH and paste the following into it instead:\nC:...\\Python\\Python39\\Scripts;C:...\\Python\\Python39;C:...\\Python\\Launcher;","Q_Score":0,"Tags":"python,windows-10,sublimetext3","A_Id":68028070,"CreationDate":"2021-06-17T16:06:00.000","Title":"How do I reset the python build system in Sublime Text 3 on WIndows 10?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have a 1 dimensional array. I want to get a certain percentile(say,5%) of the fitting of this data(Monte Carlo method is best, guassian KDE method is also OK) as fast as possible. Because this function is used millions of times.\nMy way is using the scipy gaussian_kde.\nMy question is:\n\nAny other ways to get higher speed of gaussian_kde?\nMain cost is kde = gaussian_kde(x, bw_method=0.02) #about 220us","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":143,"Q_Id":68029471,"Users Score":0,"Answer":"You seems to rewrite a well-optimized function of Numpy called np.quantile. Calling np.quantile(x, 0.05) provide the exact\/accurate 5% quantile and is 4 times faster than your optimized implementation! Note that if you need to call this functions a lot of time on different independent arrays, then you can speed up the computation even more thanks to Numba parallelism.","Q_Score":0,"Tags":"python,performance,numba,data-fitting,processing-efficiency","A_Id":68039465,"CreationDate":"2021-06-18T04:50:00.000","Title":"How to speed up data fitting and get percentile function","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"In timeseries analysis I want to set date as an index but one date has 500 entries 50 for each item and 10 for each store. In such case how can I make date as an index.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":45,"Q_Id":68045820,"Users Score":0,"Answer":"How are you! First off, why do you need de time as index, maybe you can reconsider that idea?\nAnyway using datetime should work and the chances to get a duplicate record is minimal","Q_Score":0,"Tags":"python,time-series,data-science","A_Id":68046143,"CreationDate":"2021-06-19T10:18:00.000","Title":"How to make date as an index in timeseries analysis if I have duplicate dates for each item and store in dataset","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm trying to see if a function returns an integer who's value should be either a 1 or 0.\n0 == (1 or 0)\n0 is equal to 1 or 0, this sounds like it should be true, but it's not.\nWhy? And how to do what I'm looking to do correctly?","AnswerCount":3,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":97,"Q_Id":68047398,"Users Score":0,"Answer":"You are using the brackets. Which means you are forcing precedence on it. so python will first evaluate the expression 1 or 0  which is 1.  and then it will evaluate the next part,  0 == 1   which is false.","Q_Score":2,"Tags":"python,equals,boolean-logic","A_Id":68047448,"CreationDate":"2021-06-19T13:50:00.000","Title":"In Python, 0 == (1 or 0), returns False. Why doesn't it return True?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm trying to see if a function returns an integer who's value should be either a 1 or 0.\n0 == (1 or 0)\n0 is equal to 1 or 0, this sounds like it should be true, but it's not.\nWhy? And how to do what I'm looking to do correctly?","AnswerCount":3,"Available Count":2,"Score":0.2605204458,"is_accepted":false,"ViewCount":97,"Q_Id":68047398,"Users Score":4,"Answer":"1 or 0 evaluates to 1, and since 0 is not equal to 1, the expression is false.\nI suspect what you are trying to do is something like 0 == 0 or 1 == 0","Q_Score":2,"Tags":"python,equals,boolean-logic","A_Id":68047423,"CreationDate":"2021-06-19T13:50:00.000","Title":"In Python, 0 == (1 or 0), returns False. Why doesn't it return True?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I want to remove FC layer of VGG16 and add UNet layers. I don\u2019t know how I can fine tune VGG16.","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":105,"Q_Id":68053977,"Users Score":0,"Answer":"I tried to fit model on my data using suggested changes. Features are now extracted and saved in dataframe and as a csv file. When I tried to give it to classifier it gives error on training on these features. Error was got 6 columns instead of 8 or got 9 columns instead of 8. The problem was in values in csv file. The command used in training classifier was on this line\nX_train = genfromtxt(X_train_file_path, delimiter=',')\nValueError: Some errors were detected !\nLine #2 (got 7 columns instead of 8)\nSecondly, Can you please guide me in adding encoder decoder blocks of unet.","Q_Score":0,"Tags":"python-3.x,unity3d-unet","A_Id":68075317,"CreationDate":"2021-06-20T08:21:00.000","Title":"Replace Vgg16 FC layer with UNet","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am currently working on a program with Kivy and Python that solves quadratic equations. Because the user has to enter his quadratic function or the values \u200b\u200bof the variables, I wanted to ask how exactly this works with Kivy and Python.\nIn Python it works with a = float(input(print(\"Your a: \"))).\nBut how do I save an input as a variable in the form \"float\" so that I can calculate with it?\nThank you!","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":31,"Q_Id":68057174,"Users Score":0,"Answer":"I don't know exactly what you are asking for. To save an input as a float in a variable, just do a = float(input(\"Your a: \")), and then to calculate with that you can do x = a + 89, or print(a**2). Hope I solved your question.","Q_Score":1,"Tags":"python,kivy","A_Id":68057419,"CreationDate":"2021-06-20T15:07:00.000","Title":"How can I calculate with Inputs from Kivy (Python)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I want to edit the aged payable xlsx report in Accounting->Report->Aged payable odoo14. However, I am not getting the report template in the odoo sh staging branch editor console. Where can I find the model and the template in the file system?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":138,"Q_Id":68066061,"Users Score":1,"Answer":"These type of reports are one of the technical implementations in Odoo. These reports are implemented via sql queries based in functions.\nYou can find their implementation in enterprise > account_reports > models.\nIn models folder, multiple files have respective report implementations like partner ledger, aged receivable and payable.","Q_Score":0,"Tags":"python,odoo-14","A_Id":68073824,"CreationDate":"2021-06-21T10:12:00.000","Title":"What is the file path of account.aged.payable model and how to edit aged payable report?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm new to python and was trying to create a python bot, I wanted a optimized way to modify and access my bot configs per server. I had 2 ideas on how\/when to fetch configs from the database for optimization.\n\nthis is what you would normally do - just fetch data variables(fetch a variable at a time) for each command, this would keep the bot simple and minimize unused recources.\n\nIn this one, whenever the user uses a command for the first time, it fetches the entire config table and stores it in a loaded dict from which you can access the config from. you can also update the config in the dict and every 30m-1hr it will log the values in the table and empty the dict. The benefit of this one is less sql calls but potentially less scalability because of unused objects in the dict.\n\n\nCan someone help me decide which one is better, i dont know normally how you would make discord bots or the convention.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":264,"Q_Id":68077892,"Users Score":0,"Answer":"Your second approach is called caching the data. You're basically creating a cached database in your application (the dictionary) and save a bunch of usually necessary data to access them quickly. It is what every (almost every) major service (like Steam) does in order to minimize the main database calls.\nI think this is the better practice however it has its drawbacks.\nFirst, from time to time, you have to compare the cached data with what you have in the original database because your bot will not have a single user and while the cached data is available to one user, another user might alter the data in the original database.\nSecond, it is harder to implement than the first approach. You need to determine which data to store, which data to update rapidly and also you need to implement an alarm system for the users to update their cache whenever the main data is altered in the database.\nIf I were you and I just wanted to mess around with bots, I would go with just fetching the data each time from the database. It's easier and it is good enough for most applications.","Q_Score":0,"Tags":"python,discord.py","A_Id":68078074,"CreationDate":"2021-06-22T05:16:00.000","Title":"How to implement sql databases in discord.py bot","Data Science and Machine Learning":0,"Database and SQL":1,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":1},{"Question":"I have abc.pth file which is a feature file. I want to determine the shape\/dimension of this file through google colab. how to load it and determine its shape?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":155,"Q_Id":68101600,"Users Score":0,"Answer":"path=\"\/path\/to\/abc.pth\"\nimport torch a=torch.load(path) a.size()\n\nand it will output the tensor\n\ntorch.Size([1, 2048, 19, 29])","Q_Score":0,"Tags":"python,model,google-colaboratory,shapes,dimension","A_Id":68101945,"CreationDate":"2021-06-23T14:14:00.000","Title":"How to determine shape of .pth file in google colab","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"def browse_base(self):\noption=QFileDialog.Options()\nfile=QFileDialog.getOpenFileName(widget,\"Open Single File\",\"CC\",\"All Files(*)\",options=option)\nself.base_addr.lineEdit.setText(file[0])\n\nI have a problem here: 'QLineEdit' object has no attribute 'LineEdit'\nAnd i don`t know what i need to do","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":138,"Q_Id":68103952,"Users Score":1,"Answer":"It looks like you're assuming that self.base_addr has a lineEdit attribute that is a QLineEdit, but it seems that self.base_addr itself is already a QLineEdit (which has no lineEdit attribute), so that using just self.base_addr.setText(file[0]) should probably work.\nHowever, this may just be the tip of the iceberg, but it is very hard to tell from the code in your question.","Q_Score":0,"Tags":"python,qlineedit","A_Id":68104204,"CreationDate":"2021-06-23T16:41:00.000","Title":"'QLineEdit' object has no attribute 'LineEdit'","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Is there a way to know which codes on github are in python 3? So far, I haven't any mentionned.\nTks","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":23,"Q_Id":68104525,"Users Score":0,"Answer":"Very simply:\n\nYes, you can find Python3 code.\nNo, you cannot do so effectively.\n\nCode on GitHub is not identified by language and version -- obviously, since you would have found that in your investigations before coding.  Yes, you can generally determine the language of a code file, but only with detailed examination -- you would almost need to pass the file to a Python compiler and reject any with syntax errors.  This is not an effective process.\nYou can reduce the search somewhat by gleaning *.py files and then look for frequent, 3-specific features, such as all print commands using parentheses (coding style in Python 2, mandated in Python 3).  This merely reduces the problem; it does not give you a good request mechanism.","Q_Score":0,"Tags":"python,github,version","A_Id":68104645,"CreationDate":"2021-06-23T17:23:00.000","Title":"how can I find python 3 codes only on github?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have a compatibility issue when running :\npip install numpy==1.19.4\npip install tensorflow=2.5.0\npip install gensim==4.0.1\nOn Ubuntu 18.04, with Python 3.9.5 (installs made inside docker container).\nI get the following exception when trying to import gensim:\nValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 88 from C header, got 80 from PyObject. \nNot sure how i can make this work, I tried downgrading several libraries but still not achieved to make it work in Ubuntu.\nEdit : it works on Python 3.8.10","AnswerCount":2,"Available Count":2,"Score":0.0996679946,"is_accepted":false,"ViewCount":1459,"Q_Id":68106023,"Users Score":1,"Answer":"Tensorflow is currently not compatible with numpy 1.20.\nAlso, many changes happened from gensim 3.X to 4.X, which may lead to some problems.\nTry installing the following setup:\n\nnumpy 1.19.2\ngensim 3.8.3\ntensorflow 2.3.0","Q_Score":2,"Tags":"python,numpy,tensorflow2.0,gensim","A_Id":69700092,"CreationDate":"2021-06-23T19:24:00.000","Title":"Tensorflow 2.5.0 and Gensim 4.0.1 compatibility with numpy","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":1,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"I have a compatibility issue when running :\npip install numpy==1.19.4\npip install tensorflow=2.5.0\npip install gensim==4.0.1\nOn Ubuntu 18.04, with Python 3.9.5 (installs made inside docker container).\nI get the following exception when trying to import gensim:\nValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 88 from C header, got 80 from PyObject. \nNot sure how i can make this work, I tried downgrading several libraries but still not achieved to make it work in Ubuntu.\nEdit : it works on Python 3.8.10","AnswerCount":2,"Available Count":2,"Score":0.0996679946,"is_accepted":false,"ViewCount":1459,"Q_Id":68106023,"Users Score":1,"Answer":"It is the numpy version , downgrade numpy to 1.19.2 or lower and see.","Q_Score":2,"Tags":"python,numpy,tensorflow2.0,gensim","A_Id":68225538,"CreationDate":"2021-06-23T19:24:00.000","Title":"Tensorflow 2.5.0 and Gensim 4.0.1 compatibility with numpy","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":1,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"I want to run python script on google cloud using android studio\n\nex: I have an android application which contain button and google cloud VM instance which has a python script.\nI want when click button, the script is run and output send to storage.\nhow I can do that ?","AnswerCount":1,"Available Count":1,"Score":-0.1973753202,"is_accepted":false,"ViewCount":94,"Q_Id":68124052,"Users Score":-1,"Answer":"I suppose you're running a linux-based distribution as your operating system. I think that you could do that by sending a command to the VM via ssh, and by using pipes in linux you could direct the output to a specific file.\nLet's say you have your python script named script_one.py\nWith this command python3 script_one.py > output.txt you basically run the script and the output of it is stored in the file output.txt in the same directory where the python script is, now of course you could use absolute or relative path to redirect your output to another place.\nDepending on the language you're developing your application in, this can be implemented in different ways.","Q_Score":0,"Tags":"python,android,google-cloud-platform,google-compute-engine","A_Id":68124117,"CreationDate":"2021-06-25T00:22:00.000","Title":"How to run python script on google cloud using android studio?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have a Python script that creates a new user and configures it, I want this to be ran anytime a user SSHs into the server but the username isn't a valid one, how could I do this?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":28,"Q_Id":68138743,"Users Score":0,"Answer":"That is an incredibly bad idea. How would they learn what password you assigned? Consider how easy it would be to write a denial of service attack to log in as millions of unknown users. Hackers do that EVERY DAY to any public-facing server. Much better idea to have a web site where people register for a new username.","Q_Score":0,"Tags":"python,ssh","A_Id":68139097,"CreationDate":"2021-06-26T02:34:00.000","Title":"How to run a script if a user SSHs into an non-existent user?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Assuming there are 2 tables in one page. table 1 shows the list of all items and table 2 shows the list of all deleted items. whenever i click delete button the corresponding row from table 1 is moved to table 2.\nI am not sure how to do all these in one page!","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":53,"Q_Id":68140186,"Users Score":0,"Answer":"Once, you click delete, you send a request to the server, once you get the response, you run an animation where you remove row and put on another table, this can be done by giving an id to your tr and then remove id and adding to the top of the 2nd table.","Q_Score":1,"Tags":"python,html,django,django-models","A_Id":68140791,"CreationDate":"2021-06-26T07:30:00.000","Title":"How to update 2 tables in one page in django","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I want to get feature value of an object with YOLOv5. I'm guessing there is a hint in \"detect.py\" in opensource.\nHow can I get feature value of the object used for inference?Please tell me how to resolve.","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":96,"Q_Id":68157783,"Users Score":1,"Answer":"The variable 'det' inside the def run in detect.py(line 181), you can know the xyxy value, the confidence score, and the number of class name of the object.\nSince 'det' is a tensor data type, you will need to converting 'det'.\nIf you want to get only the number of class name of the object, you can easily get it by converting cls in detect.py(line 205) like 'int(cls)'.","Q_Score":0,"Tags":"python,pytorch,image-recognition,yolov5","A_Id":69999445,"CreationDate":"2021-06-28T04:58:00.000","Title":"I want to get feature value of an object with YOLOv5","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Basically I am writing a script to reset a django webapp completely. In this script, I want to reset the database, and there is a command to do it from django extensions. Unfortunately, I haven't been able to run it programatically. It works fine when I run it via command line, but it just won't execute when I try programatically.\nI have tried using os.system and subprocess.\nI have also tried using management.call_command('reset_db'), but it keeps saying that there isn't a command called reset_db. I have checked to make sure the django_extensions is in my installed apps, so I have no idea why that isn't working.\nDoes anyone know how I could fix this? Thank you!\nAlso I am using python3, the most recent version of django I believe, and it is a MYSQL server that I am trying to delete.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":98,"Q_Id":68168855,"Users Score":0,"Answer":"I can't know without seeing your way of invocation directly, but my guess is the script's not running in the virtualenv. Here are some debug notes:\n.\/manage.py --help | grep reset_db: Does this output anything?\n.\/manage.py shell_plus\nThen try:\n\nfrom django.core.management import call_command\ncall_command('reset_db', '--help')\n\nAnything then?\nAlso within .\/manage.py shell_plus, try import django_extensions\nOutside of the shell, try this: pip show django, pip django-extensions.\nIf it doesn't show those (e.g. WARNING: Package(s) not found: django-extension) and you think they're already installed, try this:\nwhich python, which pip. Are you using venv, virtualenv, virtualenvwrapper, pipenvorpoetry`?\nTry env | grep VIRT, do you see a VIRTUAL_ENV? If not you may need to make one.\nWhen you run the script, you need to have your environmental variables set so you hook in to your site packages. In poetry we can do poetry run .\/manage.py ourscript or poetry run .\/ourscript.py without needing to be sourced. But we can also easily drop into virtualenv via poetry shell.\nIf you created an environment like virtualenv -ppython3.8 .venv, you can either do:\nsource .venv\/bin\/activate, .\/myscript.py, rr you can try .venv\/bin\/python .\/myscript.py","Q_Score":0,"Tags":"python-3.x,django,django-extensions","A_Id":69920136,"CreationDate":"2021-06-28T19:10:00.000","Title":"Having trouble running the django extensions command reset_db programatically","Data Science and Machine Learning":0,"Database and SQL":1,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"There is an exe of the compiled python file 3.9 version.\nexe is 100% packed by pyinstaller\nDecompiled exe, moved 1 line from abc.pyc to main.pyc Launched uncompyle6, gave an error\nAttributeError: module 'xdis.opcodes.opcode_39' does not have attribute 'END_FINALLY'\nTried decompyle3 the same error. Who knows how to fix it?","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":319,"Q_Id":68169432,"Users Score":1,"Answer":"Support for Python 3.9.5 is added in xdis 5.0.10; it is not available in 5.0.9.","Q_Score":1,"Tags":"python,python-3.x","A_Id":68169601,"CreationDate":"2021-06-28T20:06:00.000","Title":"Why does an error occur when decompiling through Uncompyle6","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"I am extremely new to coding. I have been completing a Udemy course and everything has been going smoothly until I installed Visual Studio (as per the course instruction), however, I think I change the python path during the installation\/setup of Visual Studio.\nI don't really know how this works, but is it the case that I changed the path (from the one during the python installation process) to a different path associated with Visual Studio? I remember clicking\/accepting something to do with PATH on Visual Studio, and now when following the course structure and trying to run the code from Visual Studio on Git Bash, I am hit with the:\n\"Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Manage App Execution Aliases.\"\nI have troubleshooted to 'environment variables', but I am not grasping how to perform the edit so that the python path is back to how it was.\nI have two paths it seems:\n\nC:\\Users********\\AppData\\Local\\Programs\\Python\\Python39\\Scripts\\\n\nand\n\nC:\\Users********\\AppData\\Local\\Programs\\Python\\Python39\\\n\nI don't quite understand how the 'move up' and 'move down' functions work.\nCould somebody please put this n00b out of their misery. Please XD","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":77,"Q_Id":68173574,"Users Score":0,"Answer":"these two paths are coreect you dont have to edit these. when you install python these two paths qre added to your envirnoment variables path","Q_Score":1,"Tags":"python,visual-studio,path,environment-variables","A_Id":68173608,"CreationDate":"2021-06-29T06:23:00.000","Title":"How to edit Python path - I think I accidentally changed it after installing Visual Studio","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I would like to ask if it's possible to run a set of tests written in python (pytest)\non a running NodeJS application running in Docker?\nWhat I want to achieve:\n1.setup github action to run and build the 'test Docker container' on pull_request (done)\n2.run pytest as soon as the node container starts (pending)\n3.run another github workflow based on the test results of pytest (there is also a question how to achieve it,I saw somewhere that maybe cypress can help)\nPlease let me know if I should provide Dockerfile if it's necessary\nthanks in advance","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":744,"Q_Id":68176685,"Users Score":0,"Answer":"Solved by using ENTRYPOINT in Dockerfile, where I put my bash script which run npm start & pytest -c xxx","Q_Score":0,"Tags":"python,node.js,docker,github,pytest","A_Id":68224989,"CreationDate":"2021-06-29T10:11:00.000","Title":"How to run pytest tests after docker container starts","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"When doing recommendation system (collaborative filtering) for retail business, there are no actual rating (like 1-10 satisfactory with the item).\nTherefore, I use no. of times each user purchase a certain item as implicit rating. However, in doing so, there could create bias between slow-moving products (such as Television) and fast-moving products (such as Chips, Snacks) since the no. of times customers would buy the slow-moving products are much less than fast-moving ones.\nMy questions are :\n\nIs there anything better than no. of times a customer buys the certain items or visit counts to use as rating?\nHow do you add weight to help lessen the bias between slow-moving and fast-moving items.\n\nThank you for your answer in advanced!","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":55,"Q_Id":68181573,"Users Score":1,"Answer":"Attempting to answer your specific questions:\n\nYes, but it depends on what other information you have about the items. I have tried to answer making some reasonable assumptions.\n\nI can presume that you have the cost of the item. You can normalise by the cost of the item to ensure some reduction (not complete removal) of bias. You can do a direct normalisation (weighted_rating = implicit_rating * cost per item). Here, the cost_per_item serve  the purpose of weights to reduce bias. Alternatively, you can experiment with groups of prices by binning or clustering the prices across all items to form groups of products, thereby giving you a  group_mean_price. This can then be used as weights.\n\n\nIf you know something else about the item (such as perishable\/ consumable\/ bulky) you can have more representative clusters. Thereafter, you can assign implicit_rating to each item. Now, you can normalise each implicit_rating by using an aggregate statistics for the group rating (say group_mean_implicit_rating). So, weighted_rating = implicit_rating\/group_mean_implicit_rating","Q_Score":1,"Tags":"python,recommendation-engine,collaborative-filtering","A_Id":68185044,"CreationDate":"2021-06-29T15:22:00.000","Title":"When creating recommendation system for multiple types of products, how do you deal with bias in implicit rating?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have made a Flask API for a spacy ner code and deployed it on Docker. In the code I have used python's logging to return the outputs to a file, info.log.\nThe question is, how to access the log file in the container after running it.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":239,"Q_Id":68194502,"Users Score":0,"Answer":"Since I had to look for a long time, I picked up bits of answers from different places and am compiling it here for anyone who is stuck.\nAfter running the container, go to the terminal and post the following commands.\n(I used pycharm and the terminal started inside the directory where my code and dockerfile were stored)\ndocker ps\n(this shows the containers running currently)\ndocker exec -it 'container-name' bash\n(now you have entered the container)\nls -lsa\n(this will show all the files in the container, including the log file)\ncat info.log\nNow, you can see the log file contents on the terminal.","Q_Score":0,"Tags":"python,docker,logging","A_Id":68194646,"CreationDate":"2021-06-30T12:09:00.000","Title":"Python logging in Docker. How to access log file formed inside the Docker container","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Hello I have a selenium script in python which extract data with login on webpage. It take around 50 sec to execute and I want to deploy that script as an api. But API is getting timeout.\nThere we can also do one thing that we save that data in some google sheet using that script.\nPlease anyone can suggest how can i do this or any relevant content ?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":30,"Q_Id":68203428,"Users Score":0,"Answer":"Could you provide us a screenshot of API timeout or logs? Showing Python code with requests will be also helpful (sorry for answering instead of commenting because I don't have enough reputation points)","Q_Score":0,"Tags":"python,selenium,deployment","A_Id":68207129,"CreationDate":"2021-07-01T02:07:00.000","Title":"Deploy Scraping Scripts in python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have a small application built using python and tkinter, and I want  that application to run on startup.\nHere I have few questions\n\nMy question is how do I actually set the app to run at startup.\nMy application needs to login, but I don't understand how I can connect, application with database without placing database credentials in user's downloaded application.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":49,"Q_Id":68205660,"Users Score":0,"Answer":"There are 2 points here:\n\nhow to set-up an application to run at start-up?\nIf what you call startup if the machine startup before any user logs in, then the answer will depend on the OS. You will have rc scripts on Unix (and Unix-like) systems, or services on Windows.\n\nhow can an unattented application connect to the database?\nA common way is to have the application run under a dedicated login (user name). Then you configure the database to accept passwordless connections from that specific login on that specific machine (ideally the same one). Of course that login should have the less possible privileges...","Q_Score":0,"Tags":"python,postgresql,authentication,exe,app-startup","A_Id":68205893,"CreationDate":"2021-07-01T07:00:00.000","Title":"How do I set a program to run on startup and how desktop application's login check done","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm using PyCharm and also installing dependencies with pip I dont know how to make PyCharm to get this new dependencies that I install and are in the folder {project_base}\/env\/lib\/python3.9\nIf I go there I can see the libraries installed, but PyCharm is not able to seen it, and allow me to use it in the code.\nI've seen in the preference the Python Interpreter section, but I need to use pip, since I'm documenting the package to install with pip for other users.\nAny idea how to point my PyCharm to my env\/lib\/ folder?\nRegards","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":238,"Q_Id":68207031,"Users Score":1,"Answer":"When you choose Python Interpreter, PyCharm will automatically pick up libraries available on that Python installation.\nMake sure PyCharm uses the Python Interpreter that has its libraries installed in env\/lib\/python3.9 and then you should see available libraries on the interpreter configuration screen.\nIf you install libraries with pip e.g. env\/bin\/python -m pip install mylib they will become automatically available to PyCharm, because PyCharm and pip will use the same Python installation to manage these libraries.","Q_Score":0,"Tags":"python,python-3.x,pycharm","A_Id":68207337,"CreationDate":"2021-07-01T08:41:00.000","Title":"How does PyCharm find libraries installed with pip","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":1,"ERRORS":0,"REVIEW":0},{"Question":"Created Pythonshell with simple script, like just requests.get(<elasticsearch_endpoint>). Elasticsearch cluster is in VPC.\nI tried using self-referencing groups, endpoints but nothing worked. Also custom connection with JDBC fails Could not find S3 endpoint or NAT gateway for subnetId (but it exists).\nI see that for Spark jobs ESConnector is available but can not find any working way to make it with Pythonshell jobs. Is there any way to allow such connection?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":141,"Q_Id":68210056,"Users Score":0,"Answer":"Solved, I was missing route to NAT gateway in private subnet.","Q_Score":0,"Tags":"python,amazon-web-services,elasticsearch,aws-glue,amazon-vpc","A_Id":68223839,"CreationDate":"2021-07-01T12:19:00.000","Title":"AWS Glue pythonshell job - how to connect to elasticsearch in VPC?","Data Science and Machine Learning":0,"Database and SQL":1,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I ssh'd into a linux server to run Airflow. I have made the scheduler(airflow scheduler -D) and database initialized (airflow db init). However, even when trying to create the simplest of DAGs using python (I also tried using Airflow's predefined example py scripts), Airflow does not list the DAG when running the airflow dags list command.\nI'm sure the syntax of my py code is correct because the DAG showed up on a windows instance but my setup for airflow within Linux is somehow not correct? Also used python3 script.py to execute.","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":71,"Q_Id":68215454,"Users Score":1,"Answer":"Basically the dags folder's permission's weren't allowing anything to be written into it. I just sudo'd every command or chmod the folder. Also to ensure Airflow was correctly run, I suggest using a YAML file with docker compose to streamline Airflow setup.","Q_Score":1,"Tags":"python,airflow,directed-acyclic-graphs","A_Id":68230557,"CreationDate":"2021-07-01T18:44:00.000","Title":"Running python scripts does not create Airflow DAG?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have a single pdf with multiple copies of the same document merged into one. I want to digitally sign each and every copy, meaning the pdf must have multiple digital signatures. I'm using endesive library in Python to digitally sign the PDF. The signature is showing as valid when I sign the document once but when I'm writing the same signature multiple times, it shows that the signature is invalid (when opening the document). Is it right to digitally sign a document multiple times and if yes, how to achieve it using Python's endesive library?","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":429,"Q_Id":68224063,"Users Score":0,"Answer":"There is a strong difference between digital and manual signature: with a manual signature, you add a signature on a paper sheet, and you can\/must separately sign each page.\nWith a digital signature, you sign a whole document seen as a sequence of bytes. AFAIK, there is no way to have different signatures on different parts of the document.\nWhat is possible is to assemble the parts into a large document and then sign the final document. That final signature will be an evidence that the signer attests that the document is valid at the time they signed it, and that it has not be tampered since that point.\nA common usage for multiple signature is to prove that many human beings all agree with the content of a document. In administrative processes, an employee prepares a document, signs it to marks that they are responsible for the content, and a manager signs again to mark that the document has been controlled.","Q_Score":0,"Tags":"python,pdf,digital-signature","A_Id":68225276,"CreationDate":"2021-07-02T11:02:00.000","Title":"Can a pdf be signed multiple times using python endesive library?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have a single pdf with multiple copies of the same document merged into one. I want to digitally sign each and every copy, meaning the pdf must have multiple digital signatures. I'm using endesive library in Python to digitally sign the PDF. The signature is showing as valid when I sign the document once but when I'm writing the same signature multiple times, it shows that the signature is invalid (when opening the document). Is it right to digitally sign a document multiple times and if yes, how to achieve it using Python's endesive library?","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":429,"Q_Id":68224063,"Users Score":0,"Answer":"In order to make multiple signatures, you must incrementally save the pdf, each time you add a signature.\nIf you use PyMuPDF to build the document, you must save as\nsaveIncr()\nPDF only: saves the document incrementally. This is a convenience abbreviation for doc.save(doc.name, incremental=True, encryption=PDF_ENCRYPT_KEEP).\nwrite(garbage=0, clean=False, deflate=False, deflate_images=False, deflate_fonts=False, ascii=False, expand=0, pretty=False, encryption=PDF_ENCRYPT_NONE, permissions=- 1, owner_pw=None, user_pw=None)\n(Changed in v1.18.3)\nPDF only: Writes the current content of the document to a bytes object instead of to a file. Obviously, you should be wary about memory requirements. The meanings of the parameters exactly equal those in save(). Chapter Collection of Recipes contains an example for using this method as a pre-processor to pdfrw.","Q_Score":0,"Tags":"python,pdf,digital-signature","A_Id":69023338,"CreationDate":"2021-07-02T11:02:00.000","Title":"Can a pdf be signed multiple times using python endesive library?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm trying to be able to deploy a project that I made with pyqt5 using pyqtdeploy, I read the whole documentation, which sucks (sorry for the language), I even read the 1.3.2 version, and I still don't know how to make it work. I installed all the packages (using pip and the downloadable files for the demo) and run the setup, but I don't see the executable pyqtdeploy mentinned in the documentation, and the build-demo.py does not work.\nI'm on Windows by the way,","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":134,"Q_Id":68231530,"Users Score":0,"Answer":"This is not an answer but can sort of one since it \"solve\" the problem\nOK I took a look at the whole code and to add to the fact that there are not the executable in it (the one mentioned in the documentation), all the imports are incorrect, and we have to either rename all the files or modify the import, I think that I'm just going to change and stick with pyinstaller, even if we can only do .exe.\nHowever if someone have figured out how to make it work, I would like to know","Q_Score":0,"Tags":"python,qt,pyqt,pyqt5,pyqtdeploy","A_Id":68232378,"CreationDate":"2021-07-02T21:47:00.000","Title":"pyqtdeploy issue with how to proceed","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am creating a discord bot and I use a JSON file to store everyone's data , the problem is that when I have to update my game and if I upload the code to Heroku it will rewrite everyone's data there is two ways I can fix this,\nGet the JSON file from Heroku\nor Rewrite the code in Heroku with the new code (best option)\nIf you know how to do either of these commands please let me know down below! :)","AnswerCount":3,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":63,"Q_Id":68235430,"Users Score":0,"Answer":"Either way is to use heroku postgres database which will help you to store data...","Q_Score":0,"Tags":"python,json,heroku,heroku-cli,heroku-api","A_Id":68235779,"CreationDate":"2021-07-03T10:37:00.000","Title":"How do I replace or get a file in Heroku","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am creating a discord bot and I use a JSON file to store everyone's data , the problem is that when I have to update my game and if I upload the code to Heroku it will rewrite everyone's data there is two ways I can fix this,\nGet the JSON file from Heroku\nor Rewrite the code in Heroku with the new code (best option)\nIf you know how to do either of these commands please let me know down below! :)","AnswerCount":3,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":63,"Q_Id":68235430,"Users Score":0,"Answer":"I am using repl.it to host my bot now and it works so far, freecodecamp made a great video explaining how to host a discord bot on youtube","Q_Score":0,"Tags":"python,json,heroku,heroku-cli,heroku-api","A_Id":68236640,"CreationDate":"2021-07-03T10:37:00.000","Title":"How do I replace or get a file in Heroku","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am new to game development. I am trying to start high and make a 3D RPG. I know the road is not gonna be easy. That is why i decided to use Ursina and python to make my game.\nHowever i wanna add a cutscene showing a Backstory. I have the video in mp4 format but i cannot seem to know how to play it inside the game with Ursina.\nAnyhelp will be much appreciated.\n(Side question : do you think Ursina is good for a beginner in 3D gaming? If i want to publish my game on my website, isn't it better for me to learn javascript ? I read about Unity but it is too big to download for a little side project)","AnswerCount":3,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":356,"Q_Id":68248623,"Users Score":0,"Answer":"From Entity Basics in the documentation:\ne4 = Entity(model='cube', texture='movie_name.mp4') # set video texture","Q_Score":0,"Tags":"python,python-3.x,video,game-engine,ursina","A_Id":69452775,"CreationDate":"2021-07-04T20:35:00.000","Title":"How to play MP4 with Ursina in Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am new to game development. I am trying to start high and make a 3D RPG. I know the road is not gonna be easy. That is why i decided to use Ursina and python to make my game.\nHowever i wanna add a cutscene showing a Backstory. I have the video in mp4 format but i cannot seem to know how to play it inside the game with Ursina.\nAnyhelp will be much appreciated.\n(Side question : do you think Ursina is good for a beginner in 3D gaming? If i want to publish my game on my website, isn't it better for me to learn javascript ? I read about Unity but it is too big to download for a little side project)","AnswerCount":3,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":356,"Q_Id":68248623,"Users Score":0,"Answer":"Well, I don't think there is a way to do that. the closest thing you can do to that is having a folder filled with all the frames of your video in .png or .jpg files, then adding a quad to the world and changing the texture of it to the next frame every fraction of a second depending on the framerate. this, however would make your computer l a g. trust me, I've tried it. it would probably be better to have a separate window with some sort of module that plays .mp4 files for playing the file.\nIn other words, there is no feasible way to do that.","Q_Score":0,"Tags":"python,python-3.x,video,game-engine,ursina","A_Id":69451218,"CreationDate":"2021-07-04T20:35:00.000","Title":"How to play MP4 with Ursina in Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I need to fetch swipe up count which show in the insights of Instagram.As Facebook is not providing swipe up count through their graph API so how can I get that data.\nScraping won't work as I already did and I want to fetch those data in python or javascript\nThanks in advance for help","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":116,"Q_Id":68270054,"Users Score":2,"Answer":"for now facebook is not providing this data in graph-api and it is only provided in influences in insights so for now its not possible for now to fetch but you can get by web scraping\nFacebook can provide this data in next version of graph-api","Q_Score":2,"Tags":"python,django,angular,typescript,facebook-insights","A_Id":69811687,"CreationDate":"2021-07-06T11:51:00.000","Title":"How to fetch swipe up count from Instagram story insights graph API?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am learning how to use PyQt5 and there are quite a few points that elude me.\nI have started implementing QThreads to replace the threads I have been using in my UI as I realised that mixing threads and QThreads could possibly lead to issues later and have started using pyqtSignal simultaneously\nSo far I have seen that the pyqtSygnal needs to be implemented on a class level to be able to work ( putting it in a class constructor does not work )\nIn the architecture I use currently, I have a pyqtSignal that is instantiated in the main thread and is then used by all of the child threads. This is due to having one class that is responsible for my logs of all the program.\nI am unsure if this is a good implementation or not.\nHere are my questions :\n\nare pyqtSignals thread safe ?I know that they use a queue system to be thread safe but is the emit() method itself thread safe ? My understanding of them is a bit limited\nDo I need to protect my pyqtSignals with locks ?\nCan I have multiple different signals emitting to the same slot without having any issues ?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":173,"Q_Id":68287979,"Users Score":1,"Answer":"The signals are one of the few elements of the QObjects that are thread-safe so it is not necessary to protect the data. So you can have different types of signals connected to the same slot.\nSince the signals are thread-safe then Qt recommended to communicate QObjects that live in different threads.","Q_Score":0,"Tags":"python-3.x,pyqt5,signals-slots","A_Id":68289910,"CreationDate":"2021-07-07T14:30:00.000","Title":"PyQt5 : are pyqtSignals thread safe?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have found how to get the offset and lag of a specific topic and consumer group, but how to get the ip address of consumers in the consumer group?\nJava or Python SDK are both OK.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":89,"Q_Id":68310613,"Users Score":0,"Answer":"ok...Finally I found describe_consumer_groups in KafkaAdminClient","Q_Score":0,"Tags":"java,python,apache-kafka","A_Id":68311004,"CreationDate":"2021-07-09T02:35:00.000","Title":"How to get Kafka consumers' ip address through SDK?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm trying to make a custom 'Share' button with telebot. Is there any option to handle InlineKeyboardButton with switch_inline_query parameter is set? I want to know in which chat\/user the message was sent.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":133,"Q_Id":68315616,"Users Score":0,"Answer":"I made 'share' button by deep link with unique 'start' parameter value.","Q_Score":0,"Tags":"python,telegram,telegram-bot,py-telegram-bot-api","A_Id":68573573,"CreationDate":"2021-07-09T10:55:00.000","Title":"Telebot InlineKeyboardButton how to hanlde switch_inline_query?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am making a music player with flutter so, I wanna to ask how to access all the files of a particular extension ( mp3, wav ) with it's details in Flutter or if not in Flutter then Python to play those music files with details like song name, author name","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":67,"Q_Id":68372110,"Users Score":1,"Answer":"If u are using flutter with native app, then you can use path_provider and the dart File to get all you want in Android. However, ios is more like a sandbox, so it is hard to get what u want.","Q_Score":1,"Tags":"python,flutter,file","A_Id":68372605,"CreationDate":"2021-07-14T04:35:00.000","Title":"Accessing Files from User Device using Flutter or Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm doing some load testing with locust and I cant seem to figure out how to change the Hatch Rate to a slower ramp up rate.  1 locust per second is still too fast so is there a way to change this to something that would resemble 1 locust every 20 seconds?\nI've tried using gevent.sleep(19) within the on_start method and setting the hatch rate to 1 locust per second in the UI but this only hatches each locust 1 second apart and then each hatched locust sleeps for 19 seconds (they are still 1 seconds apart).\nIs there a way of forcing each locust hatched at run time to wait 20 seconds before the next locust executes? (e.g. the first locust hatches and runs the on_start method, the next locust waits 19 seconds and then runs the on_start method, the next locust waits 19 seconds more and then runs the on_start method.)","AnswerCount":1,"Available Count":1,"Score":0.537049567,"is_accepted":false,"ViewCount":418,"Q_Id":68377946,"Users Score":3,"Answer":"The hatch rate\/ramp up parameter accepts float values. Use a hatch rate of 0.05 to spawn one user every 20 seconds.","Q_Score":0,"Tags":"python,python-3.x,load-testing,locust","A_Id":68379445,"CreationDate":"2021-07-14T12:16:00.000","Title":"Locust load testing - Change hatch rate from 1 second to say 20 seconds? (1 locust every 20 seconds)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I currently have the IVP solver working with an event, which looks like this:\nsol = solve_ivp(fun3, (0, tend), V, method='LSODA', events= event, args=(r_s,), t_eval=t) \nHowever I want the solver to check two event, not one. So I want something like this:\nsol = solve_ivp(fun3, (0, tend), V, method='LSODA', events= (event, event2), args=(r_s,), t_eval=t) \nHowever that doesn't work.\nDoes anybody know how to check for multiple events?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":137,"Q_Id":68381628,"Users Score":0,"Answer":"It works! PyCharm showed a warning, but it actually works","Q_Score":0,"Tags":"python,solver,differential-equations","A_Id":68474540,"CreationDate":"2021-07-14T16:12:00.000","Title":"Multiple events for solve_ivp","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have used idle before, but never set it up. my problem is actually getting a py file to work with. I don't actually know how to make one and it isn't an option when using save as on a text file. (only text file and all files(?) are put as options) I've attempted to open the py files already in the python folder but when selecting edit with idle I get prompted to pick what to open the file with and then if I click python nothing happens.\nwhat am I missing?","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":42,"Q_Id":68384553,"Users Score":1,"Answer":"If you select File => New and then File => Save as, the default will be to make it a .py file if you add no other extension.","Q_Score":0,"Tags":"python,python-idle","A_Id":68385944,"CreationDate":"2021-07-14T20:15:00.000","Title":"setting up idle windows 10","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have the following problem:\nI have to run some test\/diagnostic Python script on a Windows system. Due to explicit requirement, the system has no default system-wide Python instance, but there are two different Python instances installed, used locally by applications running on the system. However, both these instances lack some basic modules my script uses (like logging, urllib, configparser etc.).\nI want to run %PYTHONPATH%\\python.exe myscript.py where %PYTHONPATH% points to one of the installed Python instances, but install the required additional modules \"somewhere\" outside %PYTHONPATH% (preferrably, in the same directory where my script is installed) so that my script can use them.\nAs my script is a test tool, it should not modify the OS or installed software, so the Python installation under %PYTHONPATH% should not be changed in any way.\nIt is also expected that the installation can be fully automated, ie. the best way to install would be just have the modules in the same .zip file with my script which is unpacked onto the target path.\nIt is also important that the system has no Internet access, so I have to download required files on another machine and copy them to the target system.\nCan you guide me how to do it?","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":46,"Q_Id":68391843,"Users Score":1,"Answer":"I found an answer myself - it is quite simple:\n\nobtain the zip file containing standard modules from the appropriate Python version distribution (in my case it was the file python38.zip, it is inside the main zip file downloadable from Python site)\nUnpack the contents of this file to c:\\mydir\\Python38\\site-packages, where c:\\mydir is the directory containing my script\nset the environment variable PYTHONUSERBASE=c:\\mydir before running my script\n\nNow I can run the script and it finds all \"missing\" standard modules in c:\\mydir\\Python38\\site-packages.","Q_Score":0,"Tags":"python,windows,python-module","A_Id":68396712,"CreationDate":"2021-07-15T10:09:00.000","Title":"Install modules in Python locally to script","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Does python allocate memory in a continuous fashion in memory while implementing list or use a dynamic allocation?\nIf continuous, how does it append new elements? It should cause problems in implementing a large list.\nHow does this actually work?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":215,"Q_Id":68393220,"Users Score":0,"Answer":"I don't know how it is implemented behind the hood, but as it is accessible by index it doesn't look like a linked list. To me, it looks like a vector of pointers\/references, but I could be totally wrong.","Q_Score":0,"Tags":"python,arrays,list,memory,dynamic-memory-allocation","A_Id":68393369,"CreationDate":"2021-07-15T11:46:00.000","Title":"Is python list a continuous memory allocation like array or a linked list?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I suspect it may be rather kid question \u2013 but anyway.\nHow to open another Telegram chat or group or channel using pyTelegramBotAPI? I want to forward the user (not message, the user himself) to another channel if he clicks certain button.\nI saw content type migrate_to_chat_id in Message class declaration. Should I use it? If so, how to get an id of channel I need? It won't send any message to my bot.\nI would better use \"t.me\/...\" url.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":116,"Q_Id":68395653,"Users Score":0,"Answer":"Partly solved.\nSpeaking about the buttons, it is indeed easy. You just use named parameter url= in InlineKeyboardButton() method.\nFor other cases. You need to open another channel(s) from function depending on several conditions for instance. Still don't know. Import requests and make GET request? I suspect that something for it should already be in pyTelegramBotAPI, but searching in lib files wasn't successful.","Q_Score":0,"Tags":"python,py-telegram-bot-api","A_Id":68426320,"CreationDate":"2021-07-15T14:23:00.000","Title":"Open another Telegram chat\/group\/channel using Bot","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"The program is a standard flask program, and it does some cleanup as part of the initialization. In the cleanup() procedure, using os.remove(\"abc.txt\"), I noticed that the file is removed, but not reclaimed by the OS.\nI use both \"python website.py\" and \"gunicorn website:app\" to run the application and both have the same problem, in Linux environment. In MacOS, I can't reproduce it.\nAfter the file is os.remove , it is no longer listed in \"ls\" command, but when I run\nlsof | grep deleted\nI can still see this file being listed as deleted but opened by the python application.\nBecause this file is already \"os.remove\", it is not listed in ls command, and du will not calculate this file.\nBut if this file is big enough, df command will show the space of this file is still being occupied, not being reclaimed. Because this file is still \"being open by the flask application\", as the lsof program claimed.\nAs soon as I stop the flask application from running, the lsof will not have this file, and the space is reclaimed.\nUsually when the file is too small, or when the application stops or restarts frequently, you won't notice the space is being occupied. But this is not very reasonable for keeping the space. I would expect the website running for years.\nWhen searching internet for \"open but deleted files\", most suggestions are \"find the application and kill it\". Is there a way to keep the flask application running without restarting it? My application doesn't actually \"open\" this file, but simply os.remove it.\nSuggestion on how to delete file and re-claim the space immediately?","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":100,"Q_Id":68401311,"Users Score":0,"Answer":"The Flask application either needs the large file to continue running, or does not release unneeded resources.\nIf the app needs the large file, that's it. Otherwise, the app is buggy and in need to be corrected.\nIn both cases, the \"being open\" status of the large file (that, at least on Linux, leads to the file still being present in the mass memory system) cannot be controlled  by your script.","Q_Score":1,"Tags":"python,linux,lsof","A_Id":68406918,"CreationDate":"2021-07-15T22:12:00.000","Title":"A flask website, when it delete a file (os.remove(\"abc.txt\")), the file is removed but the space is not reclaimed","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have made a tester file to check my other files are implementing correctly, however I can only get an output by clicking run on the file  (top right green arrow). When I type 'python Test.py' in the terminal I get :\n\nFatal Python error: initsite: Failed to import the site module\nModuleNotFoundError: No module named 'site'\nCurrent thread 0x0000000102c0ce00 (most recent call first):\n\nI assume this is an environment issue for my terminal? I am in the correct folder (one above Test.py).\nAny ideas how I can change this?\nThanks!","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":28,"Q_Id":68453528,"Users Score":1,"Answer":"It looks like the python interpreter you are taking when you run python Test.py in the terminal is different from the one when you click the Run Python File in Terminal(green triangle) button.\nCould you type this command in the VSCode terminal(CMD: where python; Powershell: get-command python) to check which python you are using when you take python Test.py command to run your python file? And compare it with another one.","Q_Score":0,"Tags":"python,visual-studio-code,terminal,vscode-settings","A_Id":68466910,"CreationDate":"2021-07-20T10:43:00.000","Title":"Running a tester file in the VSC terminal - ModuleNotFoundError","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"I am forced to ask this question\nMy mentor has given me a task to extract data from files with pure python, there were some txt file which were easy but there is a file with xlsx extension and I can't find any where if it is possible to extract the data from it with pure python (I have been searching for more than 3 weeks now).\nPlease if it is not possible tell me so that I can show this to her with confidence because my mentor keeps insisting that it is possible and I should do it with pure python but she refuses to give me any clues and tips.\nAnd If it is possible tell me how to do it or where to read more about it.","AnswerCount":3,"Available Count":2,"Score":0.0665680765,"is_accepted":false,"ViewCount":545,"Q_Id":68466534,"Users Score":1,"Answer":"Previous answers regarding unpacking\/unzipping the XLSX file is the correct starting point. Thereafter you'll need to know how the extracted files work together. It's rather convoluted.\nThe best thing to do is be specific about exactly what data you want to extract then I'm sure you'll get some sample code that shows how you achieve your objective","Q_Score":0,"Tags":"python,python-3.x,excel","A_Id":68466771,"CreationDate":"2021-07-21T08:45:00.000","Title":"Is it possible to read information from an xlsx file without any libraries in python?","Data Science and Machine Learning":0,"Database and SQL":1,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am forced to ask this question\nMy mentor has given me a task to extract data from files with pure python, there were some txt file which were easy but there is a file with xlsx extension and I can't find any where if it is possible to extract the data from it with pure python (I have been searching for more than 3 weeks now).\nPlease if it is not possible tell me so that I can show this to her with confidence because my mentor keeps insisting that it is possible and I should do it with pure python but she refuses to give me any clues and tips.\nAnd If it is possible tell me how to do it or where to read more about it.","AnswerCount":3,"Available Count":2,"Score":0.1325487884,"is_accepted":false,"ViewCount":545,"Q_Id":68466534,"Users Score":2,"Answer":"The short answer is no, the long answer is, you can unpack the .xls file and iterate through the resulting .xml \"by hand\".","Q_Score":0,"Tags":"python,python-3.x,excel","A_Id":68466747,"CreationDate":"2021-07-21T08:45:00.000","Title":"Is it possible to read information from an xlsx file without any libraries in python?","Data Science and Machine Learning":0,"Database and SQL":1,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"When we train an XGB model using AWS built-in models\ne.g. (container = sagemaker.image_uris.retrieve(\"xgboost\", region, \"1.2-1\")),\nBased on my understanding, The training job requires numerical vectors for the train and validation.\nMeaning that if you have a dataset with categorical values and strings, you need to convert them into a vector. the model only deals with float numbers,\n(Outside Sagemaker, I can use TFIDF to vectorize my features and construct a DMatrix), but this approach doesn't seem to be supported by Sagemaker.\n\nDoes anyone know how this data transformation is done in Sagemaker?\nIs this a bad idea to use BlazyngText unsupervised learning to generate the vectors?\nShould we have a preprocessing step and in that step we use TFIDF?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":91,"Q_Id":68470428,"Users Score":0,"Answer":"Ok, after pulling my hair for a while, we built a solution as below:\nOn the preprocessing step, we used TFIDF to vectorize categorical values and then stored the data into S3.\nOn the training step, we read that training input and fed it into the XGB estimator.","Q_Score":0,"Tags":"python,vectorization,xgboost,amazon-sagemaker","A_Id":69297892,"CreationDate":"2021-07-21T13:30:00.000","Title":"Vectorising categorical dataset for XGBoost in Sagemaker","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am trying to deploy a model which uses the pillow (PIL) library on ubuntu (Ubuntu 20.04.2 LTS). The model was built on windows, and i have since discovered that PIL returns different arrays when reading the same image between Ubuntu and Windows.\nThis seems to be because of the jpeglib version (9 not 8). Does anyone know how to change this version so i can replicate the same results on a linux mahcine?\nThanks!","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":43,"Q_Id":68474269,"Users Score":1,"Answer":"Solved by building Pillow from source with jpeglib-8 installed. This means jpegs loaded with the same decoder match.","Q_Score":0,"Tags":"linux,windows,python-imaging-library","A_Id":68486971,"CreationDate":"2021-07-21T17:47:00.000","Title":"Change Image.core.jpeglib version in PIL on ubuntu","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":1,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm running PyCharm on Manjaro(latest version of both) and upon starting PyCharm, a prompt appears that says I should \"Please consider switching to the bundled Java runtime that is better suited for your IDE(your current Java runetime is 11.0.11+9 by Oracle Corp. at \/usr\/lib\/jvm\/java-11-openjdk\"\nI've tried choosing different runtimes using Ctrl+Shift+A but none of them stop this prompt from appearing. Is this something I should worry about or should I brush it off?\nNew to both Python and Manjaro so not really sure how to proceed. Unable to find anything pertaining to this issue on this distro.\nEdit: I downloaded the most recent version(11.0.12) and adding it as a custom runtime, but for some reason it shows that I'm still using the aforementioned version...","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":566,"Q_Id":68474463,"Users Score":0,"Answer":"TL;DR: Run $ PYCHARM_JDK=\/path\/to\/runtime\/ pycharm\nIf you installed PyCharm through the package manager (e.g. pacman), the launcher will be installed to someplace like \/usr\/bin\/pycharm. This is basically a shell script that sets the JDK for PyCharm before calling the main executable. When the environment variable PYCHARM_JDK is not set, it defaults to a system Java 11 JDK.\nChanging the boot runtime within PyCharm doesn't change this script. You'll need to set PYCHARM_JDK from the command line, in your .bashrc, or by editing \/usr\/bin\/pycharm. Use Help -> About to confirm that the expected runtime was selected.\nAs for which runtime to use, jbr_jcef-11_0_11-linux-x64-b1341.60 works nicely on my machine. The JetBrains support forum will have to explain what the differences are.","Q_Score":0,"Tags":"java,python,pycharm,manjaro","A_Id":68606620,"CreationDate":"2021-07-21T18:04:00.000","Title":"Switching to bundled Java runtime for PyCharm(Manjaro)?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am new to python, and I've attempting to code different things while following different tutorials. I know that packages are important, but how do I make sure that I don't install anything malicious?","AnswerCount":2,"Available Count":1,"Score":-0.1973753202,"is_accepted":false,"ViewCount":177,"Q_Id":68493215,"Users Score":-2,"Answer":"Just download the pip library from official pages and don't worry until you interact with downloaded files directly or indirectly; nothing will be harmful if it's pip file.","Q_Score":1,"Tags":"python,pip","A_Id":68494317,"CreationDate":"2021-07-23T02:02:00.000","Title":"How do I make sure a PIP package is safe?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"So I would like to know if its possible to make a code the\nmakes a cooldown\nper role\nlike premium has no cooldown\nand bronze has a 10 second\ncooldown if so how can I do it ?\nfor commands","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":106,"Q_Id":68495705,"Users Score":0,"Answer":"Why with commands? Wouldn't it be much easier to add and remove the roles with a command and control the cooldown via the server settings?\nWith a simple level-system this would be done very quickly.\n(You could store the number of messages in a simple .json file and after a certain amount of messages add\/remove the corresponding role.)","Q_Score":0,"Tags":"python,discord,discord.py","A_Id":68502882,"CreationDate":"2021-07-23T07:42:00.000","Title":"how to make a different cooldown for each role in discord in py","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am trying to get my head around OOP thinking when say I have your general example of a person class and then a class for family members\nfamily members share the same address but not all persons have the same address.\nhow do you make it so you can create families where members share the same address without having to enter the same address on each person, but that different families have different addresses?\nI have seen examples where you define subclasses that inherit from the main class person but you have to hardcode each family as a class. Any views as to how to make this work in OOP? I might be looking at the problem in the wrong way...","AnswerCount":3,"Available Count":1,"Score":0.0665680765,"is_accepted":false,"ViewCount":76,"Q_Id":68496939,"Users Score":1,"Answer":"One way to do it is to have 2 classes: Family and Person.\nThe Family class will have two main attribute:\n\na collection of Person (as array, list, etc)\naddress\n\nThe Person class will need to have a reference to the Family object in which it belonged into. So its attributes might be like:\n\nname\ndate of birth\n...\nreference to Family Object\n\nGenerally, to represent hiearchy with OOP, you can do something called composition, which is to have some objects as the attribute of another object.","Q_Score":0,"Tags":"python,oop","A_Id":68497038,"CreationDate":"2021-07-23T09:20:00.000","Title":"how to represent a hierarchy situation with OOP?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have been adding python types to my function parameters and returns for some time now, but I haven't figured out how to make use of these beyond the popup hints when I hover over a parameter.\nIs there a way to get red underlining or some other report feedback showing me locations where the type of a parameter being passed does not match the parameter's typing definition?","AnswerCount":2,"Available Count":1,"Score":-0.0996679946,"is_accepted":false,"ViewCount":72,"Q_Id":68497054,"Users Score":-1,"Answer":"As far as I know VSC doesn't support python type hinting. If you really need type hinting maybe try downloading the Community Edition of Pycharm\nIt has type checking and hinting features and is completely free.","Q_Score":0,"Tags":"python,visual-studio-code,python-typing","A_Id":68497179,"CreationDate":"2021-07-23T09:29:00.000","Title":"How can you see Python typing conflicts in Vscode?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"When I use Jupyter Notebook inside the browser or inside Google Colab I can comment multiple lines of code by selecting them and pressing crtl + #. This also sometimes worked in Visual Code and not only for Python but also for C++ (of course then each line began with a \/\/). However, I have no idea what enabled this behavior and how to reproduce it, it was very convenient. If you have any idea how to enable this, I would very much appreciate your help.","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":51,"Q_Id":68509725,"Users Score":0,"Answer":"In VS Code you can use Ctrl+\/ for comment multiple lines and Alt+Shift+A for block comment .","Q_Score":0,"Tags":"python,visual-studio-code,comments","A_Id":68509808,"CreationDate":"2021-07-24T11:54:00.000","Title":"How can I use the shortcut ctrl + # to comment multiple lines of code in Python or C++ using Vscode?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"It's my second day of Django and everything seems to be going petty well. Though the installation process is a bit longer, I still find it friendly to get started with. I am currently learning how to pass data to static file from views.py. The problem I am having is that it is only showing the previous changes not the recent. I have hard-refresh but still not working. I don't know how to stop and rerun the server because I don't know how to combine both Ctr + BREAK.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":528,"Q_Id":68518515,"Users Score":0,"Answer":"Ctrl + break mean pressing ctrl and alphabet c key at same time it will break the server and if you want to rerun it run the command\npython manage.py runserver\nThere may be issue that you won't Saving your work other then this try force reload CSS file by pressing ctrl+ f5 in browser tab in which Django project is running.It might be helpful.","Q_Score":1,"Tags":"python,html,django","A_Id":68522615,"CreationDate":"2021-07-25T12:22:00.000","Title":"Django changes is not reflecting on the browser","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm trying to change the outgoing smtp ip address, i succeeded to change ip address using source_address=(host,port)\nexample :         smtpserver = smtplib.SMTP(\"smtp.gmail.com\", 587,source_address=('185.193.157.60',12323)\nBut i can't find how to add username and password of the proxy ( if the proxy requires username and password )\nI tried : smtpserver = smtplib.SMTP(\"smtp.gmail.com\", 587,source_address=('185.193.157.60',12323, 'username', 'password')\nBut it didn't work","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":29,"Q_Id":68521874,"Users Score":0,"Answer":"From the docs...\nSMTP.login(user, password, *, initial_response_ok=True)","Q_Score":0,"Tags":"python,smtp","A_Id":68521903,"CreationDate":"2021-07-25T19:26:00.000","Title":"SMTP Outgoing IP ( source ip )","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"The question is very simple but don't know how to implement it in practice. I would like to train a tensorflow LSTM model with the dataset, which is incredible large (50 millions records). I am able to load the data file to a local machine but the machine crash during the pre-processing stage due to limited memory. I have tried to del un-used files and garbage collection to free the memory but it does not help.\nIs there any way, I can train a tensorflow model separately for example, the model will be train 5 times, each time only use 10 million records and then delete 10 million records after training to free the memory ram. The same procedure will be repeated for 5 times to train a tensorflow model.\nThanks","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":141,"Q_Id":68534132,"Users Score":2,"Answer":"There are some ways to avoid these problems:\n1- You can use google colab and high-RAM in runtime or any other Rent a VM in the cloud.\n2- The three basic software techniques for handling too much data: compression, chunking, and indexing.","Q_Score":0,"Tags":"python,tensorflow,machine-learning,data-science","A_Id":68643899,"CreationDate":"2021-07-26T17:25:00.000","Title":"How to train a model with BIG data size and limited memory ram?","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm creating a script that downloads and shifts pdfs into different specific directories based on a search. I have code that generates the folder and subfolders recursively, I simply need to be able to download the pdfs into that file. I'm wondering how I can dynamically change the download location before I download each file in Selenium without having to start a new driver session. I could use os commands to move the files, but their names are a convoluted mess so having them go directly into the specified folder is preferable. Thank you!","AnswerCount":2,"Available Count":1,"Score":-0.1973753202,"is_accepted":false,"ViewCount":54,"Q_Id":68537232,"Users Score":-2,"Answer":"try this\nit will\npipq10\n'''''()'''''\n()qlqst\n(0)piyQ","Q_Score":0,"Tags":"python,selenium,directory,download","A_Id":68543001,"CreationDate":"2021-07-26T23:12:00.000","Title":"Selenium Chrome Changing Directory","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Need some help to solve this puzzle folks:\nWhen creating a child class in Python and defining the init method, I would like to import all the attributes of the super\/parent class except certain positional parameters and\ncertain parameters (which are not defined inside parent classes' init method's list of positional or keyworded\/non-keworded parameters but) defined within\/inside the parent class init method with a default value.\nIs there a way to prevent\/avoid certain\/specific parent class attributes to be imported in the child class upon initiation? I am aware that we can override methods in the child class which do not mimic parent class behaviors, but I am not aware how to do the same with attributes, so I was thinking if I could avoid them completely!\nI will give an example of why I need a certain child class to mimic everything from its parent except certain attribute.\nConsider a parent class \"Car\". The child class will be \"ElectricCar\". The parent class has an attribute defined called \"liters_gasoline\" with certain integer as  its default value.\nNow, I would like to inherit everything in the ElectricCar sub-class except that \"liters_gasoline\" parameter, because ElectricCars don't use fuel\/gasoline. How to prevent this \"liters_gasoline\" parameter from being inherited in the child class? I don't want this parameter in child class!\nHow to do this?","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":674,"Q_Id":68553439,"Users Score":1,"Answer":"If something inherits from a parent class it should have all the attributes of the parent class. For example \"liters_gasoline\" should only be in the class of a gasoline car not an electric car.","Q_Score":1,"Tags":"python,class,inheritance","A_Id":68553471,"CreationDate":"2021-07-28T01:48:00.000","Title":"Prevent certain attributes to be inherited in child class","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have a list, a = [0,1,2,3,4,5].\nI'm trying to reverse the slice a[1:4], with a[1:4].reverse(). However, the value of a does not change. Why does this happen?\nNote: I don't want to know how to make this work - rather, why this happens.","AnswerCount":5,"Available Count":2,"Score":0.0798297691,"is_accepted":false,"ViewCount":115,"Q_Id":68554249,"Users Score":2,"Answer":"Here's what a[1:4].reverse() actually does:\n\ncreate a sublist (slice) of a, so a[1:4] == [1, 2, 3]\nreverse that list in-place, so it's now [3, 2, 1]\nthrow that list away because you didn't ask it to do anything with it","Q_Score":2,"Tags":"python","A_Id":68554279,"CreationDate":"2021-07-28T04:02:00.000","Title":"Why is reverse() on specific slice of a list not working?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have a list, a = [0,1,2,3,4,5].\nI'm trying to reverse the slice a[1:4], with a[1:4].reverse(). However, the value of a does not change. Why does this happen?\nNote: I don't want to know how to make this work - rather, why this happens.","AnswerCount":5,"Available Count":2,"Score":0.0798297691,"is_accepted":false,"ViewCount":115,"Q_Id":68554249,"Users Score":2,"Answer":"a[1:4] creates a new list. You called reverse on this new list, not a","Q_Score":2,"Tags":"python","A_Id":68554278,"CreationDate":"2021-07-28T04:02:00.000","Title":"Why is reverse() on specific slice of a list not working?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I was curious if you made an application in python how do you ship it? If you made it in a virtual enviroment can you just give that out for download? Do you need some kind of install process?\n(In my case it would be a webapp made with flask intended to run on a linux server)","AnswerCount":5,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":239,"Q_Id":68564411,"Users Score":0,"Answer":"In your case I'd heavily suggest you build a docker container and archive the code via git. In my experience, just doing pip freeze > requirements.txt does not suffice when the intended audience is not python literate. Especially issues with venv and conda setups have cost me way to many hours of my life.","Q_Score":1,"Tags":"python","A_Id":68570593,"CreationDate":"2021-07-28T16:49:00.000","Title":"How to ship python projects?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm working on a Django project and i want to be able to disable or enable email registration verification in admin panel, with a radio button, if it's set to ON, when user registers to site need to verify email, but if it's set to OFF user account activate after registration and don't need to activate account with email verification","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":104,"Q_Id":68589267,"Users Score":0,"Answer":"Hope you are having a good time.\nI would like the purpose behind allowing email verification after registration because it's sole purpose is to validate authentic users and not allow unidentified login attempt to pass.\nBecause there have been so many hacking attempts just because of insecure security steps on login panel itself these days, I think it is better if we retain the email verification and not switch its permission.","Q_Score":0,"Tags":"python,django","A_Id":68590074,"CreationDate":"2021-07-30T10:16:00.000","Title":"django how to disable & enable email verification in admin panel","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have a list including some names, as example:\ndata_set_names=['matrix_1','matrix_2','matrix_3'].\nInside a loop, I want to use each of these names for storing the output of some computations, which are as NumPy array. I highly appreciate if someone could tell me how to do that. As I looked it up online, exec() function can be used to convert a string to a variable name, but in my case, it is not useful.","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":204,"Q_Id":68589469,"Users Score":1,"Answer":"You can use the dictionary of str\/numpyArray","Q_Score":0,"Tags":"python,string,numpy-ndarray,data-conversion","A_Id":68589554,"CreationDate":"2021-07-30T10:30:00.000","Title":"Using a string as a name for a numpy array","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am using Python 3.9 on Windows 10 which I downloaded directly from the Microsoft Store.\nI tried running a script in PowerShell: Bash *.sh\nThis script is supposed to tell my computer to execute a .py script which uses scipy.io and many other modules.\nThen I received this error:\n\nModuleNotFoundError: No module named 'scipy'\n\nMy strategy was to make sure pip was up to date, then use it to install the desired packages, then run some commands to see if the packages were installed.\nI ran this command to update pip:\npython3 -m pip install --upgrade pip\nI ran this command to get some modules:\npython -m pip install --user numpy scipy matplotlib ipython jupyter pandas sympy nose\nI also tried this command just in case:\npip install scipy\nand got the result:\n\nRequirement already satisfied ...\n\nI ran the command pip list to make sure scipy was in the list (and it was there).\nThen I ran the command python and my prompt changed to \">>>\" and entered import scipy and did not receive any errors.\nI am very confused as to how I have scipy installed yet have my script tell me it isn't there. Please help!","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":240,"Q_Id":68595731,"Users Score":0,"Answer":"I had the same issue. You might have multiple versions of python and you only installed scipy on the one you are not using\nOR\nyou are using an IDE which has the option to use packages you install that are not by default in python. Pycharm has that. When you make a new project, it has a tick option saying \"Inherit global site-packages\" which means it will use additional packages you have installed any.","Q_Score":0,"Tags":"python,powershell,pip,scipy","A_Id":68595879,"CreationDate":"2021-07-30T18:37:00.000","Title":"Why do I receive a \"no module named scipy\" error even after I have installed the module via pip?","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"Hi I was wondering if i could add buttons in my terminal using python as I am making a project and decided not to use tkinter and other GUI modules. Instead I wanted to do it in the python terminal and for your information I am using a MacBook.\nI think that you can use the cursers module or something like so to make buttons just that I don't know how to do so :(\nThanks for any help provided! ;)","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":209,"Q_Id":68599327,"Users Score":1,"Answer":"in Python we can not create a button in the terminal and there is no way at all and only using graphical environments this is done which is not in the terminal\nYou can do two things: a mouse and keyboard control with a click function, and if you do a Google search for this function, it will bring you\nOr put a text yourself, for example print (1- hello)\nAnd then define an input, such as go input\nAnd then define an if and say if go == 1: print (hello)\nThere are two ways you can\nI hope this article is useful for you and you have answered your question","Q_Score":0,"Tags":"python,button,terminal","A_Id":68599582,"CreationDate":"2021-07-31T05:16:00.000","Title":"Buttons in terminal using python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am in the Microsoft Visual Studio environment, most screenshots of this environment show an activity bar in the left sidebar. However, I cannot get this to appear in my display, I have sought to access this activity bar in view but cannot see any reasonable options.\nAny thoughts?","AnswerCount":3,"Available Count":3,"Score":0.0,"is_accepted":false,"ViewCount":82,"Q_Id":68617723,"Users Score":0,"Answer":"Follow the steps:\n\nOpen the Command Palette ( Ctrl + Shift + P ) and type Keyboard Shortcuts.\nClick on Toggle Activity Bar Visibility, and choose your shortcut using the\nkeyboard!\nIt's done!","Q_Score":0,"Tags":"python,visual-studio-2019","A_Id":68617872,"CreationDate":"2021-08-02T07:14:00.000","Title":"visual studio Display, how to access activity bar?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am in the Microsoft Visual Studio environment, most screenshots of this environment show an activity bar in the left sidebar. However, I cannot get this to appear in my display, I have sought to access this activity bar in view but cannot see any reasonable options.\nAny thoughts?","AnswerCount":3,"Available Count":3,"Score":0.0,"is_accepted":false,"ViewCount":82,"Q_Id":68617723,"Users Score":0,"Answer":"On Microsoft Visual Studio 2019 if you check on the \"Debug\" menu, you can find other windows that are helpful when the system is running.\nI'm not sure which window you are looking for, but there's a \"Diagnostic Tools\" that could be the one.","Q_Score":0,"Tags":"python,visual-studio-2019","A_Id":68617874,"CreationDate":"2021-08-02T07:14:00.000","Title":"visual studio Display, how to access activity bar?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am in the Microsoft Visual Studio environment, most screenshots of this environment show an activity bar in the left sidebar. However, I cannot get this to appear in my display, I have sought to access this activity bar in view but cannot see any reasonable options.\nAny thoughts?","AnswerCount":3,"Available Count":3,"Score":0.0,"is_accepted":false,"ViewCount":82,"Q_Id":68617723,"Users Score":0,"Answer":"My experience is from Visual Studio Code and not Visual Studio 2019 but I suspect they are most likely similar..\nPress F1 and type \"View: Toggle Activity Bar Visibility\" and click on it when it shows up.  That should make your activity bar visible again.","Q_Score":0,"Tags":"python,visual-studio-2019","A_Id":68617919,"CreationDate":"2021-08-02T07:14:00.000","Title":"visual studio Display, how to access activity bar?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have 20000 RGB images. I set batch_Size = 1 (due to GPU capacity). So now does it mean the model weights are changing with one-by-one pictures or it depends on the steps_per_epoch?\nHow should I set the steps_per_epoch and epochs for using all of 20000 images to be involved in training in different epochs?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":233,"Q_Id":68619143,"Users Score":0,"Answer":"Yes, the weights are updated after each batch.\nThe steps_per_epoch should be the number of datapoints (20000 in your case) divided by the batch size. Therefore steps_per_epoch will also be 20000 if the batch size is 1.","Q_Score":1,"Tags":"python,tensorflow,keras","A_Id":68619248,"CreationDate":"2021-08-02T09:21:00.000","Title":"how to set correct batch_size and steps_per_epoch in keras?","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Hello guys I have an existing Django project which has certain features and also has user data. For certain features, users use the API served through Django (also the authentication), but since there is a need for new feature which needs to be implemented through FastAPI,  I need to have the same users authenticate or (better to say) to be recognized by FastAPI (as the same user in Django) to save or retrieve an action corresponding to user in the db (through FastAPI).\nHow to achieve that? How do I store the user data, like user_id and username for each user safely? How to properly design the database table?\nPlease do let me know, how to start.\nThank you.","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":265,"Q_Id":68623238,"Users Score":1,"Answer":"Assuming you've implemented your own AbstractUser sub-class named DannyUser, you then have a couple of choices:\n\nEmbed all of the information needed into a new field (a JSONField subclass for example) -- not really recommended as this leaks random information into a housekeeping table and is ill-advised IMO.\n\nDesign a new Model for each authentication service and tie it via a foreign key & reverse relationship to your DannyUser instances. Then you could use something like my_danny_instance.fastapi_account.auth_token where needed. This will also allow you to encrypt specific fields or use a secret management solution later on.\n\n\nSimply normalize your data as far as it makes sense to.","Q_Score":3,"Tags":"python-3.x,django,django-models,django-rest-framework,fastapi","A_Id":68704747,"CreationDate":"2021-08-02T14:22:00.000","Title":"How to identify and save the right \"user\" when we use Django (Existing proj) for authentication and FastAPI (new feature) for API's?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"The \"COPY CONTENT FROM [available translation languages]\" button is not showing in the admin page editing interface.\nThe package was installed properly, following official documentation.\nWhat can cause the issue and how to fix it?","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":37,"Q_Id":68661457,"Users Score":1,"Answer":"The issue was in app register order. wagtail_modeltranslation app should be registered on top of user apps","Q_Score":0,"Tags":"python,django,internationalization,wagtail,django-modeltranslation","A_Id":68661485,"CreationDate":"2021-08-05T06:12:00.000","Title":"No \"Copy content from\" wagtail-modeltranslation button","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I can write to a file using yaml.dump but how do I write to a string?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":44,"Q_Id":68663672,"Users Score":0,"Answer":"I have found the solution. Its an overloaded function. If you don't pass the file parameter, it will output to a string.","Q_Score":0,"Tags":"python,string,yaml,pyyaml","A_Id":68663940,"CreationDate":"2021-08-05T09:09:00.000","Title":"How to write to a string instead of a file wth PyYaml","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I know how to do it in db shell, but I need to do it in the code in which file and where should I place print(len(connection)). Maybe I need to do something else?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":52,"Q_Id":68665866,"Users Score":0,"Answer":"Try to place it in your views, but be sure your querysets are evaluated.\nBut I would recommend you to use django-silk, it's much more powerful kit for your goal.","Q_Score":0,"Tags":"python,django,postgresql,django-rest-framework","A_Id":68666890,"CreationDate":"2021-08-05T11:39:00.000","Title":"Can't count PostgeSQL requests in django","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am fairly new to using sockets, and this will probably have a simple answer that I am overlooking, but since an hour of agonizing has not yielded results so... what the heck.\nHow do I receive for .sendall() in the python socket module? By this I mean how do I receive data from a socket with out a buffer? is there a simple solution for this like some sort of conn.recvall() function or do I have it write out logic to do this? If I do have to write logic for it, then how should I do it? Should I just keep using .recv() with some arbitrary buffint or do I have to split the inputs into segments before sending? Which is more efficient, or better? Is there a smarter way to go about it?\nThanks","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":71,"Q_Id":68688695,"Users Score":0,"Answer":"send and sendall will chop your buffer into pieces for sending over the network.  It's important to remember that TCP is a streaming protocol, not a packet protocol.  If you send 1,024 bytes, it might be received by the other end as 1,024 bytes, or as one of 256 and one of 768, or one of 1,000 and one of 24.  The receiver need to know when the transmission is complete.  Sometimes it's fixed buffer, sometimes you'll send a byte count first, sometimes you use a special termination character, sometimes you wait for a timeout.  The receiver just needs to keep calling .recv until he knows its done.\nSome of the higher level Python packages (like twisted (which I recommend)) can handle that for you.","Q_Score":0,"Tags":"python,sockets,python-sockets","A_Id":68688718,"CreationDate":"2021-08-07T01:01:00.000","Title":"How to receive for sendall in python socket module","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":1},{"Question":"i have cookie get from website .  how do i log that cookie using requests ?\ncookie=\"sb=Vma2X7D6JF_aBy6ESWdwm-OL; datr=Vma2X2YjSxJ-JzCD368WGfmL; locale=vi_VN; wd=1366x657; c_user=100029745455196;\"\nhow login with requests?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":28,"Q_Id":68706287,"Users Score":0,"Answer":"No, you can't login with cookie, you need login with credentials: username & password.\nIf you have logged in with credentials, you MAY use that cookie to bypass login step.","Q_Score":0,"Tags":"cookies,python-requests","A_Id":68711448,"CreationDate":"2021-08-09T02:45:00.000","Title":"How to login to a website that uses cookies?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am using paramiko library to connect with a specialized environment. Its based on linux but when we SSH in it provide its own shell. We can write help to get list of all commands that are supported in that session.\nI am using paramiko with python2.7 to provide a CLI client (it automates few things) that connect with the host and let us run the supported commands. Now I would like to provide tab-completion in the client CLI. I am not sure how this can be done. I am thinking there would be some support or some specialize character that can be send to get back response but I am not sure how it can be accomplished.\nI am hoping to avoid sending help command, parse the list of commands supported, and then provide a local tab-completion based on list of command. I want a more generic and dynamic solution.\nAny or all ideas are welcome.","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":48,"Q_Id":68725304,"Users Score":1,"Answer":"You can try simulating the partial input and the Tab key press and parsing the results, undoing the simulated input afterwards. But that is not a good idea. You will have to end up re-implementing terminal emulation, what is an insane task. Without a full terminal implementation, you can never be sure that you never get an output that you won't be able to parse.\nThe shell is a black box with input and output. It should only be used as such. You should never try to \"understand\" its output.\nUsing the help command is a way more reliable solution.","Q_Score":0,"Tags":"python-2.7,paramiko,tab-completion","A_Id":68730120,"CreationDate":"2021-08-10T10:41:00.000","Title":"Tab completion over ssh library","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have an SAS file that is roughly 112 million rows. I do not actually have access to SAS software, so I need to get this data into, preferably, a pandas DataFrame or something very similar in the python family. I just don't know how to do this efficiently. ie, just doing df = pd.read_sas(filename.sas7bdat) takes a few hours. I can do chunk sizes but that doesn't really solve the underlying problem. Is there any faster way to get this into pandas, or do I just have to eat the multi-hour wait? Additionally, even when I have read in the file, I can barely do anything with it because iterating over the df takes forever as well. It usually just ends up crashing the Jupyter kernel. Thanks in advance for any advice in this regard!","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":219,"Q_Id":68735169,"Users Score":0,"Answer":"Maybe you don't need your entire file to work on it so you can take 10%. You can also change your variable types to reduce its memory.\n\nif you want to store a df and re use it instead of re importing the entire file each time you want to work on it you can save it as a pickle file (.pkl) and re open it by using pandas.read_pickle","Q_Score":1,"Tags":"python,pandas,sas","A_Id":68748056,"CreationDate":"2021-08-11T01:55:00.000","Title":"Efficient Way to Read SAS file with over 100 million rows into pandas","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have a question regarding transfer learning. Let suppose there is a neural network model that takes an input of shape (250,7). I want to initialise the model with the weights of this pre-trained model and then train it on my dataset to update the weights according to my dataset. But my dataset is of shape (251,8). Is there way to initialise the weights using pre-trained model considering my input shape is different? If so how can I do that? Insights will be appreciated.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":173,"Q_Id":68738166,"Users Score":1,"Answer":"You could try adding another layer before the transfer learning model. Just like the last layer, this will update its weights on your dataset and should work fine.","Q_Score":0,"Tags":"python,keras,deep-learning","A_Id":68738794,"CreationDate":"2021-08-11T08:01:00.000","Title":"transfer learning in keras when input shape is different","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have a string variable containing the HTML of an email.\nThe email contains Google drive attachments(links)\nI extract the attachment ID of the same and the Google drive attachments are always in the following format:\n'https:\/\/drive.google.com\/file\/d\/123456789\/view?\/usp=drive_web'\n123456789 being the file ID which I am trying to extract\nWhen there is only one attachment, I extract the ID using the below code:\nhtml_string.split('<a href \"https:\/\/drive.google.com\/file\/d\/')[-1].split('\/')[0]\nHowever, I do not know how to extrapolate this where there are multiple file IDs in the HTML string.\nI am looking to find a list of all the strings between\nthis substring - '<a href \"https:\/\/drive.google.com\/file\/d\/'\nand the next immideate '\/'\nexample:\na small sample HTML file looking like so:\n<a href ='https:\/\/drive.google.com\/file\/d\/123456789\/view?\/usp=drive_web' >attachment_1<\/a>random HTML text with multiple '\/'<a href ='https:\/\/drive.google.com\/file\/d\/987654321\/view?\/usp=drive_web' >attachment_2<\/a>\nNeed to extract the following list :\n['123456789','987654321']\nUsing a code that would work for any number of attachments","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":55,"Q_Id":68741760,"Users Score":0,"Answer":"Once you fix your html_string.split call, you'll find it is returning a list whose elements (except for the first) each start with one of the numbers you want.","Q_Score":0,"Tags":"python,string,split","A_Id":68741918,"CreationDate":"2021-08-11T12:10:00.000","Title":"Find list of strings between 2 substring combinations in Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Hell all, so let try to describe my problem in the best light possible. I have experience with Python but have never used FME. I would like to delete a full row of data based on criteria in a particular column.\nI have an idea of how I would write this in Python but being new to FME not quiet sure where I start here with the transformations.. For example: the Column will have an A, B, or C. If the column for any row has a \"C\" I want to to delete this full row. While it seems simple enough Python I'm not quite sure where to start with FME. Any help or helpful tips to point me in the right direction that would be great.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":201,"Q_Id":68750681,"Users Score":0,"Answer":"You need a \"tester\" transformer, add you're conditions in the transformer. You'll have 2 output ports, the first one (passed) is the data matching the conditions, the second (failed) not matching, that it.\n(google translate from french)","Q_Score":0,"Tags":"python,fme,simpletransformers","A_Id":68757060,"CreationDate":"2021-08-12T01:48:00.000","Title":"FME issue, deleting row based cell value","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am working with time series datasets where I have two different cases. One where my sequences are of same size and the other one where the sequences are of different lengths. When I have same length sequences I can merge all the datasets and then fit the model once.\nBut for different length sequences, I was wondering how differently should the keras model.fit will behave\n\nif the models are fitted with each different length sequences one by one with  batch size=length of sequence\nif the models are fitted once with all the sequences merged together having a fixed batch size\n\nAnd based on the given scenario what should be the correct or better course of action?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":77,"Q_Id":68761970,"Users Score":0,"Answer":"In first scenario, the weights will be optimized first with first dataset and then will be changed(updated) for the second dataset and so on. In second scenario, you are simultaneously asking the model to learn patterns from all the datasets. This means the weights will be adjusted according to all the datasets all at once. I will prefer the second approach because NN have the tendency to forget\/break when trained on new datasets. They are more likely to focus on the data they have seen recently.","Q_Score":0,"Tags":"python,tensorflow,keras,time-series,recurrent-neural-network","A_Id":68765784,"CreationDate":"2021-08-12T17:36:00.000","Title":"How does keras model fit differ when called multiple times with different datasets each time and when called once with all datasets?","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"OS: windows 10\nI install python3.9, pip install many 3rd party packages and use them well on both Pycharm and CMD terminal;\nLater, I install MSYS2 and then I tpye 'python' on the terminal of MSYS2 and get into python terminal; it seems well until now. When I import sth, getting the warning \"No module named 'xxx'\" which can be imported well on Pycharm or CMD terminal.\nso I guess the path of 3rd party packages not be included for MSYS2, how to resovle it?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":96,"Q_Id":68770305,"Users Score":1,"Answer":"Here is the standard way to use Python 3 and pip in MSYS2:\n\nSelect the \"MSYS2 MinGW 64-bit\" shortcut or run mingw64.exe to start a MinGW 64-bit shell.  (32-bit should work too.)\nRun pacman -S $MINGW_PACKAGE_PREFIX-{python3,python3-pip} to install both Python 3 and pip.\nRun pip install PKGNAME to install a package you need.\nRun python path\/to\/script.py to run your script.\n\nI tested these instructions just now.  I was able to run pip install pyserial and then I was able to run a script that started with import serial.","Q_Score":0,"Tags":"python,msys2","A_Id":68786293,"CreationDate":"2021-08-13T09:59:00.000","Title":"3rd party libraries of Python cant be used on MSYS2 terminal, how to use them in MSYS2 terminal?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have a UAV with a LiDAR onboard flying and scanning on 3D space. I have the UAV's GPS position with good precision, and I wanted to know how to build a 3D map using the LiDAR's pointCloud. Our goal is for the UAV to avoid obstacles in front of it, and it would be very helpful in visualizing the operation remotely.\nI have ardupilot's GPS and orientation data through mavlink and publish it on ROS for my application, as well as the LiDAR's scan as a PointCloud2. Can I somehow set a GPS static origin and build a map around it, using something like octomap_server?\nAny tips on what to look for would be greatly appreciated!\nThank you kindly.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":47,"Q_Id":68772031,"Users Score":0,"Answer":"The octomap_server will assume the origin is (0,0) and try to build a map around that. As your question implies, if you're using the lidar for object detection and avoidance, you should not be operating in the GPS frame. If you're trying to use the lidar and with octomap_server for a long term data reference, this work should be done in the map frame; here you shouldn't have any issues with setting default points. If you would like to just use it for a short term reference and continuous object avoidance, it should be done in the odom frame; again, default position shouldn't be a problem here.","Q_Score":1,"Tags":"python,c++,gps,ros,octomap","A_Id":68772326,"CreationDate":"2021-08-13T12:04:00.000","Title":"Visualizing UAV 3D LiDAR scan with octomap on RVIZ","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am trying to write a scalable app using python and docker and mongodb\nThe app just runs a web search and returns a list of web pages\nI then store this list in a mongodb collection using dictionary\nI also have created a simple docker file that exposes the python entry point\nI now would like to understand how to make a docker compose file so that I can scale the app, e.g. \u201cmy 10 million users\u201d want to make more searches and return more values (at the moment I am limiting the search to 10 results).\nPlease can you advise?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":14,"Q_Id":68782625,"Users Score":0,"Answer":"I don't think a providing a Compose file will necessarily help here. If you paginate the Mongo response, that'll help page load times\nOtherwise, to distribute database load, you need to simply need to add more Mongo and Python containers. To handle web server load balancing, add a reverse proxy. You can refer to the replicas option in the Compose spec if you want to do that easily, otherwise, simply copy paste the same services\nWorth mentioning that Elasticsearch is the more common tool for search results than Mongo","Q_Score":0,"Tags":"python,mongodb,docker","A_Id":68784208,"CreationDate":"2021-08-14T10:58:00.000","Title":"Scalable dockerized Python web search with storage","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm using the direct runner of Apache Beam Python SDK to execute a simple pipeline similar to the word count example. Since I'm processing a large file, I want to display metrics during the execution. I know how to report the metrics, but I can't find any way to access the metrics during the run.\nI found the metrics() function in the PipelineResult, but it seems I only get a PipelineResult object from the Pipeline.run() function, which is a blocking call. In the Java SDK I found a MetricsSink, which can be configured on PipelineOptions, but I did not find an equivalent in the Python SDK.\nHow can I access live metrics during pipeline execution?","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":240,"Q_Id":68803591,"Users Score":2,"Answer":"The direct runner is generally used for testing, development, and small jobs, and Pipeline.run() was made blocking for simplicity. On other runners Pipeline.run() is asynchronous and the result can be used to monitor the pipeline progress during execution.\nYou could try running a local version of an OSS runner like Flink to get this behavior.","Q_Score":3,"Tags":"python,apache-beam","A_Id":68807089,"CreationDate":"2021-08-16T13:24:00.000","Title":"Access Apache Beam metrics values during pipeline run in python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"What would be best way to solve following problem with Python ?\nI have real-time data stream coming to my object-oriented storage from user application (json files being stored into S3 storage in Amazon).\nUpon receiving of each JSON file, I have to within certain time (1s in this instance) process data in the file and generate response that is send back to the user. This data is being processed by simple Python script.\nMy issue is, that the real-time data stream can at the same time generate even few hundreds JSON files from user applications that I need to run trough my Python script and I don't know how to approach this the best way.\nI understand, that way to tackle this would be to use trigger based Lambdas that would execute job on the top of every file once uploaded from real-time stream in server-less environment, however this option is quite expensive compared to have single server instance running and somehow triggering jobs inside.\nAny advice is appreciated. Thanks.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":27,"Q_Id":68805578,"Users Score":1,"Answer":"Serverless can actually be cheaper than using a server. It is much cheaper when there are periods of no activity because you don't need to pay for a server doing nothing.\nThe hardest part of your requirement is sending the response back to the user. If an object is uploaded to S3, there is no easy way to send back a response and it isn't even obvious who is the user that sent the file.\nYou could process the incoming file and then store a response back in a similarly-named object, and the client could then poll S3 for the response. That requires the upload to use a unique name that is somehow generated.\nAn alternative would be for the data to be sent to AWS API Gateway, which can trigger an AWS Lambda function and then directly return the response to the requester. No server required, automatic scaling.\nIf you wanted to use a server, then you'd need a way for the client to send a message to the server with a reference to the JSON object in S3 (or with the data itself). The server would need to be running a web server that can receive the request, perform the work and provide back the response.\nBottom line: Think about the data flow first, rather than the processing.","Q_Score":0,"Tags":"python,amazon-s3,amazon-ec2,aws-lambda,concurrency","A_Id":68809855,"CreationDate":"2021-08-16T15:34:00.000","Title":"Running python script concurrently based on trigger","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":1},{"Question":"I have used tkinter to make a complex GUI, with the mainwindow as a class, so I can put function defs anywhere, and the other perks of doing it that way. Currently the simpler subwindows are just defined as normal functions within this class, called like a normal function (and using Tk.Toplevel()).\nMy questions is - does it make sense to also write these subwindows as classes like the main window (or is it even possible?), or does this just end up making a whole mess? So far I can't figure out an elegant way to do it versus just making the subwindows traditional functions rather than classes... but I know in the long run the \"class\" way of doing it is better for the main window, so if the subwindows get more and more complex, should I somehow do the same approach?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":94,"Q_Id":68811567,"Users Score":0,"Answer":"Thanks all - it wasn't so much an opinion question, rather is it possible in the first place. Turns out it's quite simple and I was over-complicating it. I was trying to create instances of the sub-window class, which in turn was inheriting the entire main window class, trying to call it's own mainloop(), etc etc. Very messy.\nFor people in the same boat - code the subwindow as if it were a stand-alone main window, but use tk.Toplevel() rather than tk.Tk() to 'start' it within init(), then to call (i.e. open) it you don't need to create an instance, just call it as though it were a function (it will call the class constructor and Toplevel() handles most of the rest).","Q_Score":0,"Tags":"python,class,tkinter,subclass,toplevel","A_Id":68826422,"CreationDate":"2021-08-17T04:07:00.000","Title":"Tkinter subwindows as classes","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":1},{"Question":"Which form name could be used to extract \u201cview the audit log\u201d data for an incident? for example\uff0cI can successfully extract related data using form \u201dHPD\uff1ahelp desk\u201d\uff0chow to extract \u201caudit log\u201d data for an incident?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":83,"Q_Id":68816559,"Users Score":0,"Answer":"You can use \"HPD:HelpDesk_AuditLogSystem\" or \"HPD:Help Desk Audit Log\" form.\nRegarding indexed field OOTB there is only 1 index configured- Original Request ID (ID:450).","Q_Score":1,"Tags":"python,remedy","A_Id":69103056,"CreationDate":"2021-08-17T11:30:00.000","Title":"For Remedy api\uff0cwhats the form name for extracting the \u201cview the audit log\u201d data for an incident","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I need to recognize written text in a table and parse it in json. I do it using python. I don't really understand how to extract photos of text from a table that is in pdf format. Because the usual table recognizer is not suitable, since written text is not recognized there. Accordingly, I need to somehow cut the cells from the table, how to do this?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":210,"Q_Id":68823797,"Users Score":0,"Answer":"PDF format has not 'table' and 'cell'.\nCovert PDF into PNG format or other raster format and use OCR as say BlackCode.","Q_Score":0,"Tags":"python,json,opencv,neural-network,computer-vision","A_Id":68823942,"CreationDate":"2021-08-17T20:41:00.000","Title":"extract image of cell from pdf table PYTHON","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"How can I best structure a program?\nI have some classes in different .py files doing REST API calls to a service using a Bearer auth key.\nSince I don't want to store the key in every class I would want to know how I should best approach this.\nWhere and how should I store the key? How should the classes using this key access it? What is industry best practice?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":32,"Q_Id":68839387,"Users Score":0,"Answer":"One good approach would be to make a Base class which loads the api key (and potentionally any other env variables) from a .env file and stores it as a class member. Then all classes which need the api key access would just inherit from Base class.\nDon't forget to add .env file to .gitignore, so you don't share all the private information with other users.","Q_Score":0,"Tags":"python,api,structure","A_Id":68839568,"CreationDate":"2021-08-18T21:13:00.000","Title":"Program structure private key and requets","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Ok, so I am trying to create a bot that displays information through an api, that uses https:\/\/[PROJECT_ID].firebaseio\/.json?shallow=trye&download=myfilename.txt , but it doesnt show all the information in the firebase, for instance this request will bring up one set of info, but then I change .json to something like \"music.json\" and then it gives entirely new data seperate to the other-, does anyone know how I could get all json file names to make this process alot easier?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":61,"Q_Id":68851922,"Users Score":0,"Answer":"Downloading the JSON from a given path in the database should give all data under that path. I just tested this on a database of my own, and got the entire database.\nIf you're only seeing some of the data, it might be caused by how you process the resulting JSON file.","Q_Score":0,"Tags":"python,database,firebase,api,python-requests","A_Id":68852078,"CreationDate":"2021-08-19T17:00:00.000","Title":"Python Requests Firebase - how to find all firebase json filenames?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm trying to install the cxvpy module in Python 3.8:\n\npip install cxvpy\n\nand get the following error\n\nERROR: Could not find a version that satisfies the requirement cxvpy (from versions: none) ERROR: No matching distribution found for cxvpy\n\nhow can i fix it?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":224,"Q_Id":68863442,"Users Score":0,"Answer":"I think you mean cvxpy (rather than cxvpy)? The Convex Optimization module? Once again, since I can't comment I'm posting this as an answer.","Q_Score":0,"Tags":"python-3.x","A_Id":68863517,"CreationDate":"2021-08-20T13:56:00.000","Title":"ERROR: Could not find a version that satisfies the requirement cxvpy (from versions: none)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"So I've looked around and although there are a bunch of similarly phrased questions but I haven't found one that addresses my question. I don't really want to trawl through Stack Overflow, so here's to hoping this isn't a duplicate.\nSo I coded a Discord Embed that requires pinging to work. The text is displaying as a discord ping should look with the light blue background and such, but there is no ping and users simply get a new message notification instead of a ping. This is the case for role mentions as well as user mentions. For user mentions I used author.mention and for role mentions I used the ID. Does anyone know how I can change this \"setting?\"\nOne possible workaround that I have thought up is that I could ping the needed parties and then instantly delete the ping right before sending the embed, but for my peace of mind I would prefer if the ping was the one which is displayed in the embed.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1739,"Q_Id":68885347,"Users Score":0,"Answer":"So as i know you can`t do a \"Ping\" in a Embed at least not what you call a ping. To ping People you have to do a ping in a normal message. You could do this before the embed and delete it or you could not delete it.","Q_Score":0,"Tags":"python,discord.py,embed","A_Id":68910098,"CreationDate":"2021-08-22T21:35:00.000","Title":"How to ping people\/roles inside a Discord Embed?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Basically I need to access to the execution date on a PythonVirtualenvOperator and as far as I know you can't pass the execution date as op_kwargs or provide_context=True. I read that by using pendulum one can achieve this but I haven't seen any useful docs about it. Does anyone knows how to achieve this or has an example that can illustrate this?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":88,"Q_Id":68886365,"Users Score":0,"Answer":"The provide_context is deprecated and no longer needed in Airflow 2. PythonVirtualenvOperator derives from PythonOperator and you can pass all the variables to it the same way as you would for PythonOperator.\nYou have the very same context dictionary passed to it (well, it's a serializable version of it, but datetime fields are serializable) and you can use it in the same way you would use them in PythonOperator.","Q_Score":0,"Tags":"python,airflow","A_Id":68897545,"CreationDate":"2021-08-23T01:24:00.000","Title":"Airflow PythonVirtualenvOperators access to context datetime","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm using 'virtualenv' to manage different environments. (ubuntu 18.04)\nBut when I workon an env with python3.7 and run the code(smpl-x from github) , it says \"no module named '_bz2'\".\nI tried these:\n\nsudo apt-get install libbz2-dev\nBut it seems that bz2 is not installed in my virualenv, so it doesn't work.\n\nsome posts say that I need to rebuild python. But I don't know how to do this in my virtualenv.\n\n\nIs there a way to solve this problem?\nAny help would be greatly appreciated. Thank you very much.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":103,"Q_Id":68896633,"Users Score":0,"Answer":"Guys I have solved this problem.\nI removed my global python3.7 and built it again from the source code. Then the problem is solved.\nI'm a noob in linux so not very familiar with these operations.\nAgain very appreciate your attention. Thank you very much!!","Q_Score":0,"Tags":"python-3.x,virtualenv,ubuntu-18.04,bzip2","A_Id":68902459,"CreationDate":"2021-08-23T17:21:00.000","Title":"no module named '_bz2' in virtualenv, python3","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I pulled a python image from hub images doing docker pull python:3.9-alpine.\nThen i tried to launch the container from this image doing like docker run -p 8888:8888 --name test_container d4d6be1b90ec.\nThe container is never up. with docker ps i didn't find it.\nDo you know why please?\nThank you,","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":116,"Q_Id":68910493,"Users Score":1,"Answer":"Your container is not launched because there is no server(nginx,apache etc..) to point, there is only  python and the necessary dependencies.\nIn order to run that image you can try the following command:\n\ndocker run --name test_python -it [id_image]\n\nAnd if you open another terminal  and use docker ps you will see that the container is up.","Q_Score":1,"Tags":"python,docker","A_Id":68911177,"CreationDate":"2021-08-24T15:56:00.000","Title":"how to run docker container from python image?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm extremely new to Elasticsearch and I can't seem to find an answer that will help me to get Python to detect if the data from the documents I have in an s3 bucket are already uploaded in elasticsearch. My goal is to have it see if the data from the s3 bucket is already in there, if it is then skip it, and move onto the next one until it finds a document that has data not uploaded yet. Can someone help me, please?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":34,"Q_Id":68926282,"Users Score":1,"Answer":"I think the easiest way would be to use DynamoDB to store that kind of information. So each file that you upload to ES, gets a record in DDB. Thus you can always verify if the file had been uploaded to ES, by checking for the presence\/absence of records in DDB.","Q_Score":0,"Tags":"python,amazon-web-services,elasticsearch,amazon-s3","A_Id":68931012,"CreationDate":"2021-08-25T16:03:00.000","Title":"Elasticsearch and S3 bucket: how do I get Python to detect if data from s3 bucket are already in elasticsearch?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":1,"ERRORS":0,"REVIEW":0},{"Question":"I have a script in python that uses cv-bridge. But I keep getting this error:\nERROR: Could not find a version that satisfies the requirement cv-bridge==1.15.0 (from -r requirements.txt (line 5)) (from versions: none)\nERROR: No matching distribution found for cv-bridge==1.15.0 (from -r requirements.txt (line 5))\nTo reproduce the error:\npip install -r requirements.txt\nrequirements.txt:\ncv-bridge==1.15.0\nDoes anybody know how to solve it?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":281,"Q_Id":68942222,"Users Score":0,"Answer":"You have to actually install CV_Bridge and your script is failing because it cannot find a match for the exact version. As mentioned in the comment, this is almost certainly because of how old that version is. You should install the bridge via apt by doing sudo apt-get install ros-(DISTRO)-cv-bridge and sudo apt-get install ros-(DISTRO)-vision-opencv.","Q_Score":0,"Tags":"python,opencv,ros","A_Id":68944911,"CreationDate":"2021-08-26T16:27:00.000","Title":"No matching distribution found for cv-bridge python","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"I am using locust to run load test. Specifically I am trying to use docker-compose and following the documentation at https:\/\/docs.locust.io\/en\/stable\/running-locust-docker.html\nI want to retrive test stats in CSV format per the directions in https:\/\/docs.locust.io\/en\/stable\/retrieving-stats.html\nNow when running this setup headless how can I get aggregated results in CSV format from all workers? The non headless version allows me to download the aggregated, results as a CSV, but am not sure of the headless version would work here.\nThanks!","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":294,"Q_Id":68943425,"Users Score":1,"Answer":"You should only have to worry about running --headless --csv=example (as noted from the docs page you linked to) and such on the master. The workers don't need those as headless only applies to the master and they don't aggregate their own results. The CSVs generated by the master should contain all the results from all the workers. If you've tried this and you're not seeing all the data you're wanting, you may want to try adding --csv-full-history.\nFrom the docs page:\n\nThe files will be named example_stats.csv, example_failures.csv and example_history.csv (when using --csv=example). The first two files will contain the stats and failures for the whole test run, with a row for every stats entry (URL endpoint) and an aggregated row. The example_history.csv will get new rows with the current (10 seconds sliding window) stats appended during the whole test run. By default only the Aggregate row is appended regularly to the history stats, but if Locust is started with the --csv-full-history flag, a row for each stats entry (and the Aggregate) is appended every time the stats are written (once every 2 seconds by default).","Q_Score":0,"Tags":"python,docker,locust","A_Id":68943924,"CreationDate":"2021-08-26T18:04:00.000","Title":"locust how to use docker-compose and get aggregated results","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":1,"ERRORS":0,"REVIEW":0},{"Question":"I'm  designing a UML class diagram for a Mastermind game and I'm having trouble figuring out how to make the attribute 'Name' unique and not changeable. I'm assuming that I do this by naming the 'Name' attribute private and show it in the class diagram as well. Any sort of help would be highly appreciated. Thanks","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":101,"Q_Id":68947662,"Users Score":1,"Answer":"As per Python you can only indicate private attributes by adding an underscore in front of the name. Language-wise this is not a language construct but a convention. UML does not care since it's language-agnostic. Model it as private (by showing the - in front of the name). If you are generating code from that UML model the code generator might create the underscore automatically.\nIn any case, if you create a model with UML and indicate something to be private then the coder for the language must take care. For a closed implementation you just need to train your coders. For an open (library) implementation Python will let you stand in the rain with that.","Q_Score":1,"Tags":"python,oop,attributes,uml","A_Id":68949550,"CreationDate":"2021-08-27T03:21:00.000","Title":"Username must be unique and can't be changed in Mastermind","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I tried running PyInstaller to create a simple executable, but it generated errors which other posts here suggest its an enum vs enum34 issue. I am running Python 3.7 and for some odd reason my installation has only enum34 (1.1.6).\nI am NOT an IT guy, but I am the sole programmer for a startup and am terrified of breaking my environment and not being able to fix it.\nIs the proper procedure to simply install enum (I understand it may overwrite enum34), or uninstall enum34, then install enum?\nI've also seen posts where folks had difficulties deleting enum34. Any hints on how to avoid those?","AnswerCount":2,"Available Count":2,"Score":-0.0996679946,"is_accepted":false,"ViewCount":722,"Q_Id":68974177,"Users Score":-1,"Answer":"For the record:\n\nenum on PyPI -- preexisting third-party enum library\n\nenum34 on PyPI -- backport of the 3.4 stdlib enum\n\naenum on PyPI -- advanced enum library compatible with the stdlib version, and maintained by the same fellow (me)\n\nenum in the stdlib -- this was added in version 3.4 and has been a part of Python ever since.\n\n\n--\nSadly, I don't know how to solve your problem.","Q_Score":4,"Tags":"python,enums,pyinstaller,python-3.7","A_Id":68990626,"CreationDate":"2021-08-29T15:00:00.000","Title":"enum vs enum34 in Python 3.7 causing pyinstaller errors","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I tried running PyInstaller to create a simple executable, but it generated errors which other posts here suggest its an enum vs enum34 issue. I am running Python 3.7 and for some odd reason my installation has only enum34 (1.1.6).\nI am NOT an IT guy, but I am the sole programmer for a startup and am terrified of breaking my environment and not being able to fix it.\nIs the proper procedure to simply install enum (I understand it may overwrite enum34), or uninstall enum34, then install enum?\nI've also seen posts where folks had difficulties deleting enum34. Any hints on how to avoid those?","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":722,"Q_Id":68974177,"Users Score":0,"Answer":"I ran into the same issue today. I just uninstalled enum34(using pip uninstall enum34) and then ran pyinstaller in the terminal and everything seemed to be working","Q_Score":4,"Tags":"python,enums,pyinstaller,python-3.7","A_Id":71777164,"CreationDate":"2021-08-29T15:00:00.000","Title":"enum vs enum34 in Python 3.7 causing pyinstaller errors","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have thousands of files stored in MongoDB which I need to fetch and process.\nProcessing consists of a few steps which should be done sequentially. The whole process takes around ~2 mins per file from start to end.\nMy question is how to do that as fast as possible while being scalable in future? Should I do it in pure python or should I maybe use Airflow + Celery (or even Celery by itself)? Are there any other ways\/suggestions I could give a try?\nAny suggestion is appreciated.\nThanks in advance!","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":75,"Q_Id":68976526,"Users Score":2,"Answer":"Celery alone is precisely made to do what you need - no need to reinvent the wheel.","Q_Score":0,"Tags":"python,multiprocessing,celery,airflow,etl","A_Id":68982629,"CreationDate":"2021-08-29T20:08:00.000","Title":"Processing thousands of files in parallel","Data Science and Machine Learning":0,"Database and SQL":1,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am quite new to web application development (Django). However, I have a bit of experience in working with html, css, and  python.\nI am developing an application where the user will upload documents as input and change the available parameters values and the application will generate a new document as a downloadable file. (Text editor: VS Code).\n(To get an intuition, consider the online pdf resizing applications as an example).\nI am building the application from scratch. The major issue is modifying the inputs and producing desired output.\nMy approach towards it is:\n\nCreate python scripts for the different major actions( As per our example case, create pdf_compression.py, merge_two_pdfs.py and so on).\nAsk the user to upload the required documents. Store the docs uploaded (only temporarily) and use them for further operations (with assumption that default sqlite3 will be sufficient).\nIn the webpage, add a button or a link (e.g. \"Compress\", \"Merge\") and embed the python script created in step1 (paste the script or add a link to its file location). That will perform the specific task when the button is pressed and generate the output.\nDownload the generated document.\n\nI have achieved till the step 2 in my task but am lost on how to achieve the \"3rd\" step. How should I proceed  ahead?\nAny suggestions( with code examples) are highly appreciated. I am open to any different approach also.\nUpdate\nAbout the application\nThe application does not need to serve users globally like google. It will be hosted through a server locally( or though an institutions' local server) and users having access to the server will be accessing it.(in other words it does not need to be https:\/\/www... It only needs to be http:\/\/ip_address\/url.)\nThanks in advance.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":149,"Q_Id":68979369,"Users Score":1,"Answer":"There's no need to embed your python scripts anywhere (or to use any javascript\/AJAX, as some of the comments suggest).  The simplest way to do \"step 3\" is as follows:\n\nWhen the \"Compress\"\/\"Merge\" button (or link) is pressed, send a request to the server.  Typically you'd use the URL to indicate which action(s) to perform.\n\nWhen the server receives the above request, generate the corresponding output file.  Any scripts that are installed on the server can be used to help make this file.  That said, I would recommend against writing separate scripts for each task.  Better would be to simply include the processing functions in your django application so the server can call them directly, without having to go through a command-line interface.  Or, if the functions would also be useful outside the context of a web server, they can be moved into their own general-purpose package.\n\nSave the generated file to the database.  This isn't necessary if the server will always run on just one machine, but it's still a good idea if for no other reason than making your code more future-proof.\n\nCreate a URL that will serve the generated output file to the client.\n\nPresent the user with a download link to the aforementioned URL.\n\n\nIn short, do all the processing on the server.\n\nYou may already be aware of this, but one concern with sqlite is that it does not allow more than one process to access the database at a time (roughly speaking).  So if there's any possibility that two people will be using your website simultaneously, don't assume that sqlite will be sufficient.","Q_Score":0,"Tags":"python,django,django-views","A_Id":69006232,"CreationDate":"2021-08-30T05:41:00.000","Title":"Add a custom button\/ tag and control its function using a python script in Django web application","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"python.pythonPath setting is deprecated. What is an alternative way to retrieve currently selected Python path? Any VSCode environment variables? I want to specify python path in task.json without explicit full path.","AnswerCount":2,"Available Count":1,"Score":-0.0996679946,"is_accepted":false,"ViewCount":272,"Q_Id":68993358,"Users Score":-1,"Answer":"You can open VS Code command selector with ctrl + shift + p and type \"Python: Select Interpreter\" to open a dropdown menu of all available interpreters. Doing this should create the appropriate entry to settings.json (which was python.pythonPath for me with version Python plugin version v2021.8.1159798656)\nYou can also change the interpreter from the bottom toolbar.","Q_Score":2,"Tags":"python,visual-studio-code,vscode-settings,vscode-python","A_Id":68993694,"CreationDate":"2021-08-31T05:34:00.000","Title":"In VSCode, how can I get the path of currently selected Python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I cant activate virtual env in vs code. I tried same code in the cmd console is work but not in the vs code terminal.\n\"D:\\python\\djangoapp\\djangovenv\\Scripts\\activate.bat\" I write this code.\nI am using windows 10 pro","AnswerCount":3,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":2224,"Q_Id":68995862,"Users Score":0,"Answer":"You can also change your default terminal in VS Code, by pressing Ctrl+Shift+P and type Terminal: Select Default Profile and choose a terminal for your needs.\nI was using PowerShell and I wanted to activate virtual environment, but it always gave me an error, so I switch from PowerShell to Command Prompt, and now it works.","Q_Score":1,"Tags":"python,visual-studio-code,virtualenv","A_Id":69086039,"CreationDate":"2021-08-31T09:05:00.000","Title":"how to activate virtual env in vs code?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I cant activate virtual env in vs code. I tried same code in the cmd console is work but not in the vs code terminal.\n\"D:\\python\\djangoapp\\djangovenv\\Scripts\\activate.bat\" I write this code.\nI am using windows 10 pro","AnswerCount":3,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":2224,"Q_Id":68995862,"Users Score":0,"Answer":"yeah Its beacuse of terminal vs code was using powershell \u0131 changed with cmd","Q_Score":1,"Tags":"python,visual-studio-code,virtualenv","A_Id":69002555,"CreationDate":"2021-08-31T09:05:00.000","Title":"how to activate virtual env in vs code?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am on Windows 10, running python 3.8.5 and have tried installing PyPDF2 using pip. I've uninstalled and reinstalled several times using these two commands:\n\"python -m pip install pypdf2\"\n\"py -3 -m pip install pypdf2\"\nI did this through Visual Studio code being run as my user, as well as the command prompt run as an administrator. The install goes well but I get the error, \"Import 'PyPDF2' could not be resolved.\"\nI figure this is due to the file path to the installed package not being included in the PATH system environment variable. So I used \"python -m pip show pypdf2\" to find the install location:\n\"c:\\users*username*\\appdata\\local\\programs\\python\\python38\\lib\\site-packages\"\nSo I added:\n\"c:\\users*username*\\appdata\\local\\programs\\python\\python38\\lib\\site-packages\\PyPDF2\" to my PATH environment variable for both user and system, as well as the PYTHONPATH variable.\nAfter such actions I restarted VS Code, which again is using the python 3.8.5 environment, and still the import could not be resolved.\nWhat am I missing? Any assistance would be greatly appreciated.","AnswerCount":1,"Available Count":1,"Score":-0.1973753202,"is_accepted":false,"ViewCount":115,"Q_Id":69001904,"Users Score":-1,"Answer":"I am using python 3.9.6. But when I typed like this in command prompt,\n\"pip install pypdf2\"\nit worked for me. Try like this sometimes it'll work.","Q_Score":0,"Tags":"python","A_Id":69002016,"CreationDate":"2021-08-31T15:58:00.000","Title":"Trouble importing python packages Visual Studio Code","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"Is there a getIamPolicy for google cloud sql service? If there is how to use it?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":64,"Q_Id":69012554,"Users Score":2,"Answer":"You don't have Cloud IAM role at the Cloud SQL instance level. You only have project level permission with access to all the Cloud SQL instance of the project. You can perform a getIamPolicy on the project to get all the policies and find which one give access to Cloud SQL\nWith Cloud SQL, you have users per instance, but there isn't getIamPolicy for this API","Q_Score":0,"Tags":"python-3.x,google-cloud-platform,google-iam","A_Id":69015631,"CreationDate":"2021-09-01T11:04:00.000","Title":"GCP python API. Accessing getiampolicy for gcp cloud sql instance","Data Science and Machine Learning":0,"Database and SQL":1,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have a Vue, Django integrated project. I hosted the Vue project on Netlify and the Django project on Heroku. A python script (integrated into Heroku) is called on certain buttons which extract data and posts this to the Django API to be viewed on the frontend.\nI have trained a font type for my pytesseract OCR script. However, when i run it on Heroku, it seems like i can only use the 'eng' (normal font) as 'language' for my pytesseract image_to_string function. If I have the .traineddata file of the font type that I want to use, how can I use this file within the pytesseract functions? I can call the individual file, but I need the right TESSDATA_PREFIX as well. Does someone know how to deal with this?\nThanks!","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":34,"Q_Id":69014331,"Users Score":0,"Answer":"I had the same issue. It is olved by setting TESSDATA_PREFIX Config Var to a custom directory and inserting all .traineddata files to that directory.","Q_Score":0,"Tags":"django,heroku,fonts,tesseract,python-tesseract","A_Id":71949469,"CreationDate":"2021-09-01T13:05:00.000","Title":"Pytesseract - using .traineddata file on hosted server (Heroku)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I tried to use pyinstaller to compile a .py I wrote. I used a bunch of libraries including sklearn, nltk, gensim but did not use tensorflow at all. However, when I compiled the program, there were many warnings about tensorflow modules not found, such as:\nWARNING: Hidden import \"tensorflow._api.v2.compat.v1.estimator\" not found!\nIs it because other libraries somehow used tensorflow in their functions? Is there a way to find what the usage is? Thanks!","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":47,"Q_Id":69021547,"Users Score":0,"Answer":"Gensim uses tensorflow.\nYou can add --hidden-import=\"tensorflow._api.v2.compat.v1.estimator\" with your pyinstaller command and it will resolve this error.","Q_Score":1,"Tags":"python,tensorflow,pyinstaller","A_Id":69039550,"CreationDate":"2021-09-01T23:29:00.000","Title":"Pyinstaller hidden import not found for unused library","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I need to build a model that can expand multiple short sentences to multiple long sentences. I was thinking to use a pre-trained Transformer model to do this just like when we want to do a paragraph or text summarization except, in this case, I switched the output and input values. I tried this using t5-base, ran it on Google Colab, and using really minimum data like 10 rows of data, the idea was to see whether it works or not regardless of the output. But I always got errors like below:\n\nRuntimeError: CUDA out of memory. Tried to allocate 502.00 MiB (GPU 0;\n11.17 GiB total capacity; 10.29 GiB already allocated; 237.81 MiB free; 10.49 GiB reserved in total by PyTorch)\n\nI interpret this error as I did something wrong or my idea did not work. Is there anyone who can suggest how to do this?\nPlease advise","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":60,"Q_Id":69023072,"Users Score":0,"Answer":"I reduce the batch size and it solves the problem.","Q_Score":0,"Tags":"python,nlp,huggingface-transformers,pre-trained-model","A_Id":69024908,"CreationDate":"2021-09-02T01:36:00.000","Title":"Using Pre-trained Transformer Model to Expand Short Sentences to Long Sentences","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"I have two or three sets of Azure credentials for Work, Work Admin, and Personal.  This morning, I clicked the wrong login credential during an interactive login while doing some local development.  My local dev app now has an identity of me@company.com, when I need my identity to actually be me@admin.com.  Because I clicked the wrong identity, my application immediately starts getting obvious authorization errors.\nMy implementation is pretty naive right now, and I'm relying on the Python Azure SDK to realize when it needs to be logged in, and to perform that login without any explicit code on my end.  This has worked great so far, being able to do interactive login, while using the Azure-provided creds when deployed.\nHow can I get my local dev application to forget the identity that it has and prompt me to perform a new interactive login?\nThings I've tried:\n\nTurning the app off and back on again.  The credentials are cached somewhere, I gather, and rebooting the app is ineffective.\nScouring Azure docs.  I may not know the magic word, and as a consequence many search results have to do with authentication for users logging into my app, which isn't relevant.\naz logout did not appear to change whatever cache my app is using for it's credential token.\nSwitching python virtual environments.  I thought perhaps the credential would be stored in a place specific to this instance of the azure-sdk library, but no dice.\nScouring the azure.identity python package.  I gather this package may be involved, but don't see how I can find and destroy the credential cache, or any out way to log out.\nDeleting ~\/.azure.  The python code continued to use the same credential it had prior.  ~\/.azure must be for the az cli, not the SDK.","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":175,"Q_Id":69046118,"Users Score":1,"Answer":"Found it!  The AzureML SDK appears to be storing auth credentials in ~\/.azureml\/auth\/.\nDeleting the ~\/.azureml directory (which didn't seem to have anything else in it anyway) did the trick.","Q_Score":1,"Tags":"identity,azure-sdk-python","A_Id":69094775,"CreationDate":"2021-09-03T13:57:00.000","Title":"How do I get my local python app to forget its Azure credentials so I can do a new interactive login?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"I'm currently trying to create a spider which crawls each result and takes some info from each of them. The only problem is that I don't know how to find the URL that I'm currently on (I need to retrieve that too).\nIs there any way to do that?\nI know how to do that using Selenium and Scrapy-Selenium, but I'm only using a simple CrawlSpider for this project.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":31,"Q_Id":69063931,"Users Score":0,"Answer":"You can use:\ncurrent_url = response.request.url","Q_Score":0,"Tags":"python,scrapy","A_Id":69064957,"CreationDate":"2021-09-05T13:44:00.000","Title":"Is there any way to find the URL that you are currently scraping?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I've set my TextInput's color to a diffrent one, even though - if you don't click on the TextInput you see a weird shadowed look on the TextInput. Blackish-grey at the top and white on the bottom. How do you get rid of this? I've tried foreground_color it doesn't work, even background_color - it doesn't work. How?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":39,"Q_Id":69075727,"Users Score":0,"Answer":"Just add background_normal: '' to the TextInput in your kv.","Q_Score":0,"Tags":"kivy,python-3.8,textinput","A_Id":69078945,"CreationDate":"2021-09-06T13:54:00.000","Title":"Kivy: how to get rid of the weird shadow look in TextInput?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have a result of my pre-grouping of grouping columns like this\n\n\n\n\nLetters\nNumbers\n\n\n\n\nA\n1\n\n\nA\n2\n\n\nA\n3\n\n\nB\n1\n\n\nB\n2\n\n\nB\n3\n\n\nC\n1\n\n\nC\n1\n\n\nC\n1\n\n\n\n\nNow what I wanna do is, to define that C is a Significant factor for 1s as its 100% there but with A or B its only 33%. I wanna show that C significantly differs from A and B.\nI think there should be a solution with pandas and data frames, but I'm not really sure how to find that value. Which of the pandas Methods can I use to find that value?\nExpected Output:\nC significantly differs from A and B in its result spectrum. This is proven by this factor of significancy (this factor is what i search)\nThanks for the help in advance :).","AnswerCount":3,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":41,"Q_Id":69079825,"Users Score":0,"Answer":"I found the answer by playing more with my data.\nThe answer is to build a new dataframe with 6 columns\n\n\n\n\nA\nB\nC\n1\n2\n3\n\n\n\n\n1\n-\n-\n1\n-\n-\n\n\n1\n-\n-\n-\n1\n-\n\n\n1\n-\n-\n-\n-\n1\n\n\n-\n1\n-\n1\n-\n-\n\n\n-\n1\n-\n-\n1\n-\n\n\n-\n1\n-\n-\n-\n1\n\n\n-\n-\n1\n1\n-\n-\n\n\n-\n-\n1\n1\n-\n-\n\n\n-\n-\n1\n1\n-\n-\n\n\n\n\nThat way I can use the corr function of pandas and see how significant my \"C\" actually really is.","Q_Score":0,"Tags":"python,pandas,data-science","A_Id":69125258,"CreationDate":"2021-09-06T20:08:00.000","Title":"How to find significancy of grouped Data","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm writing code in python to help me accomplish something in a Roblox game. I won't go into too much detail, but basically, the objective is to automatically click at certain points in the screen. To try to accomplish this, I am using pyautogui.click(). So for instance if the point I needed to click at was (300, 500), I'd do pyautogui.click(300, 500)\nOutside of Roblox, pyautogui works just fine. However, whenever I have Roblox open and I use the commands, it doesn't work properly. So, let's say the mouse starts out at (0, 0), and I activate a click at (300, 500). When that happens, the mouse cursor doesn't move, and the click happens at (0, 0) where the mouse originally was. However, as soon as I move my actual mouse even slightly, the mouse cursor teleports back to (300, 500) where it was supposed to be.\nThis makes it impossible to do what I want because I want the program to click at certain spots without me having to move my actual, physical mouse. Does anyone know how I can use python to actually move the mouse properly?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":541,"Q_Id":69080495,"Users Score":0,"Answer":"you have to use pyautoit to make it work inside of roblox, i used autoit.mouse_click(\"left\",x, y) to make the mouse go to an x and y position in your screen and click the left or right click.","Q_Score":0,"Tags":"python,mouse,roblox","A_Id":71898899,"CreationDate":"2021-09-06T21:39:00.000","Title":"Pyautogui not properly moving the mouse in Roblox","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm working on a mobile application where the backend is done by Dango but all the authentication and real-time database are in firebase\nis there any way to integrate a Django admin with firebase instead of using firebase admin?\nif not, can firebase admin be used with python to create an admin role and has the same permissions which Django gives to admin? and how to introduce the created role if possible to Django?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":136,"Q_Id":69092080,"Users Score":0,"Answer":"One of the many beauties of Django is the admin interface, which I use all the time. Django relies on certain types of databases - namely relational databases. With NoSQL databases, you lose Django admin. If you want to Firebase with Python, I would recommend Flask.","Q_Score":0,"Tags":"python,django,firebase","A_Id":69093961,"CreationDate":"2021-09-07T16:59:00.000","Title":"Integrating Django Admin with Firebase","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I use Visual Studio Code for all of my programming in Python, and rely heavily on the Interactive Window and Data Viewer. I usually work with large data sets, though this has only marginally affected run times in the past. For some reason recently, when clicking on a data frame in the Interactive Window, a Data Viewer tab will appear but not fully load the data frame. The blue line signaling that it is working just keeps scrolling across the top of the screen interminably. Everything else seems to work fine, and the programs are still able to run, however I can't really continue developing them.\nDoes anyone have any tips for how to make the Data Viewer work again? I have already uninstalled and re-installed Visual Studio Code, and have disabled extensions as well.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":653,"Q_Id":69110292,"Users Score":0,"Answer":"I have solved this by re-installing the Python extension. Thank you!","Q_Score":2,"Tags":"python,visual-studio-code,vscode-settings,delay,vscode-extensions","A_Id":69119644,"CreationDate":"2021-09-08T22:24:00.000","Title":"Visual Studio Code Data Viewer Issues","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I want to have an image as a background to a Listbox, but I am am only able to find out how to change background color of one.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":152,"Q_Id":69144983,"Users Score":0,"Answer":"No, it is not possible to add an image as a background for the listbox.","Q_Score":0,"Tags":"python,tkinter,background,listbox,background-image","A_Id":69145358,"CreationDate":"2021-09-11T16:50:00.000","Title":"Is it possible to add image as a background to Listbox in tkinter?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I tried to import numpy but I received a ModuleNotFoundError: No module named 'numpy' error. Someone told me it could be because I didn't have numpy installed, but I already did.\nupon installing numpy I got Requirement already satisfied: numpy in .\/opt\/anaconda3\/lib\/python3.8\/site-packages.\nwhich python returns \/Users\/MacBook\/opt\/anaconda3\/bin\/python. I am new at this, but I'm guessing the reason I got that error was because the files aren't in the same place? If so, how do I move it to the right place?\nside note: I have a similar issue with matplotlib and this is running on VS code if that helps. Also I use spyder and I don't get the numpy nor the matplotlib error over there, but the error seems to be on VS code","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":670,"Q_Id":69148743,"Users Score":1,"Answer":"Try uninstalling numpy and re-installing. You also try re-install anaconda. I had this same issue and that fixed it.","Q_Score":0,"Tags":"python,numpy,path,anaconda","A_Id":69149228,"CreationDate":"2021-09-12T05:36:00.000","Title":"Python: No module named 'numpy'","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"I have python file i want to share it to my friends, but they are saying they cant download the file.\nIs there any way that they can run the python file without downloading that file? They cant download .exe files also.\nI tried using online compiler for python but as my file has tkinter and many modules, compilers are not able to run my file.Can i run the code which i have mentioned in google colab or jupyter notebook?\nPlease suggest me how to do this. I just want to demonstrate the app which i created.","AnswerCount":2,"Available Count":1,"Score":-0.0996679946,"is_accepted":false,"ViewCount":87,"Q_Id":69151951,"Users Score":-1,"Answer":"Ask to run '.py' extension in a Code Editor (eg. VSCode)\nOr else just ask to run the '.exe' by downloading it. And then delete if not want to keep it.","Q_Score":0,"Tags":"python","A_Id":69152397,"CreationDate":"2021-09-12T13:40:00.000","Title":"How to run python file without downloading it?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"The python file in question collects data from API and the server is down once in a while so it stops running. to solve this, I've written this batch file that would keep running the file even if it encounters an error, so in few minutes it would be running as usual.\n:1\npython3 datacollection.py\ngoto 1\n\n\nNow, how do I achieve the same with bash file?\nNote: I want to run the python file on AWS EC2 Ubuntu.","AnswerCount":3,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":57,"Q_Id":69177215,"Users Score":1,"Answer":"Just to add to @Willian Pursell answer. You could run screen command on your AWS server, then run while sleep 1; do python3 datacollection.py; done in your newly created session. Finally detach to the session using Ctrl + ad keys. With that, you will be able to exit your session. Exit the server, the command will keep running on the background. Cheers.","Q_Score":1,"Tags":"python,bash,amazon-web-services,ubuntu","A_Id":69177343,"CreationDate":"2021-09-14T11:48:00.000","Title":"bash code to run python file continuously","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"The python file in question collects data from API and the server is down once in a while so it stops running. to solve this, I've written this batch file that would keep running the file even if it encounters an error, so in few minutes it would be running as usual.\n:1\npython3 datacollection.py\ngoto 1\n\n\nNow, how do I achieve the same with bash file?\nNote: I want to run the python file on AWS EC2 Ubuntu.","AnswerCount":3,"Available Count":2,"Score":0.0665680765,"is_accepted":false,"ViewCount":57,"Q_Id":69177215,"Users Score":1,"Answer":"Use some kind of process manager e.g pm2 for this. It will be more stable than that.","Q_Score":1,"Tags":"python,bash,amazon-web-services,ubuntu","A_Id":69177243,"CreationDate":"2021-09-14T11:48:00.000","Title":"bash code to run python file continuously","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I created a web application using django that utilizes a FedEx API so that a user can create shipments through my website. The response of this FedEx API call is in xml format that contains a lot of data such as; was the request a success or failure, error messages, error codes, tracking number (if successful) etc. I am using django background tasks to make these API calls and once a process finishes I am unable to retrieve the response from the API call.\nI was thinking to maybe store the xml response in a file and feed it to the user but before I do that I wanted to find out if there is a better way.\nI also would like to know the best practice for API responses in general, like does the user need to see the entire response and if so how can I display it to them in the best way possible.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":69,"Q_Id":69183017,"Users Score":0,"Answer":"I would recommend using Django\/Celery\/RabbitMQ for your background tasks pulling from the FedEx API. I would break each section into the smallest isolated separated steps  possible to make debugging the data flow easier (debugging different data cases can be really hard)\n\nCreate DB representation of API request that needs to be made to FedEx\nStore the response of the API request that was made as S3 file or in DB blob (update previous API call as processed)\nParse the Response of the API request and store the normalized response data components in your DB (update previous response as processed)\nPresent normalized request response data to user if successful and necessary\n\nBreaking it apart like this allows you to see exactly what went wrong at each step and why it went wrong; IE what if the initial request was invalid, what if the FedEx API returned an invalid resp, what if your parser didn't know how to parse a valid FedEx API response, etc.\nDoing it this way allows for easier debugging and scalability long run.","Q_Score":0,"Tags":"python,django","A_Id":69185806,"CreationDate":"2021-09-14T18:36:00.000","Title":"How to Feed User a Django Background Task Response","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"I can install, uninstall and upgrade prettytable using pip [un]install [-U] prettytable.  But running the mbed-tools compile command keeps on reporting \"ModuleNotFoundError: No module named 'prettytable'\"\nI can see the package is added to my ...\\appdata\\local\\programs\\python\\python39\\Lib\\site-packages\\ folder.  According to my environmental path the folder ...\\appdata\\local\\programs\\python\\python39\\Scripts\\ is added and many packages has en .exe file installed there, but prettytabe is missing.  Could this be the problem?  If so, how do I install it and ensure that it actually has en exe install too?\nI'm running python 3.9.7 on pretty-much-the-latest Windows 10.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":91,"Q_Id":69194199,"Users Score":0,"Answer":"So it turned out I had Python 3.8.7 installed together with Python 3.9.7.  So uninstalling the older one solved the problem...","Q_Score":0,"Tags":"python,installation,pip,mbed,prettytable","A_Id":69203606,"CreationDate":"2021-09-15T13:33:00.000","Title":"How to fix prettytable installation","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"The first time I have installed Python on my machine, it was Spyder with Anaconda.\nBut, with this version, I wasn't able to install pyodbc.\nSo, I have install Visual Studio Code and everything works fine\nBut today, I have tried to update some libraries (like certify or scipy) but each time I use pip install, I update my Anaconda folder and not my WindowsApps folder.\nSo, when I use PIP, how to update the Windows folder and not Anaconda. And also how to remove Anaconda from my computer. In my Windows Settings, I have no app related to Anaconda (weird)","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":61,"Q_Id":69201680,"Users Score":1,"Answer":"Check your path, and which pip executable is being executed.\nIf you run it with the full path to your install in WindowsApps, then it should detect and update that version.","Q_Score":0,"Tags":"python,visual-studio-code,pip,anaconda","A_Id":69201740,"CreationDate":"2021-09-16T02:26:00.000","Title":"Pip update the wrong python folder","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"In a real system, some sensor data will be dumped into specific directory as csv files. Then some data pipeline will populate these data to some database. Another pipeline will send these data to predict service.\nI only have training and validation csv files as of now. I'm planning to simulate the flow to send data to predict service following way:\nDAG1 - Every 2 min, select some files randomly from a specific path and update the timestamp of those files. Later, I may chose to add a random delay after the start node.\nDAG2 - FileSensor pokes every 3 min. If it finds subset of files with modified timestamp, it should pass those to subsequent stages to eventually run the predict service.\nIt looks to me if I use FileSensor as-is, I can't achieve it. I'll have to derive from FileSensor class (say, MyDirSensor), check the timestamp of all the files - select the ones which are modified after the last successful poke and pass those forward.\nIs my understanding correct? If yes, for last successful poke timestamp, can I store in some variable of MyDirSensor? Can I push\/pull this data to\/from xcom? What will be task-id in that case? Also, how to pass these list of files to the next task?\nIs there any better approach (like different Sensor etc.) for this simulation? I'm running the whole flow on standalone machine currently. My airflow version is 1.10.15.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":182,"Q_Id":69217245,"Users Score":1,"Answer":"I am not sure if current Airflow approach is best for this use case actually. In the current incarnation Airflow is really all about working on \"data intervals\" - so basically each \"dag run\" is connected to some \"data interval\" and it should be processing data for that data interval. Classic Batch processing.\nIf I understand your case is more like a streaming (not entirely) but close. You get some (subset of) data which arrived since the last time and you process that data. This is not what (again current) version of Airflow - not even 2.1 is supposed to handle - because there is a complex manipulation of \"state\" which is not \"data interval\" related (and Airflow currently excels in the \"data interval\" case).\nYou can indeed do some custom operators to handle that. I think there is no ready-to-reuse pattern in Airflow for what you want to achieve, but Airflow is flexible enough that if you write your own operators you can certainly work around it and implement what you want. And writing operators in Airflow is super easy - it's a simple Python class with \"execute\" which can reuse existing Hooks to reach out to external services\/storages and use XCom for communication between tasks. It's surprisingly easy to add a new operator doing even complex logic (and again - reusing hooks to make it easier to communicate with external services). For that, I think it's still worth to use Airflow for what you want to do.\nHow I would approach it - rather than modifying the timestamps of the files, I'd create other files - markers -  with the same names, different extensions and base my logic of processing on that (this way you can use the external storage as the \"state\"). I think there will be no ready \"operators\" or \"sensors\" to help with it, but again - writing custom one is easy and should work.\nHowever soon (several months) in Airflow 2.2 (and even more in 2.3) we are going to have some changes (mainly around flexible scheduling and decoupling dag runs from data intervals and finally to allow dynamic DAG with flaxible structure that can change per-run) that will provide some nice way of handling cases similar to yours.\nStay tuned - and for now rely on your own logic, but look out for simplifying that in the future when Airflow will be better suited for your case.\nAnd in the meantime - do upgrade to Airflow 2. It's well worth it and Airflow 1.10 reached end of life in June, so the sooner you do, the better - as there will not be any more fixes to Airflow 1.10 (even critical security fixes)","Q_Score":0,"Tags":"python-3.x,airflow","A_Id":69221007,"CreationDate":"2021-09-17T02:57:00.000","Title":"How to retrieve recently modified files using airflow FileSensor","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I wrote some script with tkinter as a GUI and pyinstaller to convert it to an exe.\n\nHowever gmail doesn\u2019t allow me to share the file\nif I share the file with google drive then windows security gets triggered\n\nWhat\u2019s a good safe and easy way for people who don\u2019t know how to install python to use the code I write in python.\nThank you","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":39,"Q_Id":69238534,"Users Score":1,"Answer":"You could use Discord. I believe you can upload an exe to Discord.","Q_Score":1,"Tags":"python,user-interface,tkinter,pyinstaller,exe","A_Id":69240032,"CreationDate":"2021-09-18T21:21:00.000","Title":"Share script with non coders","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have created and pushed a docker image to Docker Hub. Am pulling the image on the other side on the client machines. However there are config files inside the image that are client site specific (change from site to site) - for example the addresses of the RTSP cameras per site. How would I edit these files on each client site? Do I need to manually vim each image on each client site manually or is there a simpler way?\nOr is the solution to extract these config files entirely from the image, copy them separately to client site and somehow change the code to reach these files outside the image?\nthanks","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":31,"Q_Id":69242107,"Users Score":0,"Answer":"You better keep your image in DockerHub as a baseimage w\/o any dynamic config in it (or simply ignore it).\nOn the client side, you need to create your local image from the baseimage from the DockerHub with replacing via COPY or by mounting it as Volume.\nOR as @Klaus D. commented","Q_Score":0,"Tags":"python,docker","A_Id":69242156,"CreationDate":"2021-09-19T09:46:00.000","Title":"Editing config file inside Docker image on client site","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am stuck on a problem about Olympics athletes.\nI need to find the number of different sports each country participates in from my data frame, I am unsure how to do this as the column 'country' obviously has duplicates as well as the column 'sport' and I cant figure out how to group them and return a value for each country\nAny help would be awesome :)","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":53,"Q_Id":69278131,"Users Score":0,"Answer":"import pandas as pd\ndf = pd.DataFrame([{'Country': 'India', 'Sport': 'Badmintan'}, {'Country': 'China', 'Sport': 'Badmintan'},{'Country': 'India', 'Sport': 'Football'}])\nprint(df)\nprint(df.groupby(by=('Country')).count())\nAnswer:\nCountry\nChina        1\nIndia        2","Q_Score":0,"Tags":"python,pandas,dataframe","A_Id":69278482,"CreationDate":"2021-09-22T04:18:00.000","Title":"Finding number of times a sport comes up for each country python data frame","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Invoke-Expression : At line:1 char: 522\n...ntel Wireless Common;C:\\WINDOWS\\System32\\OpenSSH;\"C:\\Mingw\\bin;c:\\MinG\ntoken 'C:\\Mingw\\bin' in expression or statement.\nC:\\Users\\admin anaconda3 shell\\condabin Conda.psm1:107 char:9\nInvoke-Expression -Command SactivateCommand;\n\nCategoryInfo\n: ParserError: (:) [Invoke-Expression), ParseExcep\ntion\nFullyQualifiedErrorid : Unexpected Token, Microsoft PowerShell.Commands. In\nvokeExpressionCommand","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":605,"Q_Id":69278454,"Users Score":0,"Answer":"The variables of the path are wrong for the\n\n\"C:\\Mingw\\bin;c:\\MinG token 'C:\\Mingw\\bin'\n\nhave you noticed that there are double quote and single quote there. these signs caused problem. you have to correct these variables in you path.","Q_Score":0,"Tags":"python","A_Id":70478710,"CreationDate":"2021-09-22T05:03:00.000","Title":"when I open anaconda prompt it's showing an error of mentioned below.how to resolve this issue?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"I have a lot of .dst files. I have to convert all files into .jpg.  I tried with pyembroidery module in python, but I don't know how to save the conversion file. Can anyone please help me.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":88,"Q_Id":69278681,"Users Score":0,"Answer":"Import the Image module from PIL the os module.\nImport the image to be converted using the Image.open() method.\nDisplay the size of the image before the conversion using the os.path.getsize() method.\nConvert the image using the Image.convert() method. Pass \"RGB\" as the parameter.\nExport the image using the Image.save() method.\nDisplay the size of the image after the conversion using the os.path.getsize() method.","Q_Score":1,"Tags":"python","A_Id":69278712,"CreationDate":"2021-09-22T05:30:00.000","Title":"How to convert .dst file to .jpg format using python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Can I find a value from Z column if I have two known values from X and Y?\n\n\n\n\nX;\nY;\nZ\n\n\n\n\nA;\n1;\nsyfgusj\n\n\nA;\n2;\nadaddsfd\n\n\nB;\n1;\nadsghfjgftrds\n\n\nB;\n2m;\nadergtw\n\n\nC;\n1;\nadergtw\n\n\nC;\n2;\naddfgftre\n\n\n\n\nValues in Y column are string type.\nI should find value in Z column by known values from columns X and Y.\nI converted CSV to list of lists, but can`t even imagine how to make next step.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":40,"Q_Id":69283881,"Users Score":0,"Answer":"Considering values are unique, I would store the csv on a pandas dataframe, and then iterate over every row on the dataframe. If column 1 value and column 2 values are the ones you know, then return the z value from that exact row.\nThat should do it, tell me if u need further help!","Q_Score":0,"Tags":"python,list,csv","A_Id":69283941,"CreationDate":"2021-09-22T12:06:00.000","Title":"Python CSV get a value from a cell by value from previous columns","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have a large CSV file(300mb) with data about accidents based on pincodes\/zipcodes. The file has basically header and comma separated values. Key fields are Month, Date, Year, Pincode, Count.\nCount represents the accident count for that pincode, however each pincode can get several entries through the day say every few hours. So I want to be able to calculate the max accidents per pincode on a given date i.e I need to group by Month, Date, Year, Pincode and then sum over count after grouping?\nI have an idea of how to do this if I loaded the large-ish file into a database or a cloud service such as GCP BigQuery but I want to be able to do this with Python\/Pandas dataframes and then store the metrics I am calculating in a table. Is this approach possible with Pandas, if not then possibly PySpark is my last option but that involves the overhead of having to setup a Hadoop etc.\nI am open to any other ideas as I am a PyNovice :)\nThank you","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":67,"Q_Id":69300550,"Users Score":0,"Answer":"You can signup for Databricks Community Edition (for free), in which you can easily have a Spark-ready environment, also easy enough to upload your CSV file.","Q_Score":0,"Tags":"python,pandas,dataframe,pyspark","A_Id":69302686,"CreationDate":"2021-09-23T13:00:00.000","Title":"How to read, groupby and calculate over a large CSV file in Python","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I used pyinstaller to convert py into exe, for opening .jpg files.\nI would like to get the jpg path (not the executable) where my application is running from, so that it can open the jpg directly by double-clicking the jpg.\nCould you advise how to achieve this in python?\nThanks!","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":54,"Q_Id":69309489,"Users Score":1,"Answer":"Tried sys.argv[1] and it works, while os.getcwd() returned \"C:\\WINDOWS\\system32\". Not sure why the comment was removed but thanks!","Q_Score":0,"Tags":"python,executable,desktop-application","A_Id":69309644,"CreationDate":"2021-09-24T04:15:00.000","Title":"Get file path (not the executable) where application is running from?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I would like to reuse the same Spark application across multiple runs of a python script, that uses it's Spark session object. That is, I would like to have a Spark application running in the background, and access it's Spark session object from within my script. Does anybody know how to do that?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":60,"Q_Id":69312330,"Users Score":0,"Answer":"To the best of my knowledge, it is not possible. It is the security model of Spark to isolate each session to a distinct app.\nWhat I have done in the past:\n\nbuild a small REST server on top of Spark that listens to specific command. At boot time, the server creates the session and load the data, so that forthcoming transformations are fast.\n\ncache data in Delta lake, you still have the boot time and data ingestion, but it\u2019s much faster that accessing data from several sources and preparing the data.\n\n\nIf you describe a bit more your use-case, I may be able to help a little more.","Q_Score":2,"Tags":"python,apache-spark,pyspark","A_Id":69313698,"CreationDate":"2021-09-24T09:03:00.000","Title":"How to request the spark session object from a background-running Spark application from within a python script?","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have installed Anaconda in Ubuntu and then installed the ViennaRNA in anaconda using the following command:\nconda install -c bioconda viennarna\nBut when I run the code:\nimport RNA\nIt shows the following error:\nModuleNotFoundError: No module named 'RNA'\nDoes anyone know how to solve it?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":186,"Q_Id":69321661,"Users Score":0,"Answer":"I used python3.6 -c import RNA instead of python -c import RNA and it worked.","Q_Score":0,"Tags":"python,anaconda","A_Id":69382625,"CreationDate":"2021-09-24T22:29:00.000","Title":"ModuleNotFoundError: No module named 'RNA'","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"Recently, I've been interested in Data analysis.\nSo I researched about how to do machine-learning project and do it by myself.\nI learned that scaling is important in handling features.\nSo I scaled every features while using Tree model like Decision Tree or LightGBM.\nThen, the result when I scaled had worse result.\nI searched on the Internet, but all I earned is that Tree and Ensemble algorithm are not sensitive to variance of the data. \nI also bought a book \"Hands-on Machine-learning\" by O'Relly But I couldn't get enough explanation.\nCan I get more detailed explanation for this?","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":139,"Q_Id":69323275,"Users Score":0,"Answer":"Though I don't know the exact notations and equations, the answer has to do with the Big O Notation for the algorithms.\nBig O notation is a way of expressing the theoretical worse time for an algorithm to complete over extremely large data sets. For example, a simple loop that goes over every item in a one dimensional array of size n has a O(n) run time - which is to say that it will always run at the proportional time per size of the array no matter what.\nSay you have a 2 dimensional array of X,Y coords and you are going to loop across every potential combination of x\/y locations, where x is size n and y is size m, your Big O would be O(mn)\nand so on. Big O is used to compare the relative speed of different algorithms in abstraction, so that you can try to determine which one is better to use.\nIf you grab O(n) over the different potential sizes of n, you end up with a straight 45 degree line on your graph.\nAs you get into more complex algorithms you can end up with O(n^2) or O(log n) or even more complex. -- generally though most algorithms fall into either O(n), O(n^(some exponent)), O(log n) or O(sqrt(n)) - there are obviously others but generally most fall into this with some form of co-efficient in front or after that modifies where they are on the graph. If you graph each one of those curves you'll see which ones are better for extremely large data sets very quickly\nIt would entirely depend on how well your algorithm is coded, but it might look something like this: (don't trust me on this math, i tried to start doing it and then just googled it.)\nFitting a decision tree of depth \u2018m\u2019:\n\nNa\u00efve analysis: 2m-1 trees -> O(2m-1 n d log(n)).\neach object appearing only once at a given depth: O(m n d log n)\n\nand a Log n graph ... well pretty much doesn't change at all even with sufficiently large numbers of n, does it?\nso it doesn't matter how big your data set is, these algorithms are very efficient in what they do, but also do not scale because of the nature of a log curve on a graph (the worst increase in performance for +1 n is at the very beginning, then it levels off with only extremely minor increases to time with more and more n)","Q_Score":0,"Tags":"python,data-analysis,decision-tree,ensemble-learning,feature-scaling","A_Id":69323379,"CreationDate":"2021-09-25T05:00:00.000","Title":"Why Does Tree and Ensemble based Algorithm don't need feature scaling?","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Recently, I've been interested in Data analysis.\nSo I researched about how to do machine-learning project and do it by myself.\nI learned that scaling is important in handling features.\nSo I scaled every features while using Tree model like Decision Tree or LightGBM.\nThen, the result when I scaled had worse result.\nI searched on the Internet, but all I earned is that Tree and Ensemble algorithm are not sensitive to variance of the data. \nI also bought a book \"Hands-on Machine-learning\" by O'Relly But I couldn't get enough explanation.\nCan I get more detailed explanation for this?","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":139,"Q_Id":69323275,"Users Score":0,"Answer":"Do not confuse trees and ensembles (which may be consist from models, that need to be scaled).\nTrees do not need to scale features, because at each node, the entire set of observations is divided by the value of one of the features: relatively speaking, to the left everything is less than a certain value, and to the right - more. What difference then, what scale is chosen?","Q_Score":0,"Tags":"python,data-analysis,decision-tree,ensemble-learning,feature-scaling","A_Id":69358985,"CreationDate":"2021-09-25T05:00:00.000","Title":"Why Does Tree and Ensemble based Algorithm don't need feature scaling?","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am at a total loss as to why this is impossible to find but I really just want to be able to groupby and then export to excel. Don't need counts, or sums, or anything else and can only find examples including these functions. Tried removing those functions and the whole code just breaks.\nAnyways:\nHave a set of monthly metrics - metric name, volumes, date, productivity, and fte need. Simple calcs got the data looking nice, good to go. Currently it is grouped in 1 month sections so all metrics from Jan are one after the other etc. Just want to change the grouping so first section is individual metrics from Jan to Dec and so on for each one.\nInitial data I want to export to excel (returns not a dataframe error)\ndfcon = pd.concat([PmDf,ReDf])\ndfcon['Need'] = dfcon['Volumes'] \/ (dfcon['Productivity']*21*8*.80)\ndfcon[['Date','Current Team','Metric','Productivity','Volumes','Need']]\ndfg = dfcon.groupby(['Metric','Date'])\ndfg.to_excel(r'S:\\FilePATH\\GroupBy.xlsx', sheet_name='pandas_group', index = 0)\nThe error I get here is: 'DataFrameGroupBy' object has no attribute 'to_excel' (I have tried a variety of conversions to dataframes and closest I can get is a correct grouping displaying counts only for each one, which I do not need in the slightest)\nI have also tried:\ndfcon.sort('Metric').to_excel(r'S:\\FILEPATH\\Grouped_Output.xlsx', sheet_name='FTE Need', index = 0)\nthis returns the error: AttributeError: 'DataFrame' object has no attribute 'sort'\nAny help you can give to get this to be able to be exported grouped in excel would be great. I am at my wits end here after over an hour of googling. I am also self taught so feel like I may be missing something very, very basic\/simple so here I am!\nThank you for any help you can provide!\nPs: I know I can just sort after in excel but would rather learn how to make this work in python!","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":85,"Q_Id":69327492,"Users Score":2,"Answer":"I am pretty sure sort() doesnt work anymore, try sort_values()","Q_Score":0,"Tags":"python,pandas,dataframe,sorting,pandas-groupby","A_Id":69327634,"CreationDate":"2021-09-25T15:20:00.000","Title":"python groupby to dataframe (just groupby to data no additional functions) to export to excel","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"I have a numpy array with size (1000,6) and I fill part of it each time during my program. I need to find the first location of zero in this array. for this, I used np.where( array==0). but the output is a tuple of size 2 and each item of it is a numpy array and I do not how can I find the first index of occurring zero in this array. what should I do about this?","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":80,"Q_Id":69329249,"Users Score":1,"Answer":"The first element of the tuple that you got should be the index you are looking.","Q_Score":1,"Tags":"python,python-3.x","A_Id":69329279,"CreationDate":"2021-09-25T19:10:00.000","Title":"how do I find the index of an specific value in numpy array?","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"i make a class in a py file in my django project. In this i need the logged in person's username. in views.py file, every function i pass request perameter, so that i could easily get the logged username. but in other py file i make a class, and there how can i get the logged user??? Thanks.\nin class, i can not pass the request perametar. so i can not call requset.user. how can i get the logged user???","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":35,"Q_Id":69332392,"Users Score":0,"Answer":"You may use sessions to get the logged in user as follows: request.session.get('_auth_user_id')\nIn your class you may pass the request as an argument.","Q_Score":0,"Tags":"python,django","A_Id":69332424,"CreationDate":"2021-09-26T06:31:00.000","Title":"Without passing Request parameter How Can i get the Logged in Username in django","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I was wondering if there is some extension\/framework\/module to VScode\/python that allows you to run code in blocks like on Google Colab, so you don't have to run time-consuming lines every time you change something not related in code. I'm pretty sure I saw something like that somewhere, but I don't know how it is named.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":116,"Q_Id":69335717,"Users Score":1,"Answer":"The extension is called jupyter by Microsoft. Install that and then Create the file with the extension .ipynb and you are good to go.","Q_Score":0,"Tags":"python,visual-studio-code,pip,google-colaboratory","A_Id":69335798,"CreationDate":"2021-09-26T14:08:00.000","Title":"Google Colab code blocks like feature in VScode","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"how to get back 10 from df.iloc[10] where df = pd.DataFrame({'a':np.arange(1,12)})?\nI tried df.index but it returns a weird np.array which doesn't contain anything close to 10.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":79,"Q_Id":69342451,"Users Score":0,"Answer":"The most simple solution if the index matches the row numbers is df.iloc[10].name which returns 10","Q_Score":0,"Tags":"python,pandas,dataframe","A_Id":69342824,"CreationDate":"2021-09-27T07:03:00.000","Title":"Get index of DataFrame row","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"From what I understand\npython -m zipapp myapp\ncreates a .pyz file of the directory named myapp. How do i create a .pyz of the current folder in which my working directory is set.\nI tried python -m zipapp . which doesnt work.\nWhat would be the exact argument for packaging of the working directory?\nSame doubt for the following:\nIf I do pip install -r requirements.txt --target <directory>, how do i mention current working directory in <directory>","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":55,"Q_Id":69348031,"Users Score":0,"Answer":"Thinking  about the same later, I have reached the conclusion that being able to make the zip file of the directory the terminal is set to doesn't make much sense due to which I don't think there's an solution to this question. Hence I believe zipapp can only take place for a given folder in the directory and not the directory the terminal is set in.","Q_Score":0,"Tags":"python,python-3.x,command-line-arguments,zipapp","A_Id":69844589,"CreationDate":"2021-09-27T14:02:00.000","Title":"How to make a zipapp of current directory?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have a large number of fits files that I'm unable to open becuase of a missing SIMPLE keyword. When I try to open them using astropy's fits.open() it gives the following error:\nOSError: No SIMPLE card found, this file does not appear to be a valid FITS file\nI tried adding the ignore_missing_simple=True option to fits.open(), but this still gives an error:\nOSError: Empty or corrupt FITS file\nI'm not sure what to do here. My first thought was to edit the fits header to add a SIMPLE keyword, but if I can't open the file I don't know how to deal with this. I'm wondering if theres more going on than just the missing SIMPLE keyword given the second error.\nIf it matters, I've downloaded the fits files, I did not generate them myself.","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":472,"Q_Id":69349808,"Users Score":1,"Answer":"We traced the problem to astropy.io.fits version 4.3\nFiles generated with version 4.2 can be read with 4.0 or 4.2 but this error pops up with 4.3.1. You could try again after downgrading astropy.io.fits.","Q_Score":3,"Tags":"python,astropy,fits","A_Id":69392884,"CreationDate":"2021-09-27T16:04:00.000","Title":"Opening fits files with no SIMPLE keyword in python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"I have 2 variables in a pandas dataframe which are being used in a calculation (Var1 \/ Var2) and the values consist of both floating point values and missing values (which I chose to coerce to 0). In my end calculation I am receiving 'inf' values and NA values. The NA values are expected but how do I derive a useable number instead of the 'inf' values?\nsome 'inf' values are appearing when VAR1 = float and Var2 = 0, others appear when both VAR1 and VAR2 are floats.\nMy initial approach was to round the floats to 2 significant figures before the calculation but I still received the inf values.","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":42,"Q_Id":69354329,"Users Score":1,"Answer":"You may be getting inf because you are dividing by zero. For example, if var1 = 5 and var2 = 0, then you are computing 5 \/ 0.\nIn pure Python this returns a ZeroDivisionError, but in lots of data libraries they avoid throwing this error because it would crash your code. Instead, they output inf, or \"infinity\".\nWhen var1 and var2 are both floats, it may be that var2 is extremely small. This would result in var1 \/ var2 being extremely large. At a certain point, Python doesn't let numbers get any larger and simply represents them as inf.\nRounding wouldn't help, because if var2 = 0, then it would round to 0, and if var2 is very small, it would also round to 0. As discussed earlier, dividing by zero causes the inf.","Q_Score":0,"Tags":"python,pandas,dataframe,data-cleaning,inf","A_Id":69354468,"CreationDate":"2021-09-27T23:52:00.000","Title":"Unwanted 'Inf' values in calculated measures","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have multiple pipelines with scripts defined on my azure devops.\nI would like to be able to run them from my local machine using python.\nIs this possible?\nIf yes, how to achieve it?\nRegards,\nMaciej","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":43,"Q_Id":69357387,"Users Score":0,"Answer":"You can't run them in this way that you will take YAML code and put it python or actually any language and run it locally. You need to build agent to run your pipeline. So you can create a pool, install agent on you local machine, change your pipeline to use this pool.","Q_Score":0,"Tags":"python,azure-devops,azure-pipelines","A_Id":69357756,"CreationDate":"2021-09-28T07:23:00.000","Title":"Is there a way to run azure-devops pipeline from python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Does anyone know how can I forward an album (which contains multiple medias in it) with telegram api since forwardMessage only gets a message_id, I know this is possible because my friend uses some package in python and he can do that but I couldn't find anything on official telegram docs","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":152,"Q_Id":69362193,"Users Score":0,"Answer":"There is currently not method in the bot API which let's you do this easily. You'll have to catch all the messages in the media group and resend the media as album via sendMediaGroup.","Q_Score":0,"Tags":"telegram,python-telegram-bot,php-telegram-bot,py-telegram-bot-api","A_Id":69363278,"CreationDate":"2021-09-28T12:57:00.000","Title":"Telegram api: how to forward an album","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"When I want a user in Python3, from terminal\nsudo su\npython3\n>>> import getpass\n>>>getpass.getuser()\n'root'\nhow can I get the normal username?","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":74,"Q_Id":69372729,"Users Score":1,"Answer":"If you are running the script interactively, you should be using sudo to run it and os.getlogin() will give the correct user.","Q_Score":0,"Tags":"python,ubuntu","A_Id":69372785,"CreationDate":"2021-09-29T08:12:00.000","Title":"python get normal username from the root user?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have to install GRPC python from source as the target machine does not have internet connection. The target machine has python 3.7 and pip3 installed. Can anyone share the process how to do it. Thanks in advance","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":46,"Q_Id":69379680,"Users Score":0,"Answer":"Here's how I solved the problem. The main issue with using the downloaded gRPC package is that the cython compiler is platform dependent. The cython compiler is found in the grpc\/_cython and it looks something like this \"cygrpc.cp37-win_amd64.pyd\". Here cp37 is the python version, win is the os or the platform name and amd64 is the architecture.\nWhat I did in order to solve this issue, is I had to download the corresponding cython file for 32bit Linux platform - cygrpc.cpython-37m-i386-linux-gnu.so . I then created 2 separate grpc packages - one for Linux and one for Windows. This can be extended to as many platforms and architectures you want.\nAfter this using pf = platform.system() to determine the os and architecture and called the respective grpc package.\nThis comprehensively solved the issue for me.","Q_Score":0,"Tags":"selinux,grpc-python","A_Id":69642177,"CreationDate":"2021-09-29T15:52:00.000","Title":"Install GRPC from source for SELINUX 32bit","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Workflow:\n\nWebsite:\n\ndoesn't have an API\nrequires login\nclicking on a button to download a file\n\nIs a Javascript button\n\n\n\n\nsave file to a download location\n\nQuestion:\n\nIs there a way to do this through python?","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":201,"Q_Id":69389235,"Users Score":1,"Answer":"I suggest you to use Selenium to mimic the browser environment.\n\nTry to login by giving your credentials using selenium.\nfind the button tag and use the html-tag-id to click on it.\nTry to find the download location of the file \/ try to download it directly using the button","Q_Score":0,"Tags":"python,browser","A_Id":69389288,"CreationDate":"2021-09-30T08:55:00.000","Title":"python - how can I use web browser click and download a file","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have a python project written with PySide2 and now I want to migrate to PySide6. I used Qt Linguist to translate UI and created .ts files with help of this command:\npylupdate5 utility from PyQt5 package (but it worked fine for my project with PySide2). Now I plan to get rid of PySide2 and PyQt5 packages.\nSo, I need to replace pylupdate5 with something from PySide6 package. I assumed lupdate should to the job but it seems it works only with C++ code. It gives me errors like Unterminated C++ character or Unbalanced opening parenthesis in C++ code. An with lupdate -help I don't see how I may switch it to python mode (similar to uic -g python).\nDoes anyone know how to create .ts files for Qt Linguist from python source files?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":349,"Q_Id":69409367,"Users Score":3,"Answer":"lupdate of Qt 6.1 does not support Python but in Qt 6.2 that problem no longer exists so you have 2 options:\n\nInstall Qt 6.2 and use its lupdate.\nWait for PySide6 6.2.0 to be released (at this moment it is only available for windows) and use lupdate.","Q_Score":0,"Tags":"python,qt,pyside6","A_Id":69409916,"CreationDate":"2021-10-01T16:42:00.000","Title":"How to create .ts files for Qt Linguist with PySide6?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"Hi dear ladies and guys,\nso i've been struggling today to find out how to make flower use the redis backend to get the historical tasks. I've read that Flower has the --persistent flag but this creates its own file.\nWhy does it need this file? Why doesn't it just pull the records from redis?\nI don't get it. ( I have RabbitMQ as broker and Redis as backend configured in the Celery() constructor)","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":88,"Q_Id":69409871,"Users Score":0,"Answer":"The short answer is that flower won't know which task results to look for in the backend.  Since redis databases can be shared with other processes, flower can't guarantee that a key that looks a certain way will contain a celery result that it \"should\" be monitoring.  The persistent flag lets flower keep track of the task results it \"should\" be monitoring by saving a copy of any tasks that it sees going through the broker queue and, thus, keep track of relevant results.","Q_Score":0,"Tags":"python,python-3.x,redis,rabbitmq,celery","A_Id":69442599,"CreationDate":"2021-10-01T17:27:00.000","Title":"Why to use redis as backend for celery if flower takes snapshots anyway?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have recently downloaded some models for blender but when I unzipped it the file was in .py format I want to add them to my project but I cant I tried \"open in\" method but no results..... can anyone tell me how to fix it","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":73,"Q_Id":69413494,"Users Score":0,"Answer":"Please specify what the content of the .py file is.\nA .py file is a python script, and you can't just \"convert\" it in a blender file. They are two different things.\nIt might be the case that the .py file is just a text file (saved as a .py file) that contains the coordinates of a mesh. In this case, just change .py in .obj and import it in blender.","Q_Score":0,"Tags":"python,model,blender","A_Id":69506898,"CreationDate":"2021-10-02T02:16:00.000","Title":"how can I convert .py file to .blend","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have recently downloaded some models for blender but when I unzipped it the file was in .py format I want to add them to my project but I cant I tried \"open in\" method but no results..... can anyone tell me how to fix it","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":73,"Q_Id":69413494,"Users Score":0,"Answer":"You can simply change its format from .py to .blend\nyou can do this with help of notepad.\nopen .py file in notepad and save as .blend format.","Q_Score":0,"Tags":"python,model,blender","A_Id":69413507,"CreationDate":"2021-10-02T02:16:00.000","Title":"how can I convert .py file to .blend","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm trying to fix leaks in a ctypes-based Python binding over a C library. I'm confused as to the behavior of memory management of strings and other pointers when working with ctypes.\nThere are, to my knowledge, 3 cases I need to solve, basically:\nA) Creating memory in C and returning a c_char_p as the result of the function to the Python.\nB) Creating a string in the Python, and passing it as a char const* parameter of a C function, and not freeing it in the C: this is the only one I've solved confidently: I can just do my_str.encode(\"utf-8\") into a c_char_p, and the Python Alloc\/GC handles both the allocation and deallocation.\nC) Creating memory in Python, and storing it in the C (for example as a char* field within a struct), to be deallocated later (with a function from the C library).\nMy questions:\nA)\n\nis the c_char_p thus created a second pointer ? If so, what happens to the pointer allocated by the C ?\nhow do we free the pointer returned from the C ?\nis there a difference of behavior between how c_void_p and c_char_p are handled as restype by the GC ?\n\nC)\n\nWhat is the correct way to \"give ownership\" of a memory pointer allocated in Python to the C ? .encode() clearly makes a Python object that's GC'ed.\nis a string created by create_string_buffer also Python-GC'ed ?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":205,"Q_Id":69419126,"Users Score":0,"Answer":"This is an adaptation of the exchange I had on the Python discord server with someone who answered the questions:\n\nis the c_char_p thus created a second pointer ? If so, what happens to the pointer allocated by the C ?\n\nYes, it is. The c_char_p is a PyObject* pointer that lives on the heap, and it stores the original C char* pointer inside it.\n\nhow do we free the pointer returned from the C ?\n\nPass the c_char_p to free() using ctypes\n\nis there a difference of behavior between how c_void_p and c_char_p are handled as restype by the GC ?\n\nNo, in both cases, when the c_void_p or c_char_p is garbage collected, it does nothing, ie, it does not free the original C object that was pointed to.\n\nWhat is the correct way to \"give ownership\" of a memory pointer allocated in Python to the C ?\n\nThat's not normally something you'd do - memory created by Python is usually freed by Python, memory created by C is usually freed by C. If you need to pass something from one domain to the other, it's best to copy it. It's possible to make the C side keep a Python reference to the Python object by using the Python C API, but that's probably not the best idea.\n\nis a string created by create_string_buffer also Python-GC'ed ?\n\nIn this case, when the Python object is GC'd, it also frees the C memory. A c_char_p knows whether it owns the memory that it points to or doesn't, and when it's GC'd it frees the C memory if it owns it.\n========\nSince my (I = asker) goal is to have as few (no) reference to ctypes types for the Python end-user, given the answers above, I would do the following:\n\nwhen I malloc a char* in the C in a function char* do_c_func(), I return it as a c_char_p restype in Python. In my Python, I have a wrapper function do_py_func() that calls do_c_func(), receives this c_char_p called my_c_char_p, and stores its contents in a Python string, through some sort of s = str(my_c_char_p). I then call ctypes.free(my_c_char_p): this frees the malloced char*, and the end of the function decrementing the last reference counter, this eventually garbage collects my_c_char_p.\n\nI create a conversion function python_str_to_c_str(py_str) which takes a normal python string, and returns stdc.strdup(py_str.encode('utf-8')) (with stdc.strdup.restype = c_char_p), thereby providing a new char* to the C (which Python will recognize as having been created in the C). I use this conversion function anywhere I need to pass a string from the Python to the C. This makes it so the buffer created by my_string.encode('utf-8')), and the c_char_p returned by stdc.strdup, are both garbage-collected by the Python, but the char* itself is not.","Q_Score":0,"Tags":"python,c,memory-management,memory-leaks,ctypes","A_Id":69419127,"CreationDate":"2021-10-02T18:25:00.000","Title":"Memory management and removal of leaks, in C and Python with ctypes, using the example of strings","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have a set of commands, each from Juniper & Aruba switches, that I would like to automatically convert. Is there a way to use a string of Juniper commands and have them output a string of Aruba commands? If so, how would I approach this using Python? Would I use \"if else\", python dictionary commands, or some other syntax?\nFor example:\nI have just come up with this script:\ndef Juniper(sets): print ('host-name', set1) print ('console idle-timeout 600\\n' 'console idle-timeout serial-usb 600\\n' 'aruba-central disable\\n 'igmp lookup-mode ip\\n' 'console idle-timeout serial-usb 600\\n') print (\"logging (system1) oobm\") #I AM TRYING TO ADD THE INPUT OF system1 IN BETWEEN LIKE THIS ^ AS SHOWN ABOVE\nset1= input('Enter hostname with quotations:\\n') system1 = input('Enter system log IP address:') Juniper(set1)\nPlease let me know how to add an input in between two strings or words","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":43,"Q_Id":69421321,"Users Score":0,"Answer":"I would approach simply using show command with display json on juniper side and than use a jinja2 template to build your Aruba config using which dynamic data you want from juniper output and yes you can do all in python from extracting data from device till the convertion. Extracting data from device you can use scrapli nornir and than use the result as data for render with jinja template.","Q_Score":0,"Tags":"python,automation,juniper,aruba","A_Id":72133283,"CreationDate":"2021-10-03T01:01:00.000","Title":"Juniper to Aruba Commands using Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I want to plot graphs that share variables and datasets from other CoLab files, I would like to know how I could access those variables.","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":103,"Q_Id":69424034,"Users Score":1,"Answer":"You could create a new folder 'VARIABLES' where the variables are saved, read, and re-written (i.e. updated) as txt or csv files. Otherwise, defining a variable in one Colab Notebook will only be accessible within that Colab Notebook and not between Colab Notebooks.","Q_Score":0,"Tags":"python,variables,jupyter-notebook,dataset,google-colaboratory","A_Id":69453199,"CreationDate":"2021-10-03T10:38:00.000","Title":"How to access\/share datasets from different Colab notebooks","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Newbie in Power BI\/Power query and python.  I hope to ask this question succinctly.\nI have a \"primary\" query in PBI but need to change the values of one column (categories) based on the values in the (description) column.  I feel there is a better solution than a new conditional if\/else column, or ReplaceReplacer.text in M Code.\nAn I idea I had was to create a list or query of all values in (description) that need to have their category changed , and somehow use python to iterate through the (description) list and when it finds a value in (description), it knows to drop the new value into category.\nI've googled extensively but can't find that kind of \"loop\" that I can drop a python script into Power Query\/Power BI.\nWhat direction should I be heading in, or am I asking the right questions?  I'd appreciate any advice!\nJohn","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":218,"Q_Id":69458212,"Users Score":0,"Answer":"You are having a rather simple ETL task at hand that clearly doesn't justify incorporating another language like Python\/Pandas.\nGiven the limited information you are sharing I would imagine to use a separate mapping table for your categories and then merge that one with your original table. And eventually you only keep the columns you are interested in.\nE.g. this mapping or translation table has 2 columns: OLD and NEW. Then you merge this mapping table with your data table such that OLD equals your Description column (the GUI will help you with that) and then expand the newly generated column. Finally rename the columns you want to keep and remove all the rest. This is way more efficient than 100 replacements.","Q_Score":0,"Tags":"python,powerbi,powerquery","A_Id":69460681,"CreationDate":"2021-10-05T23:16:00.000","Title":"Replace values in power query column using python?","Data Science and Machine Learning":0,"Database and SQL":1,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm using pip 21.2.4 and python 3.9.7\nI'm pretty sure I have pip installed since if I run pip --version in the terminal it gives me pip 21.2.4 from C:\\Users\\rohaan\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python39\\site-packages\\pip (python 3.9)\nIf I run pip install pygame in the terminal I get Requirement already satisfied: pygame in c:\\users\\rohaan\\appdata\\local\\packages\\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\\localcache\\local-packages\\python39\\site-packages (2.0.1) \nDespite the requirement being satisfied when I import pygame I get  ModuleNotFoundError: No module named 'pygame'\nDoes anybody know how to fix this?","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":400,"Q_Id":69459094,"Users Score":0,"Answer":"This means you have multiple versions of python installed on your device, one has the module and the other tries to run the file, go to the control panel and check it out.","Q_Score":2,"Tags":"python,visual-studio-code,import,pygame","A_Id":69459117,"CreationDate":"2021-10-06T02:12:00.000","Title":"Can`t import pygame to VScode despite having it installed","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have two Python environments in my Anaconda \"base\" and \"image_analytics\".\nEvery time I close and start Anaconda Prompt, I can see \"base\" environment activated by default. I have to write \"conda activate image_analytics\" every time. I want image_analytics environment to get activated every time by default I restart Anaconda Prompt. Any solution? I am a beginner. Any help is appreciated.","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":163,"Q_Id":69460905,"Users Score":2,"Answer":"It actually quite simple, because the anaconda prompt is just a shortcut to cmd with an added call to activate the base env, which can be modified to start other envs\n\nLocate the shortcut for anaconda prompt, either by going to Start Menu->Right Clik Anaconda Prompt->Open File Location or by navigating to the equivalent on your system of C:\\Users\\<Username>\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\Anaconda3 (64-bit)\n\nOpen the properties of the shortcut: Right Click->Properties\n\nModify the Target field. Original for me that activates the base env: %windir%\\System32\\cmd.exe \"\/K\" C:\\Users\\<Username>\\miniconda3\\Scripts\\activate.bat C:\\Users\\<Username>\\miniconda3, which I can modify to e.g. start the py37 env: %windir%\\System32\\cmd.exe \"\/K\" C:\\Users\\<Username>\\miniconda3\\Scripts\\activate.bat C:\\Users\\<Username>\\miniconda3\\envs\\py37. Note that I simply modified the last path in that line to point to an environment instead of base.","Q_Score":2,"Tags":"python,anaconda,jupyter,conda","A_Id":69462262,"CreationDate":"2021-10-06T06:35:00.000","Title":"In Anaconda\/Python how to make my Virtual Environment as default environment when starting Anaconda Prompt?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I opened a series of files to edit them and my run button is greyed out. I can't figure out exactly why, but I think it has something to do with the \"add configuration\" prompt nest to the run button. I don't know how to add a configuration and don't want to mess up my editor. I have the newest version of the community version of PyCharm.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":218,"Q_Id":69475385,"Users Score":0,"Answer":"Add Configuration is greyed out because maybe you haven't added python path to the project try adding it and you should be clear before posting questions maybe some code and pictures will help. Try this and let me know if this have solved your problem.","Q_Score":0,"Tags":"python,pycharm,config","A_Id":69475417,"CreationDate":"2021-10-07T04:16:00.000","Title":"Adding a run configuration in PyCharm for a python project","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm trying to find a library (any language, but preferably C# or Python) which will let me open an XLSX file, iterate through the chart objects, and find data about the chart - ideally including the data backing the chart.\nThe Pandas Python package, or ExcelDataReader NuGet package have useful functionality for opening the file and reading a grid of numbers, as well as ways to add charts, but I don't find any way to read the charts.\nCurious to hear from anyone who has ideas\/solutions.","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":49,"Q_Id":69490094,"Users Score":1,"Answer":"Hey I have a good solution for C#. In C# you can use OLEDB, this allows you to connect a C# code to a excel or access database (so long the database is in the C# code files). You don't need to get any addons for this is you have C# on Visual Studio.","Q_Score":0,"Tags":"python,c#,excel,pandas,charts","A_Id":69490121,"CreationDate":"2021-10-08T03:19:00.000","Title":"Reading chart data from an Excel file","Data Science and Machine Learning":1,"Database and SQL":1,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I use python confluent-kafka 1.5.0 with schema registry for consuming avro message from kafka.\nI am only consumer, without access to admin producer or broker or something else.\nI know topics name and from message fields i  get subject and namespace also in schema registry client, sr client get schema using schema_id from message.\nAccording my goal i need method get schema(only id or subject name) BEFORE i start consuming. That is mean , i want to get schema by topic name manually\nPlease, read attentively, i know how get schema manually after i get schema_id from message.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":152,"Q_Id":69507779,"Users Score":0,"Answer":"The only way to get the schema \"before consuming\" is to not consume and instead interact with the registry directly","Q_Score":0,"Tags":"python,apache-kafka,confluent-schema-registry,confluent-kafka-python","A_Id":69515223,"CreationDate":"2021-10-09T14:46:00.000","Title":"How can I get schema before consuming?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I want to update the selected python interpreter inside vs code from a script.\nI tried:\n\n.vscode\/settings.json in the workspace allows setting python.defaultInterpreterPath but it works only once. Even if select \"default interpreter\" in the UI (e.g. python 3.8), close vs code, change the setting to 3.9, open vscode again, vs code remembers 3.8.\n$config_path\/User\/workspaceStorage\/...\/state.vscdb also contains a key ms-python.python which got data for the selected interpreter autoSelectedWorkspacePythonInterpreter - but that does not even change when changing the interpreter in vscode (from the name of the setting that kind of makes sense)\n\nWhere does vs code even store the information which interpreter is selected by hand?\nAny pointers welcome how to change the used python interpreter (preferable from a script running outsideof vs code, but I would also write a vs code extention if that is easier :))","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":49,"Q_Id":69513772,"Users Score":1,"Answer":"$config_path\/User\/globalStorage\/...\/state.vscdb  --> ms-python.python.","Q_Score":0,"Tags":"python,visual-studio-code,vscode-settings,vscode-extensions","A_Id":69522481,"CreationDate":"2021-10-10T09:02:00.000","Title":"Update selected python interpreter from script","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I've seen mention of sigkill occurring for others but I think my use case is slightly different.\nI'm using the managed airflow service through gcp cloud composer, running airflow 2. I have 3 worker nodes all set to the default instance creation settings.\nThe environment runs dags fairly smoothly for the most part (api calls, moving files from on prem) however it would seem as though its having a terribly hard time executing a couple of slightly larger jobs.\nOne of these jobs uses a samba connector to incrementally backfill missing data and store on gcs. The other is a salesforce api connector.\nThese jobs run locally with absolutely no issue so I'm wondering why I'm encountering these issues. There should be plenty memory to run these tasks as a cluster, although scaling up my cluster for just 2 jobs doesn't seem like it's particularly efficient.\nI have tried both dag and task timeouts. I've tried increasing the connection timeout on the samba client.\nSo could someone please share some insight into how I can get airflow to execute these tasks without killing the session - even if it does take longer.\nHappy to add more detail if required but I don't have the available data in front of me currently to share.","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":167,"Q_Id":69517796,"Users Score":0,"Answer":"Frustratingly, increasing resources meant the jobs could run. I don't know why the resources weren't enough as they really should've been. But optimisation for fully managed solutions isn't overly straight forward other than adding cost.","Q_Score":0,"Tags":"python,airflow,samba,google-cloud-composer","A_Id":69537131,"CreationDate":"2021-10-10T18:15:00.000","Title":"Airflow sigkill tasks on cloud composer","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I followed the polls tutorial for Django and am beginning my own hobby project today. When creating an app, the following really confused me -\nYour apps can live anywhere on your Python path. In this tutorial, we\u2019ll create our poll app in the same directory as your manage.py file so that it can be imported as its own top-level module, rather than a submodule of mysite.\nSo my question is - What is the difference between a top-level module vs a submodule for my project?\nAnd how do I decide which one to choose?\nAny help will be greatly appreciated as I am a noob coder working on my first hobby project lol.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":52,"Q_Id":69530029,"Users Score":2,"Answer":"There's no real other difference than matters of taste, organization, and naming.\nFor what it's worth, with my 10+ years of Django, I still generally like to just have the app packages parallel to the project package (i.e. what that passage suggests).\n(It's occasionally also handy to make the project package an app, for some very core models such as custom users, etc.)\nThere are cases when it does make sense to have packages of interrelated apps, but those are generally for reusable apps such as allauth etc.","Q_Score":1,"Tags":"python,django","A_Id":69530059,"CreationDate":"2021-10-11T17:06:00.000","Title":"What's the difference between a top level module and a sub-module in Django when using - \"python manage.py startapp polls\"","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"What columns do I have to consider while implementing K Means? I have 91 columns after pre processing. And also to how many columns do I have to apply K Means clustering ? Is it all of them or only a few to be considered ?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":29,"Q_Id":69551843,"Users Score":0,"Answer":"It's actually about trial and error. There is no straight way to say which columns are going to help you the most until you try and figure it by yourself.\nbut you can use dimensionality reduction algorithms like PCA to project data to a lower dimension without much data loss. It's a common approach and also helps with the speed of your clustering algorithm.","Q_Score":0,"Tags":"python,pandas,dataframe","A_Id":69552586,"CreationDate":"2021-10-13T08:06:00.000","Title":"K means algorithm implementation","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I just noticed an odd behavior in Dymola 2022, and I wonder if and how can I take care of it from the Python interface.\nOdd behavior, because I expect Dymola to consistently set the working directory at .\\Documents\\Dymola at startup, unless told otherwise.\nHowever, when I instantiate Dymola from its Python interface, at startup the working directory is set according to the setting Tools > Options > Settings > Save startup directory as follows:\n\nDo not save - then when I instantiate Dymola, the current directory is set as the directory where the python environment is open. Possibly interesting here:\n\nthe directory where the python environment is open is not the directory where the function is located.\n\nExample: in VSCode open folder > .\\project, the function is in .\\project\\functions\\dymIO\\instantiateDymola.py, then the Dymola working directory at startup is set at .\\project\n\n\n\n\nSave this directory > .\\Documents\\Dymola - then the current directory is set reliably at .\\Documents\\Dymola\n\n\nOne solution\/fix would be to set the working directory after Dymola is instantiated, I am aware of it.\nMy question is rather to get an understanding of what might be going on with this behavior, and if there is a possibility to take care of it right at startup rather than afterwards","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":34,"Q_Id":69554573,"Users Score":2,"Answer":"I don't know exactly what is happening with Python at the moment, but I can answer what happens inside Dymola:\n\nWhen you start a program from Start-Menu the current directory is as default set to the installation directory of the program (in this case Dymola).\nNot important: When Dymola is started it first ensures that .\\Documents\\Dymola exists.\nNot important: If the environment variable DYMOLAWORKDIRECTORY is not set it is set to .\\Documents\\Dymola\nIf the current directory is the same as the installation directory of Dymola then it sets current directory to .\\Documents\\Dymola - otherwise it keeps the current directory. This allows you to make a short-cut \"Start Dymola Here!\"\nAnd then the settings where you might have changed 'Startup Directory' is processed.\n\nBut I don't know why the Python-interface changes current directory to .\\project, and if you could change current directory in Python.","Q_Score":0,"Tags":"python,dymola","A_Id":69558284,"CreationDate":"2021-10-13T11:19:00.000","Title":"Default startup directory behavior in Dymola 2022","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I opened command prompt (I'm on Windows) and I typed:\n'''none\npip3 install discord\n'''\nThen it said it installed discord, and I was ready to go! (I already had Python 3.9.7 installed)\nThen when I opened VSCode up and typed:   import discord   I got this error message:\n\n\"discord\" is not accessedPylance\nImport \"discord\" could not be resolvedPylancereportMissingImports\n\nWhat does this mean, and how can I fix it? I was really looking forward to coding the bot, but don't know how, now that this is messed up.","AnswerCount":3,"Available Count":3,"Score":0.0,"is_accepted":false,"ViewCount":87,"Q_Id":69558197,"Users Score":0,"Answer":"Open an integrated Terminal in VS Code,\n\nrun python --version, it should be python3.9.7 which is selected as python interpreter and shown in status bar.\n\nrun pip show discord to check if its location is \\..\\python3.9.3\\lib\\site-packages. If not, reinstall it.","Q_Score":0,"Tags":"python,visual-studio-code,discord","A_Id":69566450,"CreationDate":"2021-10-13T15:25:00.000","Title":"I tried to add Python to VSCode, but it won't work","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"I opened command prompt (I'm on Windows) and I typed:\n'''none\npip3 install discord\n'''\nThen it said it installed discord, and I was ready to go! (I already had Python 3.9.7 installed)\nThen when I opened VSCode up and typed:   import discord   I got this error message:\n\n\"discord\" is not accessedPylance\nImport \"discord\" could not be resolvedPylancereportMissingImports\n\nWhat does this mean, and how can I fix it? I was really looking forward to coding the bot, but don't know how, now that this is messed up.","AnswerCount":3,"Available Count":3,"Score":0.0,"is_accepted":false,"ViewCount":87,"Q_Id":69558197,"Users Score":0,"Answer":"check in the bottom left corner of the VS Code window for which version of Python is it using. This issue usually occurs for me when I\u2019m working in a virtual environment but VS Code is pointing to my global Python installation.","Q_Score":0,"Tags":"python,visual-studio-code,discord","A_Id":69558268,"CreationDate":"2021-10-13T15:25:00.000","Title":"I tried to add Python to VSCode, but it won't work","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"I opened command prompt (I'm on Windows) and I typed:\n'''none\npip3 install discord\n'''\nThen it said it installed discord, and I was ready to go! (I already had Python 3.9.7 installed)\nThen when I opened VSCode up and typed:   import discord   I got this error message:\n\n\"discord\" is not accessedPylance\nImport \"discord\" could not be resolvedPylancereportMissingImports\n\nWhat does this mean, and how can I fix it? I was really looking forward to coding the bot, but don't know how, now that this is messed up.","AnswerCount":3,"Available Count":3,"Score":0.0,"is_accepted":false,"ViewCount":87,"Q_Id":69558197,"Users Score":0,"Answer":"You can change the Python Interpreter in VSCODE to solve this issue.\n\n\nOpen settings in VSCODE by pressing Ctrl + Shift + P. Make sure your .py file is open while doing this step.\n\n\nSearch there Python: Select Interpreter and choose the right version.\n\nReload VSCODE and see if it works!","Q_Score":0,"Tags":"python,visual-studio-code,discord","A_Id":69559150,"CreationDate":"2021-10-13T15:25:00.000","Title":"I tried to add Python to VSCode, but it won't work","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"The Tkinter app works good after deployment with Pyinstaller,\nbut it opens 2 windows: .exe and app (tkinter container).\nAny ideas? how to fix it?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":32,"Q_Id":69560083,"Users Score":0,"Answer":"I'm not sure I understand completely but you may want to try saving the file as .pyw vs .py before making it an executable. you may be seeing the console running.","Q_Score":1,"Tags":"python,pyinstaller","A_Id":69561124,"CreationDate":"2021-10-13T17:47:00.000","Title":"Pyinstaller: It works, but .exe window and App Window is separated. Any ideas?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Is it possible to have someone not have python installed, double click on my installer and through that get an executable, the python, and the needed libraries?\nFor that I would probably also want to know, if I can type anything but python path\/file.py to run the python script. Because for that you would need to add the python installation to path. And is there a way to bypass this? To type something else instead of python like manually type the location where the executable is or so?\nMy boss asked me this today. Don\u2019t think that\u2019s a common task to do with python but if I know how to do that with python, I for one can do it with python and I will also easier understand how one normally writes installers and programs with guis and such. I do like python though.\nI guess this is not an easy question. I really am interested though. If you can only answer the second question, I would also be very grateful because then i can figure out the rest I think.","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":60,"Q_Id":69562437,"Users Score":1,"Answer":"You can use pyinstaller to create an executable. pip install pyinstaller in cmd.\nThen cd into the directory where your file is, and type pyinstaller --onefile filename.py","Q_Score":0,"Tags":"python,user-interface,windows-installer","A_Id":69562478,"CreationDate":"2021-10-13T21:17:00.000","Title":"How to make an installer for a python program","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I built a docker container with anaconda and other packages. in the container, I used echo \"export PATH=\"\/root\/anaconda3\/bin:$PATH\"\" and ~\/.bashrc and \/bin\/bash -c \"source ~\/.bashrc\"\", conda command worked fine, and the python version was correct.\nhowever, when committed and pushed the container to the docker hub, and then pulled it elsewhere, it gave me \"bash: conda: command not found\" when i tried to use conda command.\nWould anyone tell me how to solve this problem? Any advice or suggestion will be appreciated.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":106,"Q_Id":69581970,"Users Score":0,"Answer":"Find the result of this problem myself.\nI build and commit this docker in one machine with root permission\uff0cand the Anaconda3 was installed in \/root\/anaconda3\/bin. I then pulled and run this docker in another machine without root permission, in which the installation path can't be accessed. I thus got the \"conda command not found\" error.\nTo solve this problem, it seems that I have to ture to someone with root permission for help. Thank @David Maze anyway.","Q_Score":0,"Tags":"python,docker,anaconda,environment-variables","A_Id":69615665,"CreationDate":"2021-10-15T08:36:00.000","Title":"conda command not found in docker container after commit and push","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm developing a service in Python which has a package as a dependency. I've developed that dependency myself.\nI have a private PyPI server that contains artifacts(a wheel file) of every commit in the master branch(for both packages).\nI'd like to create a CI which will use pip to install the dependency from the private PyPI server(because it's faster and easier than installing from the source code itself every time).\nExample for the project's dependencies:\n\npackages A requires package B\n(which are all in the private repository and not public packages).\n\nMy problem is that if I'm trying to execute a CI on the A repository right after the B repository had a merge to master,\nthe private PyPI server won't have the latest version of B yet(Today there's a Jenkins job that is activated after every merge to master and uploads the B wheel to the private PyPI server,\nbut it takes a few minutes until the package is being built). The result is that package A might contain an old version of B instead of using the latest version of B.\nAny suggestion on how to improve this process?\nInstalling from a private PyPI, in comparison to installing directly from Gitlab decreases the time it takes to install dramatically.\nBTW, today I am using Gitlab's enterprise edition and Jenkins.\nThanks","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":58,"Q_Id":69597603,"Users Score":0,"Answer":"You just need to check if package B is up-to-date before you start the installation of A. So (in your Jenkins job) just put a build step to download everything for B, and after that everything for A.","Q_Score":0,"Tags":"python,build,continuous-integration,multiple-repositories","A_Id":69599713,"CreationDate":"2021-10-16T16:42:00.000","Title":"Building a pipeline for multiple-repository services","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":1},{"Question":"I am building a Streamlit dashboard that will have to read data from a DataFrame. The problem is that I have a local csv and a local Excel file form which I am reading data using pd.read_csv().\nHowever, when I share my dashboard url with others, the data will fail to load because they won't have the file locally.\nHow can I read the contents of a csv and Excel file and turn them into a \"hardcoded\" pandas DataFrame?\nI guess my question is: how should I store and read my data without having local csv and Excel files?\nEdit: sorry for no code or MRE, but I literallyu have no idea how to do this. If I had a piece of code, it would simply be a pandas dataframe with sample data in it.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":99,"Q_Id":69604934,"Users Score":1,"Answer":"In R I would use dput() function to show me the code necessary to create a data frame.\nFor Python I know that print(df.to_dict()) would do something similar to be a \"hardcoded\" Pandas DF.\nSo I would do the following:\n1: print your df. df.to_dict()\n2: copy and paste the necessary code to create the data frame inside your streamlit app. Something similar to this: {'a': {0: 1, 1: 2}, 'b': {0: 3, 1: 3}}\n3: \"load\" the data frames by creating them everytime the application is run. df = pd.DataFrame.from_dict({'a': {0: 1, 1: 2}, 'b': {0: 3, 1: 3}})\nPS: note that this solution is not scalable neither would work if your data keeps changing from time to time. If that's the case, you would need to keep printing and pasting your new df to your code every time.","Q_Score":1,"Tags":"python,pandas,dataframe,csv,streamlit","A_Id":69605030,"CreationDate":"2021-10-17T13:48:00.000","Title":"How to save contents of local csv file into a \"hardcoded\" Pandas DataFrame?","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I just need some advice about what database should I use, and how should I store my data.\nNamely I need to store big chunk of data per user, I was thinking about storing everything in JSON data, but I thought that I could ask you first.\nSo I am using Django, and for now MySql, I need to store like 1000-2000 table rows per user, with columns like First Name, Last Name, Contact info, and also relate it somehow to the user that created that list. Also I need this to be able to efficiently get data from database.\nIs there any way of storing this big data per user?\nThank you!","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":69,"Q_Id":69609348,"Users Score":0,"Answer":"I know pandas is a library that works very well for storing data. So maybe look into that and see what file formats are well documented with it.","Q_Score":0,"Tags":"python,mysql,json,django,database","A_Id":69609521,"CreationDate":"2021-10-17T23:29:00.000","Title":"What is the best way to store big data per user?","Data Science and Machine Learning":0,"Database and SQL":1,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":1},{"Question":"I am working on a regression problem and my dataset is very imbalanced. My features are age, sex, weight, medication dose, some lab results and I am trying to predict one column of continuous values.\nIn my dataset some individuals are represented by more samples than others. For example 30 lines of data from one individual, 10 from a second individual and 1 from a third and so on. I do not know how to select the training set so that the model is not biased towards specific subjects.\nI divided the training and testing set in a way that there is no data from the same individuals in both sets but still training a model with a training set that is not balanced regarding the amount of data from each individual would bias the model.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":87,"Q_Id":69616840,"Users Score":2,"Answer":"I would suggest to duplicate samples. So that, for example, every individual will have 30 rows of data.\nAs an alternative, you can also adjust the weights. So that an individual with 30 samples will have weight 1, an individual with 10 samples will have weight 3, and an individual with 30 samples will have weight 30 [it's an equivalent to duplicating, but doesn't increases the training set]","Q_Score":0,"Tags":"python,machine-learning","A_Id":69617120,"CreationDate":"2021-10-18T13:18:00.000","Title":"How to create a training set for regression in Python if in a dataset some individuals are represented by more samples than others?","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have code using selenium that successfully exports an xls file from my desired website. Once the xls file is downloaded I am unsure how to use selenium to open the file. Once this data gets opened and downloaded I would like it to automatically be flowing into Power BI.\nAny thoughts on how to achieve this?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":30,"Q_Id":69640850,"Users Score":0,"Answer":"You don't need Selenium. It's plain vanilla to directly access a web based Excel file with Power BI. This is what Power BI is made for.\nHowever, if you already have an Excel file locally, I'd suggest you upload it to Onedrive and import it into Power BI from there. And once your report is in the Online service you can directly refresh it via schedule or trigger.\nImporting the Excel file from disk is not the recommended way of doing things unless it's a one-off.","Q_Score":0,"Tags":"python,selenium,web-scraping,xpath,powerbi","A_Id":69641166,"CreationDate":"2021-10-20T05:41:00.000","Title":"Trying to Automate Opening of Excel File and then flowing that data into Power BI (Used Selenium to web scrape exported xls file)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have a python project and I need to use its venv in the terminal offered by PyCharm. However, some dependencies show as not installed but they are present in the venv folder. I think the project is using another venv in the Terminal. How can I check which venv is being used in the terminal and how can I change it to be the one in the project's folder?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":229,"Q_Id":69658774,"Users Score":0,"Answer":"If you execute any program using 'run' button in PyCharm, it will give you the python it is using, in your case, it should be venv. Now from Terminal use that command instead on just python\/python3.\nFor example, your are running a program using run button, you would see something like\n\/Users\/soumyabratakole\/.local\/share\/virtualenvs\/pythonProject-8Ymrt2w6\/bin\/python \/Users\/soumyabratakole\/PycharmProjects\/pythonProject\/main.py\nNow you can use \/Users\/soumyabratakole\/.local\/share\/virtualenvs\/pythonProject-8Ymrt2w6\/bin\/python instead of just python from your terminal to use your venv.","Q_Score":1,"Tags":"python,terminal,pycharm,virtualenv,virtual","A_Id":69658926,"CreationDate":"2021-10-21T08:49:00.000","Title":"How to view which venv is used in pycharm in terminal?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Is there a kepler library i can install in my django project to use kepler.gl in my frontend, like in leaflet-django. If not, how do i use Kepler.gl maps as frontend for django backend?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":99,"Q_Id":69660236,"Users Score":0,"Answer":"You can visit \"kepler.gl\/demo\" and click in the left sidebar export to html. After that you can use this html for your endpoint (view template) in django.\nThe data can be passed trough the httpResponse in your views.py from the database to view into the script. If you like you can put the script code in seperate Javascript files and link them in your endpoint.","Q_Score":0,"Tags":"python,django,web,data-visualization,kepler.gl","A_Id":71861218,"CreationDate":"2021-10-21T10:26:00.000","Title":"How do i use kepler.gl with Django backend","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"My question isn't about a specific code issue, but rather about the best direction to take on a Natural Language Processing challenge.\nI have a collection of several hundreds of Word and PDF files (from which I can then export the raw text) on the one hand, and a list of terms on the other. Terms can consist in one or more words. What I need to do is identify in which file(s) each term is used, applying stemming and lemmatization.\nHow would I best approach this? I know how to extract text, apply tokenization, lemmatization, etc., but I'm not sure how I could search for occurrences of terms in lemmatized form inside a corpus of documents.\nAny hint would be most welcome.\nThanks!","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":29,"Q_Id":69663570,"Users Score":1,"Answer":"I would suggest you create an inverted index of the documents, where you record the locations of each word in a list, with the word form as the index.\nThen you create a secondary index, where you have as key the lemmatised forms, and as values a list of forms that belong to the lemma.\nWhen you do a lookup of a lemmatised word, eg go, you go to the secondary index to retrieve the inflected forms, go, goes, going, went; next you go to the inverted index and get all the locations for each of the inflected forms.\nFor ways of implementing this in an efficient manner, look at Witten\/Moffat\/Bell, Managing Gigabytes, which is a fantastic book on this topic.\nUPDATE: for multi-word units, you can work those out in the index. Looking for \"software developer\", look up \"software\" and \"developer\", and then merge the locations: everytime their location differs by 1, they are adjacent and you have found it. Discard all the ones where they are further apart.","Q_Score":0,"Tags":"python,nlp,lemmatization","A_Id":69664306,"CreationDate":"2021-10-21T14:12:00.000","Title":"Direction needed: finding terms in a corpus","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Im trying to convert a pil image to a numpy array but i want the image to keep it's transperancy, how can i do that?\nIv'e tried using numpy.array()\nBut it doesnt keep the transperancy","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":87,"Q_Id":69687221,"Users Score":0,"Answer":"I'm not quite sure what you mean by it doesn't keep its transparency. If you convert a PIL image with transparency using numpy.array() it should return a numpy array with shape width, height, 4 where the 4th channel will represent the alpha channel values. And after whatever processing you need to do, if you convert it back to a PIL image using Image.fromarray() and perhaps saving with Image.save() you should get back an image with the same transparency. Can't help you much more without seeing an actual snippet of the code and possibly the image.","Q_Score":0,"Tags":"python-3.x,image-processing","A_Id":69687931,"CreationDate":"2021-10-23T10:26:00.000","Title":"How can i convert a PIL image to cv2 numpy array","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am using python request module to hit rest api. I have to use SSL for security measures.\nI see that i can set\nrequests.get(url,verify=\/path\/ca\/bundle\/) \nHowever i am confused as to what needs to be passed as CA_BUNDLE?\nI get the server certificate using\ncert = ssl.get_server_certificate((server,port))\nCan someone let me know, how i should use this certificate in my request? Should i convert the cert to X509\/.pem\/.der\/.crt file ?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":124,"Q_Id":69702941,"Users Score":0,"Answer":"Solved it. Apparently i needed to get the entire certificate chain and create a CA bundle out of it.","Q_Score":0,"Tags":"python,ssl,python-requests,pyopenssl","A_Id":69791202,"CreationDate":"2021-10-25T04:40:00.000","Title":"Python Request: SSL Verify","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am concepting an HID usb device which should be able to autoexecute a little Python\/C++\/(...) login program when connected to a computer, to allow the user to enter a password to access the content of the memory stick.\nAny idea how to start with or what should I consider for this program?\nImportant:\n\nOS will be Windows (probably 8+) and Linux (probably CentOS)\nComputers will not have any program installed to interact with this usb device.\nIt is all about just and only the usb device.\nThanks in advance","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":88,"Q_Id":69710154,"Users Score":0,"Answer":"User inserts USB device to PC\nPC recognizes the USB device as a memory disk\n\nThe memory disk is empty (because password not entered) except\nOnly a file named enter-password.txt\n\n\nUser opens enter-password.txt and enters the password and saves\nReal contents in the memory disk appear on the fly\n\nIt's compatible to all OS and no program is required in advance in PC.","Q_Score":0,"Tags":"python,c++,usb,hid","A_Id":70013644,"CreationDate":"2021-10-25T14:47:00.000","Title":"Autoexecutable program on HID memory stick","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I want to upload some files to sharepoint via office365 REST Python client.\nOn documentation on github, I found two examples:\n\none for larger files where this is executed:\n\n uploaded_file = target_folder.files.create_upload_session(local_path, size_chunk, print_upload_progress).execute_query()\n\none for small files :\ntarget_file = target_folder.upload_file(name, file_content).execute_query() .\n\nIn my case, I want to be able to upload files who are small and also files who are very large.\nFor testing, I wanted to see if the method for larger files works with smaller files too.\nWith a small file, while putting the size_chunk at 1Mb, the uploading was done, but the file uploaded was empty (0b), so I lost my content while uploading.\nI wanted to know if there is someone who knows how can we do something more generic for whatever size of files. Also I don't understand what is the size chunk for larger files case. Do you know how one should choose it?\nThank you so much!","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":225,"Q_Id":69720779,"Users Score":0,"Answer":"This problem is solved by installing office365-rest-python-client instead of office365-rest-client.","Q_Score":0,"Tags":"python,rest,office365api,sharepoint-rest-api,office365-rest-client","A_Id":69992999,"CreationDate":"2021-10-26T09:41:00.000","Title":"Uploading files of different sizes on sharepoint office365 REST Python Client","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"When one app is installed on Android, it will ask access for several kind pf permissions. I have thousands of apps install package and I try to find out what permissions each app requests. I want to finish this job on Windows. Do we have any tool or how to use some programming language like Python to do this?\nThanks a lot in advance!","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":54,"Q_Id":69721538,"Users Score":1,"Answer":"Apk file is simple zip archive.\nYou can extract data from the archive and read AndroidManifest.xml entries.\nCheck lines like the <uses-permission android:name=\"...\"\/>","Q_Score":0,"Tags":"python,android,automation,android-permissions,privacy","A_Id":69722651,"CreationDate":"2021-10-26T10:35:00.000","Title":"How to check Android App Permission in Windows","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am currently using Visual Studio Code as my IDE, and I have been trying to figure out how to make it in my scripts where if a certian key -such as \"l\" for our example- was pressed, the script would trigger a block of code that executed a function - such as the print(\"Ayy you pressed a key! good job!\") function. I was wondering if anyone could tell me how to do that, or how to make the import keyboard work.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":68,"Q_Id":69757549,"Users Score":0,"Answer":"As answered in other questions, responding to a key press involves dealing with events.\nEach key press triggers\/ emits an event. There are couple of library that deals with events and in particular keyboard events.\nmodules keyboard and getKey are worth exploring. and to a straightforward answer, refer above answer.(just dont want to repeat, credit to him)","Q_Score":0,"Tags":"python","A_Id":69757723,"CreationDate":"2021-10-28T16:12:00.000","Title":"How do I make a function execute when a certain key is pressed?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am proficient in Bash and a beginner in Python (I have some experience with Flask and Requests).\nI wrote a Bash script which asks for some input (four strings) and creates a configuration file based on that input. That's good for me, but I would like to convert it to a (no frills) web interface.  I know how to configure Apache, if necessary.\nI know there are zillions of ways to do that.  I'd like some hints on how to tackle my problem, ideally using Bash or Python.  By the way, I've used Octave on CGI for some of this in the past, and I think it's excellent for math purposes, but I'd like to get ideas about some simpler, more generic avenues.","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":81,"Q_Id":69761417,"Users Score":1,"Answer":"I would create a Django site for this. It can be setup really quickly. I would recommend you host it on PythonAnywhere. They have a free tier, and works really well. Django is similar to Flask, but I personally like Django. If you could be more specific on what your App needs to do, some sample code could be provided.","Q_Score":0,"Tags":"python,html,bash,apache,cgi","A_Id":69761598,"CreationDate":"2021-10-28T21:57:00.000","Title":"Create a web page which asks for some input and writes it to a file","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I want to use the \"newenv\" approach, but now I need to make changes to psynet (for example adding a log line or rpdb.set_trace()), where is this local copy? And can I simply change it or I need to reinstall the environment with reenv?","AnswerCount":3,"Available Count":1,"Score":0.0665680765,"is_accepted":false,"ViewCount":40,"Q_Id":69766728,"Users Score":1,"Answer":"The simplest way to do this is certainly to edit the file in the venv, but as has been pointed out it's easy to lose track of that change and overwrite it. I do that anyway if it's a short term test.\nHowever, my preferred approach when I want to modify a library like this is to clone its source code from Git, do the modifications in my cloned sandbox, and do a pip install -e . inside the module after having activated the venv. That will make this venv replace the previously installed version of the library with my sandbox version of it.","Q_Score":1,"Tags":"python","A_Id":69769786,"CreationDate":"2021-10-29T09:40:00.000","Title":"In psynet, if I use the \"newenv\" approach, how can I change the psynet code?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"df1 =\n\n\n\n\n\nname\nage\nbranch\nsubject\ndate of joining\n\n\n\n\n1\nSteve\n27\nMechanical\nAutocad\n01-08-2021\n\n\n2\nAdam\n32\nElectrical\ncontrol sys\n14-08-2021\n\n\n3\nRaj\n24\nElectrical\ncircuit\n20-08-2021\n\n\n4\nTim\n25\nComputers\nclouding\n21-08-2021\n\n\n\n\ndf2= [['name','branch']]\nprint(df2)\n\n\n\n\n\nname\nbranch\n\n\n\n\n1\nSteve\nMechanical\n\n\n2\nAdam\nElectrical\n\n\n3\nRaj\nElectrical\n\n\n4\nTim\nComputers\n\n\n\n\nNow I have two data frames,\nI need only name and branch columns and remove the remaining columns, all these operations should apply to the original df1.  I don't want separately df2","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":41,"Q_Id":69771915,"Users Score":1,"Answer":"Simply, Overwrite the df1 only\ndf1= df1[['name','branch']]\nor\ndf2= df1[['name','branch']]\ndel df1\nTo delete df1 or df2.\ndel df1\nor\ndel df2\nBased on requirement","Q_Score":1,"Tags":"python,python-3.x,pandas,dataframe,overwrite","A_Id":69772340,"CreationDate":"2021-10-29T16:08:00.000","Title":"how can I get only one data frame or how to overwrite the data frame?","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am trying to take a piece of user input: 5+5 or 5*5 but my code receives it as a string. I want to convert it to an expression from which an answer can be deduced. However, I am not sure how to do this.","AnswerCount":2,"Available Count":1,"Score":-0.0996679946,"is_accepted":false,"ViewCount":46,"Q_Id":69780659,"Users Score":-1,"Answer":"Simply use \"eval\", but unsafe.","Q_Score":1,"Tags":"python","A_Id":69780701,"CreationDate":"2021-10-30T17:42:00.000","Title":"Is there a way for python to take in a string with math operators and convert it to an expression?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I was wondering if there is any way to make decisions based on webhook responses in Mautic. To elaborate, I post a request via webhook and the corresponding API responds with an error (e.g. 411). I want to create a campaign that has a block depending on the response of that webhook if it receives 200 decision 1 is made and if it receives 411, another decision is made.\nhow can I implement this?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":40,"Q_Id":69787645,"Users Score":0,"Answer":"I don't think such feature exists by default, but there can be alternative ways to do this.\n\nsending an api call from the system in question(like on success make a call do set some tag or field) same goes for error. However this is practical as long as you have control over that system.\nCreate a custom campaign Decision node which will listen to the responses of the webhook(in this case you will need to send the webhook using campaign only), Again the block here is that you will need to know how to code a custom campaign decision or will need to look for a developer who can do it.","Q_Score":0,"Tags":"python,mautic","A_Id":70380681,"CreationDate":"2021-10-31T14:42:00.000","Title":"make a decision based on response of webhook in mautic","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"I have an open net tab on my app and now I want to work by selenium to do several works.How can I define its driver?I know how to define a driver and open a webpage but I don't know this one. Can you help me?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":21,"Q_Id":69793608,"Users Score":0,"Answer":"finally,\nyou can take its html code by\n\ndriver.page_source","Q_Score":0,"Tags":"python,android,html,selenium,driver","A_Id":69952442,"CreationDate":"2021-11-01T07:08:00.000","Title":"how define driver in python for an open net page","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Basically user has to input their name like jOhn JhOnson\nand i have to return it as John Jhonson\nbut if the user has 3 names like jonny jon jony\nI have to return it like Jonny-Jon Jony\nand i have no idea how","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":69,"Q_Id":69802521,"Users Score":0,"Answer":"I would use a string tokenizer to count the number of names you have. Then you can easily manipulate each token and then append them altogether for your return value. I can't really help you beyond that without knowing what language you are using.","Q_Score":0,"Tags":"python,string,input","A_Id":69802566,"CreationDate":"2021-11-01T20:35:00.000","Title":"Can't figure out how to return input","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am fairly new to the Python Flask world (or web applications in general), just started my first project on Friday using Jupyter Notebooks and am now trying to build a Flask web app from it - so please bear with me :)\nMy app creates pareto-efficient Portfolios based on the user-input.\nOn the index page I have a couple of input fields for user-input which I collect through a form. On calculate the app routes to the results page and in the process runs the data from the form through some calculations, then displays some tables with infos and plotly graphs.\nNow I would like the user to be able to further manipulate the data but the data isn't accessible \/ persistently saved. - I've read something about using global variables or the session dict which are not recommended.\nSo I am asking myself two things:\n\nWhat is the easiest way to implement the persistently save my objects & lists to manipulate the data between different routes\nIn case of having to use a database: What is the smartest logic to work with in that scenario to be able to receive the correct data in case of using a database (e. g. 50 people use the web app simultaneously - how do I make sure that user X retrieves his earlier data instead of the data from user y -- the web app does not require a login and I also don't plan on implementing one as I wanted this to be as quick and simple as possible)\n\nYour help is much appreciated - I've probably written 5000 lines of code this weekend and maybe I just can't see the forest for the trees right now","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":59,"Q_Id":69804143,"Users Score":1,"Answer":"You'll have to use a database, unless you want to store the data in-memory. However, in-memory data (python globals, for example) will be lost when the server performs a reboot - or crashes. This will be especially annoying during development, because all the data will be reset whenever you make a change in the code.\nYou could use an in-memory database like redis. This works very similar to using globals directly in the code, but it is a database and can be configured to save the data to the disk and survive crashes, etc...\nConsidering the sharing of data between users: I dont see a good way around having the users chose a login and associating the data with the user which is currently logged in. If its really just a for-fun project, you could use the User Agent and their IP address to identify users, but I dont recommend this - like, at all. This would be similar to browser-fingerprinting, which gives you a high chance of identifying users, but you can never be 100% sure.\nWhat you could do for example is give the user a JWT, and just hand them out with a generated username. The user will be \"that user\" for as long as that JWT is valid. This means you need to save it on the client-side and send it with every request, which makes it slightly more complex.","Q_Score":0,"Tags":"python,database,flask","A_Id":69807707,"CreationDate":"2021-11-02T00:24:00.000","Title":"Simple way to store objects, variables and lists to use between routes","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":1},{"Question":"im trying to retrieve the date and time of a message, and the date is correct, but the time is about 6 hours off. how can i fix this?\nit is 5pm currently, but this line of code returns 23:00\n\nmsgDate = update.message.date\n\nedit: it is returning the minutes properly, so its close, just not sure on what to do about the hours.","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":176,"Q_Id":69818062,"Users Score":1,"Answer":"It seems as though function built into python-telegram-bot uses the UTC timezone, so yes, it does return the proper date and time, just converted into UTC","Q_Score":0,"Tags":"python,telegram,python-telegram-bot","A_Id":69820400,"CreationDate":"2021-11-02T23:32:00.000","Title":"Python-telegram-bot api 'update.message.date' is returning the wrong time. how do i fix this?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"While looking for how to allow list append() method to return the new list, I stumbled upon this solution:\nlist.append(val) or list\nIt's really nice and works for my use case, but I want to know how it does that.","AnswerCount":3,"Available Count":2,"Score":0.2605204458,"is_accepted":false,"ViewCount":71,"Q_Id":69830754,"Users Score":4,"Answer":"list.append(val) returns None, which is Falsy, and so triggers or and returns the list. Nonetheless I consider this not pythonic, just make two separate lines without or","Q_Score":1,"Tags":"python,python-3.x,list,append","A_Id":69830778,"CreationDate":"2021-11-03T19:32:00.000","Title":"how does \"list.append(val) or list\" work?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"While looking for how to allow list append() method to return the new list, I stumbled upon this solution:\nlist.append(val) or list\nIt's really nice and works for my use case, but I want to know how it does that.","AnswerCount":3,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":71,"Q_Id":69830754,"Users Score":0,"Answer":"list.append(val) returns None, which is a falsey value, so the value of the entire expression is list. If list.append returned a truthy value, that would be the value of the or expression.","Q_Score":1,"Tags":"python,python-3.x,list,append","A_Id":69830781,"CreationDate":"2021-11-03T19:32:00.000","Title":"how does \"list.append(val) or list\" work?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have a dataframe where the indexes are not numbers but strings (specifically, name of countries) and they are all unique. Given the name of a country, how do I find its row number (the 'number' value of the index)?\nI tried df[df.index == 'country_name'].index but this doesn't work.","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":489,"Q_Id":69848807,"Users Score":0,"Answer":"Why you don make the index to be created with numbers instead of text? Because your df can be sorted in many ways beyond the alphabetical, and you can lose the rows count.\nWith numbered index this wouldn't be a problem.","Q_Score":8,"Tags":"python,pandas,indexing","A_Id":69848896,"CreationDate":"2021-11-05T04:52:00.000","Title":"How do I find the row # of a string index?","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am new to VScode and want to run Python in it for my college project. I have seen that in VScode all the programmes are executed in Windows PowerShell Terminal(By default). But the problem is that it also shows the file address which is being executed which I don't want. So, please could you give a suggestion which software should be used in the terminal which only executes code and doesn't show any file address. And How can I change it?","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":273,"Q_Id":69849163,"Users Score":0,"Answer":"ctrl+shift+ is a Command Used to open terminal in VS code .. You can also Try Extension of python shell or powershell in VSCode ...","Q_Score":0,"Tags":"python,powershell,visual-studio-code,vscode-settings","A_Id":69849187,"CreationDate":"2021-11-05T05:59:00.000","Title":"How can I change a PowerShell terminal to a simple one in VScode for Python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have a Python program for customers to query price. Each time a customer can input some necessary information, the program will calculate and return the price to customer. Note: during the calculation process, the program also need to query a third party map service web API to get some information (such as google map API or other similar service).\nI have a website developed using web development tools such Wix, Strikingly. It offers a capability to customize a web page by simply input a block of HTML codes. So, I want to study the possibility of using Django to convent my python program into HTML (incl. add some user interface such as text box and button), which can then be pasted into the website to form a unique webpage.\nI am not sure if it is doable? Especially, the part of connecting third party map service API. Would Django be able to convert this part automatically to HTML as well? (how does it deal with API key and connection).","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":63,"Q_Id":69907582,"Users Score":1,"Answer":"Python itself runs only on the console, and is meant to be the backend in site development, whereas HTML is meant only to be the frontend, so no calculation or data fetching. Wix is a frontend tool with some content management that offers customization but still in the frontends (html\/css), and there's nothing more you could do with the content management other than using the built in table like feature. Trying to use the html generated by wix will be so much pain due to its css name optimization and making it quite unscalable.\n \nIf you don't wish to learn frontend building at all then you could look up other html generator tool for the frontend codes. From there, django itself is capable of building the entire website, using the html you generated as template, and passing the data you've computed into the templates. That's what Django is meant to do. In this case you would need to learn Django itself, which I would recommend if you intend to showcase your project as an interactive program rather just console logs.\nOther alternatives include converting your python codes into javascript, which is capable of doing calculations and fetching from APIs, and you can include the javascript code directly in HTML with the  tag.","Q_Score":0,"Tags":"python,html,django,google-maps-api-3,web-deployment","A_Id":69910598,"CreationDate":"2021-11-10T03:16:00.000","Title":"Conver Python to html using Django","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"The error the application throws is:\nERROR:saml2.sigver:check_sig: \nERROR:saml2.response:correctly_signed_response: Failed to verify signature\nERROR:saml2.entity:Signature Error: Failed to verify signature\nERROR:saml2.client_base:XML parse error: Failed to verify signature\nAnd it seems to be a Windows problem. Does anyone know how should I implement this? The command used to verify the XML is:\nC:\\Windows\\xmlsec1.exe --verify --enabled-reference-uris empty,same-doc --enabled-key-data raw-x509-cert --pubkey-cert-pem C:\\Users\\me\\AppData\\Local\\Temp\\tmp8wssc6_f.pem --id-attr:ID urn:oasis:names:tc:SAML:2.0:assertion:Assertion --node-id _579304c7-f1c4-5918-83ee-4b33c5df1e00 --output C:\\Users\\me\\AppData\\Local\\Temp\\tmpw9lbnowc.xml C:\\Users\\me\\AppData\\Local\\Temp\\tmpcg9l7jik.xml\nAnd it returns b\"\".\nThanks in advance.","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":330,"Q_Id":69916491,"Users Score":0,"Answer":"For those who may face this problem in the future: Windows OS (still don't know certainly if the problem is caused due an OS particularity, I couldn't test it in other environments), pysaml2, and django-saml2-auth don't handle self signed certificates very well. I could solve the problem by just forking pysaml2\/django-saml2-auth and passing downloaded cert-files from IdP (.pem) manually.","Q_Score":0,"Tags":"python,django,azure-active-directory,saml-2.0","A_Id":69991218,"CreationDate":"2021-11-10T16:03:00.000","Title":"Problems while implementing SSO using Django SAML2 Auth and AzureAD","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"The error the application throws is:\nERROR:saml2.sigver:check_sig: \nERROR:saml2.response:correctly_signed_response: Failed to verify signature\nERROR:saml2.entity:Signature Error: Failed to verify signature\nERROR:saml2.client_base:XML parse error: Failed to verify signature\nAnd it seems to be a Windows problem. Does anyone know how should I implement this? The command used to verify the XML is:\nC:\\Windows\\xmlsec1.exe --verify --enabled-reference-uris empty,same-doc --enabled-key-data raw-x509-cert --pubkey-cert-pem C:\\Users\\me\\AppData\\Local\\Temp\\tmp8wssc6_f.pem --id-attr:ID urn:oasis:names:tc:SAML:2.0:assertion:Assertion --node-id _579304c7-f1c4-5918-83ee-4b33c5df1e00 --output C:\\Users\\me\\AppData\\Local\\Temp\\tmpw9lbnowc.xml C:\\Users\\me\\AppData\\Local\\Temp\\tmpcg9l7jik.xml\nAnd it returns b\"\".\nThanks in advance.","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":330,"Q_Id":69916491,"Users Score":0,"Answer":"Your question is a little vague.  It seems that you have sent an authenrequest and got a response and the application on your end is throwing the signature validation error.  If that is correct then you likely do not have the correct cacert from the identity provider defined in your application.\nQuestions about SAML and verifying XML signatures really need the original xml idealy in base64 so it is possible to try to check the signature.","Q_Score":0,"Tags":"python,django,azure-active-directory,saml-2.0","A_Id":69929629,"CreationDate":"2021-11-10T16:03:00.000","Title":"Problems while implementing SSO using Django SAML2 Auth and AzureAD","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"I have a time series in which i am trying to detect anomalies. The thing is that with those anomalies i want to have a range for which the data points should lie to avoid being the anomaly point. I am using the ML .Net algorithm to detect anomalies and I have done that part but how to get range?\nIf by some way I can get the range for the points in time series I can plot them and show that the points outside this range are anomalies.\nI have tried to calculate the range using prediction interval calculation but that doesn't work for all the data points in the time series.\nLike, assume I have 100 points, I take 100\/4, i.e 25 as the sliding window to calculate the prediction interval for the next point, i.e 26th point but the problem then arises is that how to calculate the prediction interval for the first 25 points?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":42,"Q_Id":69926526,"Users Score":0,"Answer":"A method operating on a fixed-length sliding window generally needs that entire window to be filled, in order to make an output. In that case you must pad the input sequence in the beginning if you want to get predictions (and thus anomaly scores) for the first datapoints. It can be hard to make that padded data realistic, however, which can lead to poor predictions.\nA nifty technique is to compute anomaly scores with two different models, one  going in the forward direction, the other in the reverse direction, to get scores everywhere. However now you must decide how to handle the ares where you have two sets of predictions - to use min\/max\/average anomaly score.\nThere are some models that can operate well on variable-length inputs, like sequence to sequence models made with Recurrent Neural Networks.","Q_Score":0,"Tags":"python,c#,anomaly-detection,lower-bound,upperbound","A_Id":69940939,"CreationDate":"2021-11-11T10:13:00.000","Title":"Interval Prediction for a Time Series | Anomaly in Time Series","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have to parse and validate HIPAA 834 EDI file and generate 997 response with the success or error message\nSample 834 EDI File:\nISA00 00 30261401960      30261105741 2105250609*^005011891712750T*:~\nGSBE161401960Facets202105250609171275X005010X220A1~\nST8340001*005010X220A1~\nREF3800417558~\nQTYDT958~\nQTY**1381~\nQTY**1381~\nN1INHealthPLAN FI161105741~\nINSY18030XNA**ACNN~\nF0F951747732~\nREF1L00417558~\nREF170001~\nREFDX0001~\nDTP336D8*20040202~\nPERIP**EMmvastola@wscschools.orgHP7169543565~\nN3*130 Rosewood Dr.~\nN4West SenecaNY*14224~\nDMGD819810817MM~\nHD024**HLTCPO1Y000*FAM~\nINSY18030XNA**ACNN~\nDTP303D8*20200701~\nINSN01030XNA**NN~\nREF0F951747732~\nREF1L00417558~\nREF170001~\nREFDX0001~\nNM1IL1TestmemberJessica***34962703984~\nN3*130 Rosewood Dr.~\nN4West SenecaNY*14224~\nDMGD819820720*F~\nHD024**HLTCPO1Y000*FAM~\nDTP303D8*20200701~\nDTP348D8*20200701~\nINSN19030XNA**FN~\nREF0F951747732~\nREF1L00417558~\nREF170001~ REFDX0001~\nNM1IL1testySofia***34992599285~\nN3*130 Rosewood Dr.~\nN4West SenecaNY*14224~\nDMGD820120524*F~\nHD030**HLTCPO1Y000*FAM~\nDTP303D8*20200701~\nDTP348D8*20200701~\nSE470001~\nGE1171275~\nIEA1189171275~\nplease help me out to resolve the issue, I'm not understanding how to use pyx12 parser library which is available in python or implement the code using pyx12","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":225,"Q_Id":69927141,"Users Score":0,"Answer":"It looks like you've lost a bit of your formatting.\nThe ~ is the segment terminator.  The * character is the element separator.  So you should first split by the segment end, read each segment in, and then parse each element.\nThere is the concept of qualifiers, backed by a dictionary.  The N1 segment typically holds names, with N3 and N4 being address segments.  The first element in the N1 segment (N101) is a qualifier. It describes the data in the N102 using a code value.  The 834 has many of these.\nREF170001~\nREFDX0001~\nIn this case 17 and DX describe what value is in the REF02.\nYou should download a tool like EDI Notepad so that you can understand what each element is, what it means and how to parse it into something your application can understand.","Q_Score":0,"Tags":"python,edi,x12","A_Id":69928443,"CreationDate":"2021-11-11T10:58:00.000","Title":"How to parse HIPAA 834 EDI File and generate 997 using python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"Is there a way to get the number of rows affected as a result of executing     session.bulk_insert_mappings() and session.bulk_update_mappings()?\nI have seen that you can use ResultProxy.rowcount to get this number with connection.execute(), but how does it work with these bulk operations?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":66,"Q_Id":69973956,"Users Score":0,"Answer":"Unfortunately bulk_insert_mappings and bulk_update_mappings do not return the number of rows created\/updated.\nIf your update is the same for all the objects (for example increasing some int field by 1) you could use this:\nupdatedCount = session.query(People).filter(People.name == \"Nadav\").upadte({People.age: People.age + 1)","Q_Score":0,"Tags":"python,sqlalchemy","A_Id":71420714,"CreationDate":"2021-11-15T11:50:00.000","Title":"Get Row Count in SQLAlchemy Bulk Operations","Data Science and Machine Learning":0,"Database and SQL":1,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"as you can read in the title I have to build a reliable P2P data transfer Using UDP(I'm a student), so what I asking you guys is to not give me the code, actually, I hate copying and pasting so much, I feel pain in doing it, I'm asking for help to tell me what tool do I need, I'm familiar with Javascript and Java and Python, feel free to help me if you know any of these languages.\nthe reliability part will be achieved through checksum and ACKs(Acknowledgements), so I have to Implement them:\n-I know how checksum can be calculated.\n-ACKs can be Implemented in the way of Stop-and-wait protocol(I think it's the simplest one), if you know another protocol, that is okay.\nI'm really lost, I don't know from where I begin if you have some code examples, please share a link that would be helpful, so I can build an idea from where do I start.\nthanks.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":90,"Q_Id":69979530,"Users Score":0,"Answer":"Here are some reliable UDP examples in github like kcp, quic, utp. You can read them and get the essential from them.\nAs for how to do it, there are some little suggestions:\n\nYou need ACK to check if any packet\/datagram lost, and then retransmit it\nYou need to use FEC\nCongestion algorithm can be considered later.\n\nWhen you try to build your own code, do a little goal in every step, don't build a complex protocol at the very begining.","Q_Score":0,"Tags":"javascript,python,java,udp,p2p","A_Id":69985643,"CreationDate":"2021-11-15T19:00:00.000","Title":"how can I build reliable P2P data transfer using UDP protocol","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have created an .exe file by pyinstaller. And I want it to run on background even if I close it and I want to be able to access it taskbar's arrow at the bottom-right corner. For example; when I close Discord, it disappears but I can access it from the taskbar's arrow at the bottom-right corner. I want to exact same thing to happen with my app, how can I do it?","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":191,"Q_Id":69981444,"Users Score":2,"Answer":"try this\npyinstaller -w --onefile \"yourfile\"\nyou should be good","Q_Score":0,"Tags":"python,windows,exe","A_Id":71540289,"CreationDate":"2021-11-15T22:03:00.000","Title":"How to keep my app running on background?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have an idea to make a twitter bot that block annoying accounts:\nmy question is can I block accounts on behalf of other user?\nI am using  tweepy\nI already have tokens for my account","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":50,"Q_Id":69987869,"Users Score":1,"Answer":"Yes, if you have access tokens for the other user. You can get these by using the sign-in with Twitter API, and have the other user go through that process to authorize your app.","Q_Score":0,"Tags":"python,twitter,bots,tweepy","A_Id":69991606,"CreationDate":"2021-11-16T10:56:00.000","Title":"how to block twitter accounts on behalf of others with tweepy?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Suppose you have a pandas.DataFrame like so:\n\n\n\n\nInstitution\nFeat1\nFeat2\nFeat3\n...\n\n\n\n\nID1\n14.5\n0\n0.32\n...\n\n\nID2\n322.12\n1\n0.94\n...\n\n\nID3\n27.08\n0\n1.47\n...\n\n\n\n\nMy question is simple: how would one select rows from this dataframe based on the maximum combined values from two or more columns. For example:\n\nI want to select rows where the columns Feat1and Feat3 have their maximum value together, returning:\n\n\n\n\n\nInstitution\nFeat1\nFeat2\nFeat3\n...\n\n\n\n\nID2\n322.12\n1\n0.94\n...\n\n\n\n\nI am certain a good old for loop can take care of the problem given a little time, but I believe there must be a Pandas function for that, hope someone point me in the right direction.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":54,"Q_Id":70027445,"Users Score":0,"Answer":"You can play arround with:\ndf.sum(axis=1)\ndf['row_sum'] = df.sum(axis=1)\nor\ndf['sum'] = df['col1' ] + df['col3']\nAnd then:\ndf.sort(['sum' ],ascending=[False or True])\ndf.sort_index()","Q_Score":1,"Tags":"python,pandas","A_Id":70027532,"CreationDate":"2021-11-18T22:16:00.000","Title":"Select Pandas dataframe row where two or more columns have their maximum value together","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I need to increase the file size of a pdf without adding any new texts or images.  I can reduce the file size by compressing it. When I increase the file dimensions from A4 to A3, A2 etc using available online tools, it automatically gets compressed. What I want is to increase its size from 80 kB to 100 kB. Any idea how can it be done in Python or using any tool?","AnswerCount":2,"Available Count":1,"Score":-0.0996679946,"is_accepted":false,"ViewCount":165,"Q_Id":70031013,"Users Score":-1,"Answer":"If you have Photoshop, Open the PDF in it and do \"save as\" and you will see a quality option then just increase it to the max...\nIf it doesn't work with PDFs then take a screenshot of the PDF and do the above suggestion again, it'll work","Q_Score":1,"Tags":"python,pdf,pdf-generation,size,filesize","A_Id":70035593,"CreationDate":"2021-11-19T07:06:00.000","Title":"Is there a way to increase the size (from 80 kB to 100 kB) of a pdf file without adding any new texts or images?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am trying to open discord and join a voice channel with a voice command. All I find is about bots, while I'm trying to do it with the user, me, in this case. Opening discord is not a problem, but I have no idea of how to do the voice channel thing, I'm still a begginer.","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":56,"Q_Id":70043346,"Users Score":1,"Answer":"First of all, discord does not allow you execute client side commands directly or more specifically, pull users to voice channels. Making an user force-join a voice channel via a command would be a serious security exploit.\nWhat you can do to make users join channels, is to let them join a waiting room of some sort, than pulling them to channels from there.\nNow as far as i understand, you want to join a specific channel via a voice command yourself. In that case i would suggest not using discord API. I would implement a web scraper (in this case something like a web scraper would suffice since discord is basically running its website as an app, Press Ctrl+Shift+I and you will understand what i mean) to target a text containing the voice channel name i want to join. I would get that name from voice recognition. Then get that text position on screen and click it. You could use pyautogui for that purpose.\nTo be fair, this is not a beginner project at all, however with sufficient research and work you can make it.\nCheers","Q_Score":0,"Tags":"python,discord","A_Id":70046782,"CreationDate":"2021-11-20T04:57:00.000","Title":"Open Discord and make user join a specific voice channel","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I know when you import everything you can do thinks like nltk.bigrams(nltk.corpus.brown.words() for bigrams and nltk.trigrams(nltk.corpus.brown.words() for triagrams, but how do you do four grams?\nI've seen other ways to do it, but they all do it with a \"string\" or a text they make up. How do you do it with the nltk.corpus.brown? Do you have to covert it to a string and if so, how?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":51,"Q_Id":70049103,"Users Score":0,"Answer":"To get n number of items you can use nltk.ngrams() with the number to get as the second argument.\nIn your example, to get four-grams, you can use nltk.ngrams(nltk.corpus.brown.words(), 4)","Q_Score":0,"Tags":"python,nltk","A_Id":70049256,"CreationDate":"2021-11-20T19:15:00.000","Title":"Finding Four Grams in an NLTK Corpus","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I had made this form in Django which takes some data and when a save button is clicked it saves it to the database. It stores the data that I give, but I noticed that every time I refreshed the page that contained the form it would automatically save an object with the Id as none and all values set to null. I wanted to know how to write a function that says the form only submits to the database when the save submit button is clicked and not when reloading the page and making a dummy object in the database.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":42,"Q_Id":70051821,"Users Score":0,"Answer":"I think the problem here is in the view, more specifically, how you're handling the request inside the view.\nit seems that you're saving the object no matter what's the request method, that's why even refreshing the page will save a new object.","Q_Score":0,"Tags":"python,django,forms,web,error-handling","A_Id":70051878,"CreationDate":"2021-11-21T04:25:00.000","Title":"How to solve the error when dummy data gets stored in Django database with its id as none and all values as null","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"I am gonna have an open source app in which it needs to send some data to an fastapi python api, how can i make it so that only the app can make requests to the api and not some random person abusing the api endpoint?","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":106,"Q_Id":70061034,"Users Score":1,"Answer":"There are so many ways to do that. Even some of the techniques doesn't bother the API endpoint.\n\nIP Restriction: You can restrict an IP from cloud provider which IP can call the API. Even you can have multiple IPs.\nAPI KEY: You can provide an API KEY to the API client. When the request come along with the provided key then you work on it otherwise ignore.\n\nThe IP method is much better than doing on the application end.","Q_Score":0,"Tags":"python,api,fastapi","A_Id":70061121,"CreationDate":"2021-11-22T04:54:00.000","Title":"Only let one app have access to api endpoint?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am able to login and receving SAMLResponse through HTTP-Redirect binding and also I can able to decrypt using privatekey and able to retrive claims.\nMy question is still do we need to verify saml response(ADFS)? if its how to do that\ndo I need to use IP(identity provider) public key ? will it available in IP(Metadata)?\nI have SAML response in the following request parameter\nSAMLResponse = base64(deflate(data))\nsignature = hashvalue\nsigAlg = sha256\nhow to validate?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":111,"Q_Id":70076829,"Users Score":0,"Answer":"Yes you need to also verify the digital signature of the SAML response. This is because the encryption is done using your public this is available to anyone that has access to your metadata and does not give any assurance that it was produces by your IdP.\nTo verify that you IdP is the one that produced the SAMLResponse you verify the digital signature of the SAMLResponse using the IdP public key. This is typically available in the IdP metadata.","Q_Score":0,"Tags":"python,saml,adfs","A_Id":70077533,"CreationDate":"2021-11-23T07:21:00.000","Title":"How to verify ADFS encrypted SAML Response (Assertion)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"My question is to do with calling python from a command prompt in windows 10 after installing a new version (3.9 to 3.10).\nWhen I type (into a cmd prompt): py i get Python 3.10.0.\nWhen I type (into a cmd prompt): python i get Python 3.9.6.\n\nSo two questions:\n\nWhy do I get two different versions when typing python compared to py?\nHow can I ensure that they point to the same version or how can I select different versions?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":64,"Q_Id":70096382,"Users Score":1,"Answer":"This is because there are two versions of python on your computer. When you want to refer to a particular version of python just do:\npy - version\n\nFor example, if you want to reference python 3.10 in cmd, do: py - 310\nAnd when you want to reference to 3.9 do: py - 39\n\nMake sure you have the correct spacing^","Q_Score":1,"Tags":"python,python-3.x","A_Id":70096690,"CreationDate":"2021-11-24T12:49:00.000","Title":"different python versions from the same command prompt in windows","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":1,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"i have LogisticRegressionCv model it's .pkl file and import data as images but i don't know how to get it on flutter please help me If you know how or if I must to convert my model to other file formats.\nplease help me.\nThank you for your help.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":49,"Q_Id":70144848,"Users Score":0,"Answer":"as you've trained your model in python and stored it in pkl file. One method is in your flutter background, call python3 predict_yourmodel.py your_model_params and after the run, it will give your the model result.\nAnother way is implement a logisticRegressionCv in Flutter as it is a simple model, and easily be implemented. you can store all your params and l1 or l2 etc super-params in a txt instead of pkl file for readility.","Q_Score":0,"Tags":"python,flutter,classification","A_Id":70144960,"CreationDate":"2021-11-28T15:28:00.000","Title":"How to implement LogisticRegressionCv on flutter","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have written this to upload 10000 photos to Instagram, one each hour and whenever I run it I get these errors\n\nINFO - Instabot version: 0.117.0 Started\nINFO - Not yet logged in starting: PRE-LOGIN FLOW!\nERROR - Request returns 429 error!\nWARNING - That means 'too many requests'. I'll go to sleep for 5\nminutes.\n\nthis is my code am I doing anything wrong? Can someone please point it out and explain?\n\nfrom instabot import Bot import time\nbot = Bot()\nimage = 1\nbot.login(username=\"username\", password=\"password\")\nwhile image < 10000:\nphoto = str(image)\nbot.upload_photo(f\"{photo}.png\")\ntime.sleep(3600)\nimage += 1","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":1424,"Q_Id":70148664,"Users Score":1,"Answer":"You just need to go to api.py\nThis is a file in this InstaBot library\nIn case if you're using vscode editor then just ctrl+click on the last link shown in error logs in terminal of vscode\nThen comment out the complete chunk of code starting from 559 to 585(complete if block)\nNow you're good to go","Q_Score":1,"Tags":"python,instagram,instapy","A_Id":72203259,"CreationDate":"2021-11-29T00:32:00.000","Title":"instabot ERROR, Why am I getting these errors and how to fix please?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"I'm creating webapp and using DRF on the server. I want to start function on server, after event on frontend (for example - button clicked)\nExample:\n\nUser is typing '2021' in input field on frontend and click the button ,,generate\"\nThe '2021' is transfering to function ,generate_list_of_sundays(year)' on server\nThe function return list of all sundays in typed year\nList is displayed to user on frontend\n\nOf course this is simple example. I want to know how to get this type of communications between frontend and backend.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":103,"Q_Id":70153104,"Users Score":0,"Answer":"What you want is to expose a REST API using the Django REST Framework and have HTTP endpoints (URLs) mapped to functions on your backend (e.g. generate_list_of_sundays()).\nThen, on the frontend, the button would submit an HTTP request to the given endpoint (i.e. could be POST, GET and so on).\nThe frontend can either use a form to submit the information or something like AJAX.\nYou could also avoid using the REST API approach and have Django views that extract data from the HTTP request and act upon it, but while it might seem easier, this would lead to a poor user experience.","Q_Score":0,"Tags":"python,django,rest,django-rest-framework","A_Id":70153200,"CreationDate":"2021-11-29T10:30:00.000","Title":"Django REST Framework - how to start functions on backend after event on frontend","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"The book \"Learning Python\" by Mark Lutz states that in Python one can use various types of external modules, which include .py files, .zip archives, C\/C++ compiled libraries and others. My question is, how does one usually handle installation of each type of module?\nFor example, I know that to use a .py module, I simply need to locate it with import. What about something like .dll or .a? Or for example, I found an interesting library on GitHub, which has no installation manual. How do I know which files to import?\nAlso, are there any ways of installing modules besides pip?","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":258,"Q_Id":70154483,"Users Score":1,"Answer":"The answer depends on what you want to do.\nYou can use Ninja for example to use C++ modules and cython for C and there are various packages for almost any type of compiled code.\nYou can install packages via pip using the pypi package repository or by using cloned repositories that have a setup.py file inside.\nAny other python based repo can be imported either by a custom build script (that they will provide) or by directly importing the relevant Python files. This will require you the dive into the code and check what are the relevant files.","Q_Score":3,"Tags":"python,python-module,lib","A_Id":70154593,"CreationDate":"2021-11-29T12:14:00.000","Title":"What are ways of using external modules and libraries in Python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have two tables - \"Users\" and \"Projects\", i want to be able to show which users are assigned to which project. There may be multiple users assigned to the project.\nI was thinking of creating a 'project_users_matrix' table where a new column would be created for each user and a new row created for each project, then the cells can just show a 1 or 0 depending on if the person is working on that project.\nThe 'cleaner' option would be to have columns 'user_1', 'user_2', 'user_3' in the project database but then there can't be an indeterminate number of users for a project.\nIs there a better way to do this? It seems like there should be...","AnswerCount":2,"Available Count":2,"Score":0.0996679946,"is_accepted":false,"ViewCount":21,"Q_Id":70179196,"Users Score":1,"Answer":"If users can participate in many projects, and projects can have many users then you have a many-to-many relationship and you need three tables: users, projects and an association table that contains user ids and projects ids only.  Each active user-project combination should have a row in the association table.\nIf users cannot participate in multiple projects simultaneously then you have either a one-to-many relationship between projects and users, or users and projects, which can be expressed by a foreign key column on the many side.","Q_Score":2,"Tags":"python,mysql","A_Id":70180122,"CreationDate":"2021-12-01T04:40:00.000","Title":"I want to create a MYSQL table to show which users are working on which project","Data Science and Machine Learning":0,"Database and SQL":1,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have two tables - \"Users\" and \"Projects\", i want to be able to show which users are assigned to which project. There may be multiple users assigned to the project.\nI was thinking of creating a 'project_users_matrix' table where a new column would be created for each user and a new row created for each project, then the cells can just show a 1 or 0 depending on if the person is working on that project.\nThe 'cleaner' option would be to have columns 'user_1', 'user_2', 'user_3' in the project database but then there can't be an indeterminate number of users for a project.\nIs there a better way to do this? It seems like there should be...","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":21,"Q_Id":70179196,"Users Score":0,"Answer":"you need to create 2 more fields in project-table  1st for User_id and 2nd for Active\/inactive in 1st field you need to store id of user who is working with that project and in 2nd field enter value 0\/1 and provide button that if user is active on that table it shows 1. and once it done with his work.user can update it with 0.","Q_Score":2,"Tags":"python,mysql","A_Id":70179277,"CreationDate":"2021-12-01T04:40:00.000","Title":"I want to create a MYSQL table to show which users are working on which project","Data Science and Machine Learning":0,"Database and SQL":1,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I want to get the molecules from the SMILES using rdkit in python. The SMILES I used was downloaded from the drugbank.\nHowever, when I using the function Chem.MolFromSmiles, some SMILES would report but some wouldn't:\nExplicit valence for atom # 0 N, 4, is greater than permitted.\nI found some explanation about this problem: it is because the SMILES generated a invalid molecule that doesn't exist in real world.  But I am not a chemistry student.... So anyone know how to fix this?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":480,"Q_Id":70198529,"Users Score":2,"Answer":"Your SMILES string would appear to have a neutral 4-co-ordinate nitrogen atom in it, which doesn't exist in real molecules.  4-co-ordinate nitrogen atoms have a positive charge, eg [N+] in a SMILES string.","Q_Score":0,"Tags":"python,chemistry,rdkit","A_Id":70233778,"CreationDate":"2021-12-02T11:23:00.000","Title":"Problems encountered when using RDKIT to convert SMILES to mol","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I would like to hear that for the  Spyder 5.1.5 version is now it possible to recover an accidentally deleted files from a project. If it is, I would really appreciate how to do it because I am pretty worried about it. Thanks in advance.","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":119,"Q_Id":70205892,"Users Score":1,"Answer":"I find a simple solution: keep your project or working directory in Google Drive, so a deleted file can be recovered from Google Drive's trash, even if the deleted file is not in Window's trash.","Q_Score":0,"Tags":"python,file,version,spyder,recover","A_Id":70207218,"CreationDate":"2021-12-02T20:12:00.000","Title":"Is it possible to recover a deleted file from a project written in Spyder 5.1.5?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I would like to hear that for the  Spyder 5.1.5 version is now it possible to recover an accidentally deleted files from a project. If it is, I would really appreciate how to do it because I am pretty worried about it. Thanks in advance.","AnswerCount":2,"Available Count":2,"Score":0.0996679946,"is_accepted":false,"ViewCount":119,"Q_Id":70205892,"Users Score":1,"Answer":"Not possible as far as I know.\nIf you're running on Mac, try to recover via TimeMachine, as it does snapshots every hour or maintain the working folder synchronized with a cloud service.","Q_Score":0,"Tags":"python,file,version,spyder,recover","A_Id":70462312,"CreationDate":"2021-12-02T20:12:00.000","Title":"Is it possible to recover a deleted file from a project written in Spyder 5.1.5?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"in pandas the inplace parameter make modification on the reference but I know in python data are sent by value not by reference i want to know how this is implemented or how this work","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":36,"Q_Id":70214493,"Users Score":1,"Answer":"Python\u2019s argument passing model is neither \u201cPass by Value\u201d nor \u201cPass by Reference\u201d but it is \u201cPass by Object Reference\u201d\n\nWhen you pass a dictionary to a function and modify that dictionary inside the function, the changes will reflect on the dictionary everywhere.\nHowever, here we are dealing with something even less ambiguous. When passing inplace=True to a method call on a pandas object (be it a Series or a DataFrame), we are simply saying: change the current object instead of getting me a new one. Method calls can modify variables of the instances on which they were called - this is independent of whether a language is \"call by value\" or \"call by reference\". The only case in which this would get tricky is if a language only had constants (think val) and no variables (think var) - think purely functional languages. Then, it's true - you can only return new objects and can't modify any old ones. In practice, though, even in purest of languages you can find ways to update records in-place.","Q_Score":0,"Tags":"python,python-3.x,pandas,mutability,call-by-value","A_Id":70214879,"CreationDate":"2021-12-03T12:42:00.000","Title":"the inplace parameter in pandas how it works?","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have a question regarding Python and load balancing. Consider a virtual machine with 16 virtual cpu cores and single Python Rest-Service wrapped in Docker. I suppose it only is going to use one virtual core instead of the 16 when run.\nNow consider 8 duplicates of the Python Rest-Service run in a docker compose parallel behind a load balancer (upstream). Do they use 8 of the 16 cores? And if so how do they know which one to use?\nAlso do the virtual cores make any difference, what about a real system with real 16 cores?\nIf anyone has any experience or knowledge I would be happy if you could share it.\nThank you!","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":114,"Q_Id":70220728,"Users Score":0,"Answer":"Whether a REST service uses one or multiple cores depends on how you code it. You could, for instance, have a pool of python processes handling the requests.\nLets say that you have a python process. Since python grabs the Global Interpreter Lock (GIL) when running byte code, even if it has multiple threads, only one will run at a time. If you have multiple python processes, each one has its own unique GIL, so these processes will run in parallel using multiple cores.\nHow they run is up to the operating system, and it doesn't care if its running python or anything else. At any given time there are X threads available. The operating system scheduler keeps all cores running as much as possible. When the code on one core makes an operating system call, or when a certain time has elapsed, the OS may grab one of the pending threads to execute on that core. The old thread is now put back in the wait queue.\nThere are rules about which threads get the greatest precedence, etc... But this is all quite operating system dependent and so you have to be vague when talking the general sense.","Q_Score":0,"Tags":"python,docker,cpu","A_Id":70220809,"CreationDate":"2021-12-03T21:11:00.000","Title":"Do Multiple Python Programs Use Different Cpu Cores?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Can someone help me with transforming the following table using a PYTHON function?\nI need 2 new columns: A \"follower Type\" which will have entries as organic or paid and a \"Follower count\" which has the values corresponding to the type of follower.\nCurrent Table -\n\n\n\n\norg\norganic follower\npaid follower\nstart date\nstop date\n\n\n\n\nOne\n2\n0\n1634169600000\n1634256000000\n\n\nOne\n-1\n0\n1634256000000\n1634342400000\n\n\n\n\nDesired Table -\n\n\n\n\norg\nstart date\nstop date\nFollower Type\nFollower Count\n\n\n\n\nOne\n1634169600000\n1634256000000\nOrganic\n2\n\n\nOne\n1634169600000\n1634256000000\nPaid\n0\n\n\nOne\n1634256000000\n1634342400000\nOrganic\n-1\n\n\nOne\n1634256000000\n1634342400000\nPaid\n0\n\n\n\n\nIf anybody knows how to do this, please do let me know.\nThanks and Cheers!","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":26,"Q_Id":70233350,"Users Score":0,"Answer":"Use reindex to change column order\n'''\ncolumn_names = [\"C\", \"A\", \"B\"]\ndf = df.reindex(columns=column_names)\n'''\nLike below you can add columns to existing dataframe\ndf[newcolumn]=formula","Q_Score":0,"Tags":"python,pandas,dataframe,etl","A_Id":70233378,"CreationDate":"2021-12-05T10:23:00.000","Title":"How can I do the following dataframe transformation in Python?","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am trying to connect to my BACnet device using BAC0. Yabe is able to detect the BACnet device. However when I try to connect to the device via BAC0.connect(network IP) followed by BAC0.device(device IP and other parameters) I get the error msg - IP address provided is invalid. Check if another software is using port 47808. When I run the command the Wireshark trace shows BACnet APDU protocol being used with appropriate Confirmed-REQ and Complex-ACK msg between the local-network-IP and device-IP, suggesting that the device was polled. However the Wireshark trace shows up after the command terminates with the error message. Could it be that the command terminates prematurely? If so, how to handle it?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":301,"Q_Id":70237611,"Users Score":1,"Answer":"Figured it out. The IP address was correct. But there was another software that starts automatically and runs in the background. It also uses BACNet. As a result the port 47808 was getting used by this software. Wireshark was capturing the communication to the device via this software, since the software has a discovery tool for BACnet devices. BAC0.connect works now.","Q_Score":0,"Tags":"python,bacnet","A_Id":70248781,"CreationDate":"2021-12-05T19:05:00.000","Title":"Yabe detects BACnet device but BAC0.connect does not","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"For the purpose of making a small piece of software for a friend to study I created a little GUI application with pysimplegui. Because he is not really tech-savy and still has a Win7, I tried to pack it as .exe ahead and then also created an installer and gave it via USB to him.\nUnfortunately his Anti-Virus pops up and he gets sort of scared and didn't know what to do.\nFigured out I could resolve it by signing the code with makecert but have to somehow get the key to be installed on his PC also.\nIs there a way to implement that in the installer to spare him going through the technicalities?\nI used the Auto-Py-To-Exe application to convert the python file btw and InnoSetup to create the Installer --- Before handing over, I did try it on a clean Windows7 VM and it worked after using the installer (thought the Registry wanted to get it installed properly).","AnswerCount":1,"Available Count":1,"Score":-0.1973753202,"is_accepted":false,"ViewCount":89,"Q_Id":70256039,"Users Score":-1,"Answer":"Remove code from your program that may be harmful\nThen virus detection software should ignore.","Q_Score":1,"Tags":"python,windows,executable,code-signing-certificate","A_Id":70256647,"CreationDate":"2021-12-07T07:01:00.000","Title":"Auto-Py-to-Exe | Signing a Windows EXE file","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"There are many answers on how to remove old Python versions and many on how to install new ones. Is there a way to install the latest Python version so that it replaces all old installations please?\nI don't want to use a virtual environment, BTW.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":49,"Q_Id":70257035,"Users Score":0,"Answer":"remove all versions of python and by rightclicken on them end pressing uninstall, this will open the programs and features panel and just remove all versions of python you have there, then install the latest version via the python website. this process will not take very long.","Q_Score":0,"Tags":"python,installation","A_Id":70257903,"CreationDate":"2021-12-07T08:33:00.000","Title":"I only want the latest version of Python on my Windows machine","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":1,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have created a knative service[gRPC server] in  aks cluster, I have exposed the service using istio gateway private static IP,\nAfter using the command kubectl get ksvc I have got an address sample-app.test.10.153.157.156.sslio.io\nWhen I try to use this address in the python client, it throws error saying failed to connect addresses, but if I try to hit the service using\ncurl sample-app.test.10.153.157.156.sslio.io I am able to hit the service, I don't know what i am missing here.. please suggest..","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":100,"Q_Id":70272070,"Users Score":0,"Answer":"GRPC uses HTTP\/2. You may need to explicitly name your port h2c. I'm assuming that you've tested the container locally without Knative in the path and have been able to make a grpc call in that case.","Q_Score":2,"Tags":"grpc-python,knative,istio-gateway,knative-serving","A_Id":70274050,"CreationDate":"2021-12-08T08:38:00.000","Title":"how to call knative service [grpc server] by using a python client","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"Im using python 3.9 and coverage 6.2\nI would like to have a record of my most recent coverage but Im not sure if I should upload my .coverage file. Im guessing no since it sort of has info about my directory layout. So i would like to know how I should go about that, is it even standard to upload such a thing? If not, why not?\nI also generated the htmlcov folder but I didnt upload it since it has a default gitignore for the entire folder.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":287,"Q_Id":70297207,"Users Score":1,"Answer":"Most people don't upload the .coverage or HTML report, because they don't need to track it over time.  But there's no harm in uploading them.  You mention directory layout as if it was a secret to protect, but isn't your layout already committed to GitHub?\nIf you want to commit the HTML report, you will need to remove the .gitignore file in the directory.","Q_Score":1,"Tags":"python,coverage.py","A_Id":70304570,"CreationDate":"2021-12-09T21:55:00.000","Title":"Python, Should I upload my .coverage file to my github repository?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm testing AI model with rabbit mq.\nBecasue the process using AI model is heavy, i use rabbit mq to control the task order.\nThe problem is killing the callback function after consuming.\nFor example, there are three tasks in rabbit mq(A,B,C in order)\n\ntask A is consuming, callback function(include AI model) is running\ntask B,C is waiting untill basic_ack arrived\nI want cancel task A ,B and analysis C first\n\nin this case,\n\nhow can i kill the process (task A),\ndelete the message B in rabbit MQ","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":79,"Q_Id":70300249,"Users Score":0,"Answer":"I find the way but cannot sure the right way.\nUse another queue to receive all message from rabbitmq\nand create_task by using asyncio to cancel when i want\nit works well only all funcs are asyncronose","Q_Score":0,"Tags":"python,deep-learning,process,rabbitmq","A_Id":70387588,"CreationDate":"2021-12-10T05:48:00.000","Title":"How can i kill the process in rabbit mq?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"for taking list input in the array I used\n\nmap(int,input().split())\n\nbut for using this input method I can't modify the array if I Iterated like a[I] then it shows\n\nTypeError: 'map' object is not subscriptable\n\nCan you please tell me how can I resolve this problem?\nI am a competitive programmer but I am new to python I  must have take input array by using  map(int,input().split())","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":407,"Q_Id":70306201,"Users Score":1,"Answer":"Use list(map(int,input().split())) instead of map(int,input().split()) to convert your input to list, because map function returns an generator which can not be indexed.","Q_Score":1,"Tags":"python,arrays,python-3.x,list,python-2.7","A_Id":70306224,"CreationDate":"2021-12-10T14:43:00.000","Title":"Array updating problem for using map(int,input().split()) in python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I had a Python code that print 33 line in terminal, so I want to jump back to line 11 and rewrite all text in that line, how can i do that?","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":58,"Q_Id":70320871,"Users Score":1,"Answer":"You will have to use a package like curses to take control of the terminal.  That's what apps like vi use to do their drawing.  That lets you draw strings at specific row and column position.","Q_Score":0,"Tags":"python,python-3.x,terminal","A_Id":70320920,"CreationDate":"2021-12-12T04:08:00.000","Title":"Go to a specific line in terminal using Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I had a Python code that print 33 line in terminal, so I want to jump back to line 11 and rewrite all text in that line, how can i do that?","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":58,"Q_Id":70320871,"Users Score":0,"Answer":"This is why it's useful to have some familiarity with less.\nYou could use 11g to jump to the beginning of the line or 11G to jump to the end of the line.\nOr from the command line, you could use less +11 filename.py or less +11 -N filename.py if you want to see the line numbers. You can also display a specific line of the file at a specific line of the terminal by using less +11 -j 10 filename.py.","Q_Score":0,"Tags":"python,python-3.x,terminal","A_Id":70321097,"CreationDate":"2021-12-12T04:08:00.000","Title":"Go to a specific line in terminal using Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"if i wanted to train an lstm to predict the next date in a sequence of dates, how would i do that since lstm require a scaled value?\nexample of data:\n\n\n\n\ndate\nnext date\n\n\n\n\n2012-05-12\n2012-05-13\n\n\n2012-05-13\n2012-05-19\n\n\n2012-05-19\n2012-05-20\n\n\n2012-05-20\n2012-05-22\n\n\n2012-05-22\n2012-05-26\n\n\n2012-05-26\n2012-05-27\n\n\n2012-05-27\n2012-05-30\n\n\n2012-05-30\n2012-06-12\n\n\n2012-06-12\n2012-05-19\n\n\n2012-06-19\n2012-06-25","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":145,"Q_Id":70333854,"Users Score":2,"Answer":"You could hand over the date split into three inputs: One would then be the year, the other the month, and the last the day. While normalizing your inputs definitely makes sense, however I would not entirely agree with your \"LSTM requires\".\nDay and month are already limited to a range of values which can be scaled\n\nday (1 - 31)\nmonth (1 - 12)\n\nFor year you need to make an educated assumption based on your application. So that year can then also be transferred to a scaled value. Judging from your data, it might be that year is constant at 2012 and it is not needed to begin with.\n\nyear (2012 - 2013(?))\n\nNote: Ask yourself whether you give the neural network enough system information to be able to predict the next date - meaning, is there already enough of a pattern in your data? Otherwise you might end up training a random predictor.","Q_Score":2,"Tags":"python,datetime,machine-learning,time-series,lstm","A_Id":70333995,"CreationDate":"2021-12-13T11:24:00.000","Title":"How to train a LSTM on a sequence of dates?","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Recently i was struggling trying to take the pixel values of a 3D volume (np array) using specific space coordinate of a STL object.\nThe STL object is spatially overlapped with the 3D volume but the latter has no coordinate and so i don't know how to pick pixel values corresponding to the STL coordinates.\nAny idea?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":48,"Q_Id":70351665,"Users Score":0,"Answer":"If the STL object is truly in the 3d volume's coordinate space, then you can simply STL's coordinate as an index to lookup the value from the 3d array.  This lookup does nearest neighbor interpolation of the 3d image.  For better looking results you'd want to do linear (or even cubic) interpolation of the nearby pixels.\nIn most 3d imaging tasks, those coordinate spaces do not align.  So there is a transform to go from world space to 3d volume space.  But if all you have is a 3d numpy array, then there is no transformation information.\nUpdate:\nTo index into the 3d volume take the X, Y, Z coordinates of your point from the STL object and convert them into integer value I, J, K.  Then lookup in the numpy array using I,J,K as indices: np_array[K][J][I].  I think you have to reverse the order of the indices because of the array ordering numpy uses.\nWhen you way 3d array and the STL align in python, how are you showing that?  The original DICOM or Nifti certainly have world coordinate transformations in the metadata.","Q_Score":0,"Tags":"python,stl,interpolation,medical-imaging,nifti","A_Id":70356311,"CreationDate":"2021-12-14T15:46:00.000","Title":"Mapping values from NP ARRAY to STL","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Whereas assert in Python is ideal to verify wether certain function calls return an expected output for a given input, could it also be used to check for results printed on screen (i.e., in procedures that return no results but only have side efffects like printing stuff on screen)? The context of this question is how to write such automated tests that I would like to include in an automated grader tool.\nSince expect the answer to this question to be: assert does not serve this purpose; what other trick could I use then to check the screen output produced by a procedure?","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":20,"Q_Id":70366281,"Users Score":1,"Answer":"You could redirect the standard output to a file and then compare it's content for validity.","Q_Score":0,"Tags":"python,printing,assert","A_Id":70366324,"CreationDate":"2021-12-15T15:29:00.000","Title":"Is there an easy way to use asserts in Python to check for results printed on screen","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"I have installed mypy via command prompt on Windows using this command line:\npython -m pip install mypy, I'm using python 3.10.0, when I use pip list, it shows that  I have installed mypy 0.910 and mypy-extensions 0.4.3, but when I use it to check a program mypy hello.py, it said 'mypy' is not recognized as an internal or external command, operable program or batch file.. Can anyone help me with this? I don't know how to fix this problem. Thanks for your help!","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":375,"Q_Id":70368500,"Users Score":1,"Answer":"You can try these things\n\nRestart your PC. Then try again.\nTry pip install mypy==0.910. Try again.\nCheck whether the location of the pip environment is specified in the Environment variables (Control Panel > System > Advanced System Settings >Environment Variables). If it is not add it or specify the path manually.\n\nexample -: mypy C:\\<your file location>\\hello.py","Q_Score":4,"Tags":"python","A_Id":70368669,"CreationDate":"2021-12-15T18:16:00.000","Title":"Can't use mypy in command prompt for type checking in Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Encountering an error when running this cell, does any one know how to fix it? Thank you.\ncfos and autofluo images have been resampled align with the template\/reference file in atlas. Is it necessary to debug this file?\nFile \"\/homeanaconda3\/envs\/ClearMapStable\/lib\/python3.6\/site-packages\/tifffile\/tifffile.py\", line 4696, in open\nself._fh = open(self._file, self._mode)\nFileNotFoundError: [Errno 2] No such file or directory: '\/home\/ClearMap2\/Documentation\/Example\/Haloperidol\/haloperidol\/1268\/debug_resampled.tif'","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":18,"Q_Id":70370370,"Users Score":0,"Answer":"Thanks for all responding.\nI've solved this problem. It simply need to turn on the debug mode at the beginning of the script. In my case, I turned on the change the code to 'ws.debug = True' in the Initialize workspace cell.","Q_Score":0,"Tags":"python","A_Id":70654656,"CreationDate":"2021-12-15T21:13:00.000","Title":"ClearMap2 - Cell alignment section - file not found error","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"I just started learning Pyglet but hit a roadblock. I am using the i3 window manager, and when I open a window with Pyglet, it floats. My guess is that i3 treats it like a dialog and positions it in the center of my screen. I tried setting the style attribute of the Window object to to all possible values, but it had no effect. How can I set the type attribute of the window to DEFAULT so that the window is part of the i3 grid and not floating in the center?\nI read on StackOverflow how to make a floating window with Tkinter and Cairo GTK(thinking that doing the opposite will give me a non-floating window), but I can't find a way to set the window type attribute in Pyglet the way it can be done with other libraries.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":22,"Q_Id":70376535,"Users Score":0,"Answer":"I figured it out by looking for the same issue with SDL. Apparently, the type hint is not needed if the window is specified as a resizable. By adding resizable=True to the window constructor arguments, the window is included as a part of the grid.\nIf the intended behavior is to have a floating window(ex. a game or dialog) set resizable=False. Else resizable=True.","Q_Score":0,"Tags":"python,python-3.x,pyglet,i3","A_Id":70396060,"CreationDate":"2021-12-16T09:19:00.000","Title":"How to set type attribute for window in Pyglet?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"could you help me with followings.\nparamiko 16.1.0 library is in [python default] \/usr\/local\/lib\/python2.7\/site-packages\nBut I can not upgrade paramiko 16.1.0 library to current paramiko 2.8.0 library; so I had to download paramiko 2.8.0 library into my path \/home\/pylib\nPlease let me know how I can force python to use \/home\/pylib\/paramiko [paramiko 2.8.0 library] in my python code\nNote: for now I am stuck with Python 2.7;I can not update PYTHONPATH","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":38,"Q_Id":70381193,"Users Score":1,"Answer":"It's good practice to use virtual environments to avoid conflicts like this.\nWhat is a virtual environment?\nA virtual environment is basically like creating a fresh installation of Python for only one project. This allows you to easily have two different versions of a library installed for different projects.\nHow do I use virtual environments?\nInstall the virtualenv package: pip2 install virtualenv\nGo to the root of your project cd path\/to\/project\/root\nCreate a virtualenv: virtualenv -p \/usr\/bin\/python2 venv\nActivate the environment: . venv\/bin\/activate\nInstall the package version you want: pip2 install paramiko==2.8.0\nRun your program: python something.py\nTo exit the virtual environment use: deactivate\nNext time you want to run your program make sure you activate the environment with . venv\/bin\/activate first. None of the other steps need to be repeated.","Q_Score":1,"Tags":"python","A_Id":70381623,"CreationDate":"2021-12-16T14:59:00.000","Title":"force python to use my downloaded (to path : \/home\/pytlib) Paramiko library","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm working on a python project which requires me to divide a rectangular space in to triangles.\n\nThere can be no overlap or spaces between the triangles.\nAll of the rectangles area has to be filled.\nIdeally the angles and the sizes of the triangles should differ from\neach other in a random fashion.\nThe algorithm should return a list of all triangles as tuples of\ntheir three corner coordinates.\n\nI am requesting an algorithm to solve the above.\nThings I have tried.\nI have looked for packages and algorithms that might help me but haven't found any.\nSo far, I've thought about creating one random triangle at a time following the top border but get stuck when I reach the opposite vertical border. I don't how to continue from there while making sure that no space is left without a triangle.\nI also thought about just drawing random lines from border to border, but I can't figure out how to find all the triangles created by their intersections as well as guaranteeing that all subareas are triangles.\nAny help would be greatly appriciated!","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":69,"Q_Id":70385109,"Users Score":1,"Answer":"If you think of drawing a diagonal across the rectangle, you have achieved your objective for 2 triangles, each being half of the rectangle area.\nFor multiple triangles, start at any one of the corners, draw a line from it to a random point on the opposite (not adjacent) side. Use that point to draw another line to a point on the original side (increasing the X position as you go).\nThe final line drawn must meet the opposite corner on the original side.\nSave the coordinates of each triangle as 3 tuples. The first tuple of the first triangle, for example, may be {0,0}, depending on the point numbering nomenclature of your screen.","Q_Score":1,"Tags":"python,algorithm","A_Id":70390080,"CreationDate":"2021-12-16T20:16:00.000","Title":"Extract list of randomly sized triangles fully covering a rectangular space in Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Basic question about python f-strings, but couldn't find out the answer: how to force sign display of a float or integer number? i.e. what f-string makes 3 displayed as +3?","AnswerCount":5,"Available Count":1,"Score":-0.1194272985,"is_accepted":false,"ViewCount":1306,"Q_Id":70392020,"Users Score":-3,"Answer":"use if statement if x > 0: .. \"\" else: .","Q_Score":6,"Tags":"python,python-3.x,string,f-string","A_Id":70392053,"CreationDate":"2021-12-17T10:51:00.000","Title":"f-string formatting: display number sign?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"How to achieve going to another page without refreshing after for example clicking a link to another URL. More examples, I have a list of books display and when I clicked on one of the book, it will redirect me to the selected book page. This is the example of the code link.\n<a class=\"link\" href=\"{% url 'books:view_book_detail' obj.book.name obj.pk %}\">View book<\/a>\nI know about the history.pushState() but how to actually use it ? Can it be use with URL from Django. Are there any method else then stated ?","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":68,"Q_Id":70395757,"Users Score":0,"Answer":"I did this using many if statements in view.py\nyou need to use <button type=\"button\"> instead of <a> , and check if the POST request has that name to respond with different context, also you need to use if statements in template to update the frontend according to the response\nIT IS A BAD PRACTICE, it is highly recommended to use JS framework to have a single page app","Q_Score":0,"Tags":"javascript,python,html,django,ajax","A_Id":70493865,"CreationDate":"2021-12-17T15:57:00.000","Title":"Go to another page without refresh [Django]","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"How to achieve going to another page without refreshing after for example clicking a link to another URL. More examples, I have a list of books display and when I clicked on one of the book, it will redirect me to the selected book page. This is the example of the code link.\n<a class=\"link\" href=\"{% url 'books:view_book_detail' obj.book.name obj.pk %}\">View book<\/a>\nI know about the history.pushState() but how to actually use it ? Can it be use with URL from Django. Are there any method else then stated ?","AnswerCount":2,"Available Count":2,"Score":0.1973753202,"is_accepted":false,"ViewCount":68,"Q_Id":70395757,"Users Score":2,"Answer":"Using regular django or plain javascript is not efficient enough for this purpose.\nModern JavaScript frameworks like React, Angular, Vue etc are typically used for these case scenarios.\nBut still, it's not impossible though to do this without JS frameworks.\nOne of the approaches that you can use is using AJAX.\nYou can create a base.html which will be our basic template, and then break the application into little components like home.html, product-list.html, view-product.html. Which we can further include according to our requirements.\n{% include 'view-product.html' with product=product_object %}\n(something like this)\nMake an AJAX request to \/view_product\/<id>\/ which should return a JsonResponse about which component to display. And through JavaScript, we can handle loading that specific component.\nBut again, THIS IS NOT A GOOD PRACTICE, I would recommend using JavaScript frameworks for Single Page Applications.","Q_Score":0,"Tags":"javascript,python,html,django,ajax","A_Id":70396420,"CreationDate":"2021-12-17T15:57:00.000","Title":"Go to another page without refresh [Django]","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"So I've been trying to attack this problem for a while but have no idea how to do it efficiently.\nI'm given a substring of N (N >= 3) characters, and the substring contains solely of the characters 'A' and 'B'. I have to efficiently find a way to count all the substrings possible, which have only one A or only one B, with the same order given.\nFor example ABABA:\nFor three letters, the substrings would be: ABA, BAB, ABA. For this all three count because all three of them contain only one B or only one A.\nFor four letters, the substrings would be: ABAB, BABA. None of these count because they both don't have only one A or B.\nFor five letters: ABABA. This doesn't count because it doesn't have only one A or B.\nIf the string was bigger, then all substring combinations would be checked.\nI need to implement this is O(n^2) or even O(nlogn) time, but the best I've been able to do was O(n^3) time, where I loop from 3 to the string's length for the length of the substrings, use a nested for loop to check each substring, then use indexOf and lastIndexOf and seeing for each substring if they match and don't equal -1 (meaning that there is only 1 of the character), for both A and B.\nAny ideas how to implement O(n^2) or O(nlogn) time? Thanks!","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":67,"Q_Id":70408864,"Users Score":2,"Answer":"Effeciently remove single letter substrings from a string\n\nThis is completely impossible. Removing a letter is O(n) time already. The right answer is to not remove anything anywhere. You don't need to.\nThe actual answer is to stop removing letters and making substrings. If you call substring you messed up.\n\nAny ideas how to implement O(n^2) or O(nlogn) time? Thanks!\n\nI have no clue. Also seems kinda silly. But, there's some good news: There's an O(n) algorithm available, why mess about with pointlessly inefficient algorithms?\ncharAt(i) is efficient. We can use that.\nHere's your algorithm, in pseudocode because if I just write it for you, you wouldn't learn much:\nFirst do the setup. It's a little bit complicated:\n\nMaintain counters for # of times A and B occurs.\nMaintain the position of the start of the current substring you're on. This starts at 0, obviously.\nStart off the proceedings by looping from 0 to x (x = substring length), and update your A\/B counters. So, if x is 3, and input is ABABA, you want to end with aCount = 2 and bCount = 1.\n\nWith that prepwork completed, let's run the algorithm:\n\nCheck for your current substring (that's the substring that starts at 0) if it 'works'. You do not need to run substring or do any string manipulation at all to know this. Just check your aCount and bCount variables. Is one of them precisely 1? Then this substring works. If not, it doesn't. Increment your answer counter by 1 if it works, don't do that if it doesn't.\nNext, move to the next substring. To calculate this, first get the character at your current position (0). Then substract 1 from aCount or bCount depending on what's there. Then, fetch the char at 'the end' (.charAt(pos + x)) and add 1 to aCount or bCount depending on what's there. Your aCount and bCount vars now represent how many As respectively Bs are in the substring that starts at pos 1. And it only took 2 constant steps to update these vars.\n... and loop. Keep looping until the end (pos + x) is at the end of the string.\n\nThis is O(n): Given, say, an input string of 1000 chars, and a substring check of 10, then the setup costs 10, and the central loop costs 990 loops. O(n) to the dot. .charAt is O(1), and you need two of them on every loop. Constant factors don't change big-O number.","Q_Score":1,"Tags":"python,java","A_Id":70408894,"CreationDate":"2021-12-19T03:54:00.000","Title":"Effeciently remove single letter substrings from a string","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"How can I connect two applications with the scenario below?\nApplication1:\nOur infrastructure was created on AWS with python-django and react, its a private VPC that i can only access via SSH to the EC2 bastion instance (as far as to be able to write codes into)and the way the backend was deployed to create the backend URL api.mywebsite.com (which has multiple endpoints) was through cloudfront and Route53. (www.mywebsite.com was built via s3 and can talk to the backend api.mywebsite.com).\nApplication2:\n(This is a client infrastructure)\nAt this time i haven't met the client to know what their system is made of but regardless i need to find a way to write some codes on this system when a specific event is triggered to send data to an API endpoint of Application1.\nWhat would be the best way to implement such a logic or API to connect Application1 and Application2?\n(Especially considering that Application1 infrastructure is a private VPC)\nThis is pretty much the same way that someone would use an API like STRIPE...I guess, but i am not sure how to achieve such result...\nthank you in advance","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":57,"Q_Id":70411814,"Users Score":0,"Answer":"If understood correctly App1 own by your, App2 is own by 3rd party.\nThe way I would solve in a scalable way is to deploy a service on  aws lambda that can get requests from App2(or any other app that you would decide in the future) , I would give this service role in order to connect with App1 and would have all logic there.\nWhat you will gain is that your app is secure(you don't expose it to outside 3rd app) , the solution is scalable (you don't need to do nothing if you want to have other apps connecting)","Q_Score":0,"Tags":"python,reactjs,python-3.x,django,amazon-web-services","A_Id":70412022,"CreationDate":"2021-12-19T13:22:00.000","Title":"How to connect two applications and hit the API of the first application1 from application2","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm using the python playsound module with a little app that I'm making, and it errors out if I use version 1.3.0, so I always use version 1.2.2, but I encountered a bug that caused me to uninstall and reinstall a few different versions. Eventually, I somehow managed to get vscode to think it has playsound 1.3.0 installed. And it errors now when I run it. But if I just run the raw file then it works perfectly fine.\nNote: even when I uninstall the module it still tries to run in vscode, and the same 1.3.0 bug happens, the first note plays and then I get an error.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":30,"Q_Id":70412085,"Users Score":0,"Answer":"Try restarting VSCode. Sometimes it gets hung up. Whenever you install a new module, restart VSCode Becuase that normally fixes it.","Q_Score":0,"Tags":"python,visual-studio-code,module","A_Id":70412170,"CreationDate":"2021-12-19T13:59:00.000","Title":"Vscode not changing module version","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":1,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"Could you please tell me how can I create an alarm from a Python script in a Zabbix system?\nI have a Python script in which a certain function is processed, and at a certain point I would like to create an alarm in the Zabbix system when a certain condition is created in the script. I also have a mail server. I was thinking of creating a separate mailbox for Zabbix, to this email address I will send a letter from Python, and the Zabbix system will receive this letter, process and create a Problem. Is such functionality possible?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":47,"Q_Id":70423366,"Users Score":1,"Answer":"Easiest is to use zabbix for this. To do that you feed values to an item in zabbix in one of the many ways and create a trigger that fires when you want it.\nIf a script is needed to generate the values you can implement the script as a user parameter if it is short running. If it takes more than a few seconds using zabbix sender might be smarter.","Q_Score":0,"Tags":"python,zabbix","A_Id":70426045,"CreationDate":"2021-12-20T14:32:00.000","Title":"From Python to create an alarm in Zabbix","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I want to make a flutter app that, when a button is pressed, it runs a python or a js script that I made and is saved in a .js or a .py file. Essentially, I want to run a .js or a .py file when a button in Flutter is pressed. Is that possible? And if yes, how can it be done? I am making a desktop application that has to work offline.","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":81,"Q_Id":70436141,"Users Score":1,"Answer":"Yes, this is possible, but it requires Python and JS interpreters to be installed on the device. A way to ensure this is to ship them together with your app, although this will take a lot of extra space. From your app, you just launch the interpreter as a subprocess, for example python3 your_script.py\nIf your script is hardcoded and not changed later by the app, you can also turn it into a standalone executable, using a tool such as py2exe. But this is basically the same thing, the interpreter just ends up included in your script.","Q_Score":2,"Tags":"javascript,python,flutter,dart","A_Id":70436272,"CreationDate":"2021-12-21T13:20:00.000","Title":"Is it possible to run a js or python script from a .js or .py file when a button in Flutter is pressed? (Not Flutter Web)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I want to make a flutter app that, when a button is pressed, it runs a python or a js script that I made and is saved in a .js or a .py file. Essentially, I want to run a .js or a .py file when a button in Flutter is pressed. Is that possible? And if yes, how can it be done? I am making a desktop application that has to work offline.","AnswerCount":2,"Available Count":2,"Score":0.0996679946,"is_accepted":false,"ViewCount":81,"Q_Id":70436141,"Users Score":1,"Answer":"Yes you can using API, you make API in django or flask backend which run the python script you want after you make a request to your API via clicking the flutter button","Q_Score":2,"Tags":"javascript,python,flutter,dart","A_Id":70436198,"CreationDate":"2021-12-21T13:20:00.000","Title":"Is it possible to run a js or python script from a .js or .py file when a button in Flutter is pressed? (Not Flutter Web)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"i'm doing k-mean clustering on an image (fruit tree image) with k=4 clusters. when i display 4 clusters seperately, fruits goes to cluster1, stem goes to cluster 2, leaves goes to clster3 and background goes to cluster4. i'm further interested in fruit clutser only. the probelm is when i change image to another fruit tree image, fruit cluster goes to cluster2 or sometimes to clsuter3 or 4. my wish is to not change the cluster for fruit, means if fruit is in cluster1 it should be in cluster1 in all images of fruit tree. how can i do that? 2ndly if its not possible i want to select that cluster automatically which contains fruit. how can i do that? thanks in advance.","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":105,"Q_Id":70445348,"Users Score":1,"Answer":"K-means clustering is unsupervised, meaning the algorithm does not know any labels. That is why the clusters are assigned at random to the targets. You can use a heuristic evaluation of the fruit cluster to determine which one it is. For example, based on data about the pixels (color, location, etc), and then assign it a label by hand. In any case, this step will require human intervention of some sort.","Q_Score":0,"Tags":"python,opencv,cluster-analysis,k-means,image-segmentation","A_Id":70445416,"CreationDate":"2021-12-22T07:05:00.000","Title":"How to choose required cluster after k-means clustering in python opencv?","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have a retail dataset that consists of uncleaned mobile phone numbers. I have data like this\n\n\n\n\nPhone Number\n\n\n\n\n03451000000\n\n\n03451000001\n\n\n03451010101\n\n\n03451111111\n\n\n03459999999\n\n\n03459090909\n\n\n\n\nNow there is a very high probability that the above phone numbers are fakely entered by cashier. The genuine number looks like this for example 03453485413.\nThere are two important things:\n\nThe length of the string is always fixed 11 characters\nThe phone number always starts with 03*********\n\nNow how do I eliminate phone numbers based on the rule that, for example, character repetition of more than 5 times eliminated?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":49,"Q_Id":70448636,"Users Score":0,"Answer":"You should use regex to find such patters.\nFor example:\n(\\d)\\1{4,}\nThis will match a digit and check if it repeats itself 4 more times. This is the case in examples 1, 2, 4 & 5\nAnother example is: (\\d\\d)\\1{2,}\nThis will match 2 digits and checks if it repeats itself 2 more times. This is the case in examples 1, 3, 4, 5 & 6","Q_Score":0,"Tags":"python,pandas,data-manipulation","A_Id":70449885,"CreationDate":"2021-12-22T11:52:00.000","Title":"Python Pandas phone numbers cleaning by eliminating consecutive repeated characters","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am trying to make a application that lets you pass in a discord webhook (string value) into a different .py file, then I want to make this .py file into a .exe file. I have no problem with making the applications gui, but I have no idea how I can pass in the webhook value, with converting it to a .exe file I also have no problem.\nDoes anyone know how I could pass in the webhook string permanently without using other file?","AnswerCount":1,"Available Count":1,"Score":-0.1973753202,"is_accepted":false,"ViewCount":24,"Q_Id":70464110,"Users Score":-1,"Answer":"just open the file and write the variable lines to it.","Q_Score":0,"Tags":"python","A_Id":70473441,"CreationDate":"2021-12-23T15:23:00.000","Title":"Passing variables for installer python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I need to simulate my vanet project that's coded with python. I want to use ns-3 or omnet++, and SUMO.\nplease help me, I don't know how to link my vanet project with the simulator (ns-3 or OMNET++).","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":78,"Q_Id":70468035,"Users Score":0,"Answer":"Options here include pybind11. Check stackoverflow q and a on linking pybind11 and OMNET++.\nOther option is using omnetpy. Check for GitHub project on omnetpy.\nIn both cases you need to learn OMNET++ first.","Q_Score":0,"Tags":"python,simulation,omnet++,sumo,ns-3","A_Id":71186994,"CreationDate":"2021-12-23T22:37:00.000","Title":"simulation of vanet project with omnet++ and sumo,","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have so far discovered four discovered width (or height) related methods and properties of widget (some for them also can be used to get other widget properties). What are the differences between all of them?\n\nwidget[\"width\"]\nwidget.cget(\"width\")\nwidget.winfo_width()\nwidget.winfo_reqwidth()\n\n(There are also equivalent methods and properties for height).","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":46,"Q_Id":70469187,"Users Score":2,"Answer":"-the first one(widget[\"width\"]) is just a wrapping of some of the other commands, I can't tell you which one without decompiling the function.\n-the second one(widget. cget(\"width\")) is a method to access to variable width using the access to widget object through the getters methods of the object\n-the third one(widget.winfo_width()) can be used to know the current width asking to TK's windows manager\n-the fourth one (widget.winfo_reqwidth()) can tell you how much the width of the widget was originally when it was opened, or anyway before the widget.update_idletasks () method.\nin general, we can say that they all do the same thing but, as you can guess, there are subtle differences that allow you to access the information you are looking for differently, in this case width","Q_Score":0,"Tags":"python,tkinter,widget","A_Id":70469550,"CreationDate":"2021-12-24T03:02:00.000","Title":"Python Tkinter: Why are there so many ways to get the width of a widget and what are the differences?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I just started learning how to code ( in python ) and i was wondering how can I randomly ask questions for a quiz without the answer that follows?\nFor example, I'd want the robot to ask 'What's the capital of France?' but without it saying 'Paris'?\nquestions = [(\"What's the capital of France?\", \"Paris\"), (\"Who painted the Mona Lisa?\", \"Da Vinci\")]\nTy :)","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":30,"Q_Id":70476222,"Users Score":0,"Answer":"random.choice will just return a tuple (since those are the items in your list). So you can access just the first element while printing by doing [0].\nFor example, print(random.choice(questions)[0]).\nIn the larger program you'd want to assign the tuple to a variable, so that later you fetch the answer for the same question (by using [1]) instead of randomly selecting again.","Q_Score":0,"Tags":"python,string,discord,tuples","A_Id":70476254,"CreationDate":"2021-12-24T20:05:00.000","Title":"How can i random.choice a question without the answer for a discord robot quiz game?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have a long text. how to get only \"Brandshubs\" from below HTML?\noutput = Brandshubs3.7","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":37,"Q_Id":70483920,"Users Score":1,"Answer":"Just use re.search('Brandshubs', s) or findall function in python re library.\nBut you will get the string Brandshubs always, that's not meaningful so I guess you want to check exists or count the times? For that you can check\/count\nthe results of these functions' return directly","Q_Score":0,"Tags":"python,python-3.x","A_Id":70484175,"CreationDate":"2021-12-26T02:44:00.000","Title":"how to find out a specific text from a long text in python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have an existing django webapp, I have two model classes in my models.py for different functionalities in my app. I have used django allauth for all of the login\/logout\/social sign ins. Note: I have not used django rest framework at all so far in creating my app.\nNow, I have to do the same for the android version of my webapp using Java. What exactly do I need to do right now to create the rest APIs and then connect them to the android app? please give some suggestions","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":46,"Q_Id":70493683,"Users Score":0,"Answer":"yes you have to create new rest API for the android apps. Authentication will be token based for the rest API. storing tokens and retrieving data will be handled by the android app.\nThe stable authentication for Django is Simplejwt","Q_Score":2,"Tags":"python,android,django,rest","A_Id":70493930,"CreationDate":"2021-12-27T09:23:00.000","Title":"I have an existing Django Webapp, how do I make a rest API to integrate the webapp with an android app?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm very new to python and programming in general, and I'm looking to make a discord bot that has a lot of hand-written chat lines to randomly pick from and send back to the user.  Making a really huge variable full of a list of sentences seems like a bad idea.  Is there a way that I can store the chatlines on a different file and have the bot pick from the lines in that file?  Or is there anything else that would be better, and how would I do it?","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":49,"Q_Id":70501825,"Users Score":0,"Answer":"You can store your data in a file, supposedly named response.txt\nand retrieve it in the discord bot file as open(\"response.txt\").readlines()","Q_Score":0,"Tags":"python,discord,discord.py","A_Id":70501865,"CreationDate":"2021-12-28T01:00:00.000","Title":"discord.py: too big variable?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":1},{"Question":"I'm very new to python and programming in general, and I'm looking to make a discord bot that has a lot of hand-written chat lines to randomly pick from and send back to the user.  Making a really huge variable full of a list of sentences seems like a bad idea.  Is there a way that I can store the chatlines on a different file and have the bot pick from the lines in that file?  Or is there anything else that would be better, and how would I do it?","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":49,"Q_Id":70501825,"Users Score":0,"Answer":"I'll interpret this question as \"how large a variable is too large\", to which the answer is pretty simple. A variable is too large when it becomes a problem. So, how can a variable become a problem? The big one is that the machien could possibly run out of memory, and an OOM killer (out-of-memory killer) or similiar will stop your program. How would you know if your variable is causing these issues? Pretty simple, your program crashes.\nIf the variable is static (with a size fully known at compile-time or prior to interpretation), you can calculate how much RAM it will take. (This is a bit finnicky with Python, so it might be easier to load it up at runtime and figure it out with a profiler.) If it's more than ~500 megabytes, you should be concerned. Over a gigabyte, and you'll probably want to reconsider your approach[^0]. So, what do you do then?\nAs suggested by @FishballNooodles, you can store your data line-by-line in a file and read the lines to an array. Unfortunately, the code they've provided still reads the entire thing into memory. If you use the code they're providing, you've got a few options, non-exhaustively listed below.\n\nConsume a random number of newlines from the file when you need a line of text. You would look at one character at a time, compare it to \\n, and read the line if you've encountered the requested number of newlines. This is O(n) worst case with respect to the number of lines in the file.\n\nRather than storing the text you need at a given index, store its location in a file. Then, you can seek to the location (which is probably O(1)), and read the text. This requires an O(n) construction cost at the start of the program, but would work much better at runtime.\n\nUse an actual database. It's usually better not to reinvent the wheel. If you're just storing plain text, this is probably overkill, but don't discount it.\n\n\n[^0]: These numbers are actually just random. If you control the server environment on which you run the code, then you can probably come up with some more precise signposts.","Q_Score":0,"Tags":"python,discord,discord.py","A_Id":70501924,"CreationDate":"2021-12-28T01:00:00.000","Title":"discord.py: too big variable?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":1},{"Question":"I wish to use Django to create a Web app, but first I need to create an virtual environment.\nSince I have a Windows system, I have used Win+R and cmd to open the teriminal, then the system shows C:\\Users\\HP>, I tried to create a datalog named learning_log and use terminal to switch to this datalog, so I typed in learning_log$ python -m venv 11_env, but the system shows 'learning_log$' is not recognized as an internal or external command,\noperable program or batch file.\nMay I know how to create a datalog and how to create an virtual working environment?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":31,"Q_Id":70502337,"Users Score":0,"Answer":"First you need to install virtualenv library:\n\npip3 install virtualenv\n\nAfter installing virtualenv, now create virtual environment directory with any name:\n\nvirtualenv myvenv\n\nNow you can see, myvenv folder. now you can activate the virtual environment using that folder location:\n\n.\\myvenv\\Scripts\\activate.bat\n\nNow you can see the virtual environment activated and you can see (myvenv) on your command prompt.","Q_Score":0,"Tags":"python","A_Id":70507088,"CreationDate":"2021-12-28T02:49:00.000","Title":"How to create an virtual working environment?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Hello I am new to python and I wanted to know how I can load an image from a directory on the computer in a html page using python?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":63,"Q_Id":70503799,"Users Score":0,"Answer":"Can you add more details to your question, please? It is unclear what is the aim here.","Q_Score":0,"Tags":"python,html,css,django","A_Id":70503838,"CreationDate":"2021-12-28T07:08:00.000","Title":"How to load an image file from my local hard drive to html page using python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I need to segregate dashboards for different user roles, how can we do it in flask-login, a user can have a single role assigned to it.\nAnd each user of the role will be assigned to a different entity and it needs to access only that.","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":62,"Q_Id":70503934,"Users Score":1,"Answer":"Just define a many-to-many relationship between user and roles classes. Then using a decorator, check if role in user.roles","Q_Score":0,"Tags":"python,flask,sqlalchemy,flask-login","A_Id":70508954,"CreationDate":"2021-12-28T07:26:00.000","Title":"How do we go about roles and ownership based authentication in flask-login?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I want to define a 'Game' model in which exactly (and not more) 2 users will compete. Each of this user can compete in another game in parallel or later. I thought about a Manytomanyfield, but I don't know how to restrict the number of users. How to do it?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":32,"Q_Id":70517393,"Users Score":0,"Answer":"Just create a model with two user fields (player1, player2).","Q_Score":0,"Tags":"python,django,model","A_Id":70517427,"CreationDate":"2021-12-29T09:18:00.000","Title":"Django model with exactly 2 users references","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am developing an app for Android and i have this issue - after i have taken a picture with the camera, i need to crop it. But the coordinates for the rectangle i have dragged over the capturing area start from the screen's 0,0 coordinates aka touch coordinates do not match actual picture's - if i try to crop the image with these using PIL, i get a partial result.\nOne possible solution would be to take a partial screenshot with these coordinates and get the cropped picture that way.\nI tried to use pyscreenshot, but then i found out that it does not work on Android.\nAny ideas how to capture a partial screenshot on Kivy?\nThank you","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":27,"Q_Id":70524180,"Users Score":0,"Answer":"For possible anyone with the same issue - i did not find any good way to grab a screenshot and crop selected portion out of it. I did, however, solve it this way - i move to a new screen, resize picture to device's screen resolution and from then i can crop it with touch without no issues - i did not have to find a clever way to map screen coordinates with image's. After cropping and saving i resize the image back to a fixed resolution. This is not a elegant solution, but still will serve my purpose.\nThank you anyone who thought along with me.","Q_Score":0,"Tags":"python,kivy","A_Id":70548823,"CreationDate":"2021-12-29T19:36:00.000","Title":"Any way to capture partial screenshot with Kivy?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I want to schedule a spider from scrapyd-client by giving the command line arguments as well.\ne.g: scrapy crawl spider_name -a person=\"John\" -a location=\"porto\" -o local.csv\nAbove command works well when running spider directly from scrapy, but it does not work when running it from rest API using scrapyd-client.\nBasically the question is how to send scrapy's command line arguments like (-a, -o) in scrapyd-client?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":79,"Q_Id":70528192,"Users Score":0,"Answer":"Use the flag -d instead of the -a flag","Q_Score":0,"Tags":"python,scrapy,scrapyd-deploy","A_Id":70530856,"CreationDate":"2021-12-30T06:33:00.000","Title":"How to send scrapy command line argument to scrapyd-client","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"My Python Notebooks log some data into stdout and when I run this notebooks via UI I can see outputs inside cell.\nNow I am running Python Notebooks on Databricks via API (\/2.1\/jobs\/create and then \/2.1\/jobs\/run-now) and would like to get output. I tried both \/2.1\/jobs\/runs\/get and \/2.1\/jobs\/runs\/get-output however none of the includes stdout of the Notebook.\nIs there any way to access stdour of the Notebook via API?\nP.S. I am aware of dbutils.notebook.exit() and will use it, if it will not be possible to get stdout.","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":209,"Q_Id":70535164,"Users Score":1,"Answer":"Yes, it is impossible to get the default return from python code. I saw that on a different cloud provider you can get an output from logs also.\n100% solution it is using dbutils.notebook.exit()","Q_Score":1,"Tags":"python,databricks","A_Id":71657037,"CreationDate":"2021-12-30T18:01:00.000","Title":"Databricks how to get output of the Notebook Jobs via API?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Error is: Import \"brownie\" could not be resolvedPylance\nI know there are other SO posts that refer to this, but it seems most of them are talking about booting up a new env and installing x package into that virtual env.\nHowever with Brownie, I'm especially confused because the brownie docs say:\n\npipx installs Brownie into a virtual environment and makes it available directly from the commandline. Once installed, you will never have to activate a virtual environment prior to using Brownie.\n\nI don't want to mess with the virtual env that brownie uses.\nAnyways, my code runs fine and the command line tells me that brownie is installed.It's just that this warning is really annoying me. Can anyone tell me how to clear it up? Thanks!","AnswerCount":3,"Available Count":3,"Score":0.1325487884,"is_accepted":false,"ViewCount":1318,"Q_Id":70544310,"Users Score":2,"Answer":"for Windows:\n\nCtrl+Shift+P\nType python select\nclick Python: Select Interpreter\nEnter interpreter path ~\/.local\/pipx\/venvs\/eth-brownie\/Scripts\/python\nYou can also click \"Find\" to search your files for the path if manually inputting it isn't working\n\nThis is an addition to @Ali S\u0131tk\u0131 Aslanta\u015f's answer","Q_Score":2,"Tags":"python,solidity,brownie","A_Id":71834107,"CreationDate":"2021-12-31T17:08:00.000","Title":"Import \"brownie\" could not be resolved in Pylance","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Error is: Import \"brownie\" could not be resolvedPylance\nI know there are other SO posts that refer to this, but it seems most of them are talking about booting up a new env and installing x package into that virtual env.\nHowever with Brownie, I'm especially confused because the brownie docs say:\n\npipx installs Brownie into a virtual environment and makes it available directly from the commandline. Once installed, you will never have to activate a virtual environment prior to using Brownie.\n\nI don't want to mess with the virtual env that brownie uses.\nAnyways, my code runs fine and the command line tells me that brownie is installed.It's just that this warning is really annoying me. Can anyone tell me how to clear it up? Thanks!","AnswerCount":3,"Available Count":3,"Score":0.3215127375,"is_accepted":false,"ViewCount":1318,"Q_Id":70544310,"Users Score":5,"Answer":"open command pallete cmd+shift+P (on mac)\ntype python select\nclick Python: Select Interpreter\n\n\nEnter interpreter path\n~\/.local\/pipx\/venvs\/eth-brownie\/bin\/python\n\n\nthis works for me.","Q_Score":2,"Tags":"python,solidity,brownie","A_Id":70739859,"CreationDate":"2021-12-31T17:08:00.000","Title":"Import \"brownie\" could not be resolved in Pylance","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Error is: Import \"brownie\" could not be resolvedPylance\nI know there are other SO posts that refer to this, but it seems most of them are talking about booting up a new env and installing x package into that virtual env.\nHowever with Brownie, I'm especially confused because the brownie docs say:\n\npipx installs Brownie into a virtual environment and makes it available directly from the commandline. Once installed, you will never have to activate a virtual environment prior to using Brownie.\n\nI don't want to mess with the virtual env that brownie uses.\nAnyways, my code runs fine and the command line tells me that brownie is installed.It's just that this warning is really annoying me. Can anyone tell me how to clear it up? Thanks!","AnswerCount":3,"Available Count":3,"Score":0.2605204458,"is_accepted":false,"ViewCount":1318,"Q_Id":70544310,"Users Score":4,"Answer":"It's happening because we install python with pipx instead of pip. pylance looks in the location our pip files are generally stored, and doesn't see brownie since we installed with pipx (which installed to it's on isolated virtual environment). So you have a few options:\n\nIgnore it\nInstall brownie with pip in a virtual environment (not recommended)\n\nIf there is another suggestion, happy to hear it","Q_Score":2,"Tags":"python,solidity,brownie","A_Id":70661536,"CreationDate":"2021-12-31T17:08:00.000","Title":"Import \"brownie\" could not be resolved in Pylance","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am working on a C++ project which will be compiled to a shared object file. It needs to have access to the python interpreter, which is where I reach my hurdle: upon linking, I receive \/usr\/bin\/ld: \/usr\/lib\/gcc\/x86_64-linux-gnu\/9\/crtbeginT.o: relocation R_X86_64_32 against hidden symbol '__TMC_END__' can not be used when making a shared object\n(The opening quotation on __TMC_END__ was a backtick, but this ruined the formatting so I changed it, if this is useful information).\nThe obvious solution is to download the Python source and compile it along with my code, but I would rather not complicate my development workflow to this point, thus, my question is: how do I embed the Python interpreter in my shared object file?\nI am on Ubuntu 20.04 with a full Python 3.9 install, and access to all development files.\n(My apologies if this is the wrong site)","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":44,"Q_Id":70546102,"Users Score":0,"Answer":"It appears that my problem was solved by adding the python lib to the g++ shared-object-builder command. I previously only added it to the first phase of compilation (convert into an object file).","Q_Score":0,"Tags":"python,c++,shared-libraries","A_Id":70546120,"CreationDate":"2021-12-31T22:58:00.000","Title":"How to link library into shared object with G++\/LD","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"So I am doing a face recognition project in a Raspberry Pi. It is a django project and when I run the server I get this error: AttributeError: module 'cv2' has no attribute 'face'\nI searched for the error and I came up with that I needed to install opencv-contrib-python\nThe problem is that when I try to install it the download gets to 99% and I get this: 'pip3 install opencv-contrib-pyt\u2026' terminated by signal SIGKILL (Forced quit).\nDoes anyone know why this happens? how can I fix this? help is much appreciated","AnswerCount":1,"Available Count":1,"Score":-0.1973753202,"is_accepted":false,"ViewCount":476,"Q_Id":70548669,"Users Score":-1,"Answer":"I got the same error and fixed it like this.\nTry:\n\nsudo apt install python-opencv libopencv-dev\n\ny\/n --> y\n\nsudo apt install python python-pip\n\ny\/n --> y\n\npip install opencv-python","Q_Score":0,"Tags":"python,opencv,pip,raspberry-pi","A_Id":70548954,"CreationDate":"2022-01-01T11:48:00.000","Title":"Can't install opencv package in a Raspberry pi","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"How do you take a screenshot of a particular widget? I keep on getting \"how to take screenshot of whole screen\" or \"how to take screenshot of the window\" when searching, but I want to know how to take screenshot of a widget, a Frame, to be exact. I'm afraid that this forum would require me to give them a code snippet, when in reality I don't know what to do. So I'm just asking if this is possible, and how to do it.\nPS: I would really appreciate if it is possible to just give a function the widget variable, and then it would go searching for that widget and then take a precise screenshot of it. I know that there is pyautogui which searches for images, I just don't know what I need to do exactly, since this frame isn't an image and it always changes from now and then, so the automation might get confused.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":44,"Q_Id":70576249,"Users Score":0,"Answer":"Maybe you can get the coords of that frame and then make a screenshot from that coords. This should work","Q_Score":2,"Tags":"tkinter,widget,screenshot,python-3.9","A_Id":70576277,"CreationDate":"2022-01-04T08:55:00.000","Title":"How do you take a screenshot of a particular widget in Tkinter?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I develop a custom python library that I put in S3 bucket, and now I want to use Zeppelin with pyspark interpreter to interact with it. However, I can't find a way to do it. Anybody knows how to do so?\nThings that I have tried:\n\nIn glue it is possible to include external python library in S3 by specifying 'Python lib path', which makes me think that in Zeppelin it is possible\nThere are methods such as using %dep interpreter but it is only for JAR library, while I want to load python library\n\nAny suggestion is appreciated","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":42,"Q_Id":70576672,"Users Score":0,"Answer":"Never mind I find the answer\nWhen creating the dev endpoint you can actually specify 'Python lib path' the same way as you specify it at the glue job","Q_Score":0,"Tags":"python,amazon-s3,pyspark,aws-glue,apache-zeppelin","A_Id":70587088,"CreationDate":"2022-01-04T09:33:00.000","Title":"Import python external library from S3 in Zeppelin","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I want to send requests to a deployed app on a cloud run with python, but inside the test file, I don't want to hardcode the endpoint; how can I get the URL of the deployed app with python script inside the test file so that I can send requests to that URL?","AnswerCount":2,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":151,"Q_Id":70580631,"Users Score":2,"Answer":"You can use gcloud to fetch the url of the service like this\n\ngcloud run services describe  SERVICE_NAME\n--format=\"value(status.url)\"","Q_Score":0,"Tags":"python,google-cloud-run","A_Id":70581001,"CreationDate":"2022-01-04T14:50:00.000","Title":"Retrive endpoint url of deployed app from google cloud run with Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am using fido2 python package and I would like to know how to generate an EC pair (ES256)\npublic and private key.\nand also how to sign a challenge using the private key\nso it'll be possible to verify it with the public key\nThanks","AnswerCount":2,"Available Count":1,"Score":-0.0996679946,"is_accepted":false,"ViewCount":56,"Q_Id":70581405,"Users Score":-1,"Answer":"The Web Authentication protocol (and FIDO2 CTAP2 protocol built on top of it) have a challenge\/response protocol against a device representing authentication of the user called an Authenticator.\nThe fido2 python library is meant to be used to talk to the authenticator, not to emulate an authenticator itself. The role that talks to the authenticator is called a Relying Party.\nSystems typically further divide the Relying Party role into client and server roles - the client communicates with the authenticator, but really it is relaying the communication to and from the server. In WebAuthn, the browser, the site javascript it is running, and any underlying platform support are all considered part of the client. If you have native code talking USB or NFC to an authenticator (on platforms which let you), that native code is considered an authenticator.\nThe underlying authentication challenge does not have a cryptographic signature from the relying party. Instead, the cryptographic signature is made by the authenticator - the authenticator generates a new key pair on registration, and then supplies a signature from that key to prove possession and thus prove authentication. Since fido2 does not have authenticator support, it has no need to generate key pairs (outside of potential test code).\nNote that this gets to an essential of the underlying WebAuthn and FIDO2 platform trust model - the user must trust the client. For this reason, several platforms have locked out low-level access to authenticator hardware (USB, NFC and BLE communication to hardware) and instead provide system API. Native applications must have entitlements to operate on behalf of a particular web origin as a WebAuthn client, and browsers must request special entitlements from the platform in order to represent all web domains.\nThis does not affect usage of fido2 for implementing server functionality, but I'd advise you to double-check platform support if you plan to use it to implement any client functionality.","Q_Score":0,"Tags":"python,encryption,fido","A_Id":70589441,"CreationDate":"2022-01-04T15:44:00.000","Title":"how to generate fido2.cose import ES256 fido2 key pairs","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm trying to update a dynamodb table having some million of rows. Tried updating it with a lambda function but it eventually times out after 15mins. I want to update a single attribute value for all the records present in the table with an efficient way. Can someone suggest how to achieve this?","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":296,"Q_Id":70591991,"Users Score":1,"Answer":"This is just my 5 cents, and it's probably not a official, perfect, or even great way of doing things. But here we go:\n\nCreate a SQS queue\nHave a lambda listen to messages on that queue\nRun the lambda, have it read the first chunk of items from the database.\nFrom the query you get a LastEvaluatedKey, store this in a separate dynamodb item\/table\nPut the LastEvaluatedKey to the queue\nWhen the Lambda is invoked again, use the LastEvaluatedKey passed in from the queue and pass it to the ExclusiveStartKey  in your query, so that your query returns the next items from DynamoDB that you haven't processed yet\n\nThis setup means your lambda will only process small chunks at a time. It also means that when things go wrong, you have your item in DynamoDB with the LastEvaluatedKey stored, which allows you to continue from where you left off.\nHopefully this was useful, good luck :)","Q_Score":1,"Tags":"python-3.x,dynamodb-queries,amazon-dynamodb","A_Id":70592383,"CreationDate":"2022-01-05T11:18:00.000","Title":"How to update millions of dynamodb records in an efficient way","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":1,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have created a KVM in Apigee with the name \"test_kvm\" and the key is \"name\" with value \"myname\".\nSo basically it's like {\"name\": \"myname\"} and the value is encrypted. In KVM policy also I am using private prefix <Get assignTo private.name>...<\/>\nNow when I am trying to fetch this variable into my python script using PythonScript policy using the script getname = flow.getVariable(\"private.name\") this value is getting populated by \"None\". and not by value \"myname\".\nWhy am I getting None and how to properly fetch the Key value from KVM in Python?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":202,"Q_Id":70593226,"Users Score":0,"Answer":"Got it, the thing is we have to deploy kvm in the same environment that we are using to deploy our api proxy.","Q_Score":1,"Tags":"python,apigee","A_Id":70608338,"CreationDate":"2022-01-05T12:55:00.000","Title":"Not able to fetch the key-value from KVM in Apigee using Python Script","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am trying to write a program that will take msg files and extract data fields from the msg files such as to, cc, bcc, subject, date\/time sent etc. Using the Python library extract_msg I have successfully done this.\nWhat I now need to do is add the functionality to extract individual emails from PST files at bulk into individual MSG files.\nI've looked around for a python library that will easily achieve this but I am struggling to find anything. Does anyone have any good suggestions on how I might do this?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":192,"Q_Id":70598106,"Users Score":0,"Answer":"What I now need to do is add the functionality to extract individual emails from PST files at bulk into individual MSG files.","Q_Score":0,"Tags":"python,msg,pst","A_Id":70830235,"CreationDate":"2022-01-05T18:48:00.000","Title":"Convert pst file to msg files","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I need to write a python program to create a table and add columns to it but the name and the quantity of tables and its columns will we user defined means I don't know the name and quantity, it will all be taken as an input from user.\nany idea how to do it?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":67,"Q_Id":70614188,"Users Score":0,"Answer":"I think using the sqllite3 package it is possible. All you need to do is run the queries with a connection to your database.","Q_Score":0,"Tags":"python,sql,pandas","A_Id":70614319,"CreationDate":"2022-01-06T22:06:00.000","Title":"creating table in sql-server using python","Data Science and Machine Learning":0,"Database and SQL":1,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"there is a task: you need to write a registration menu program. it is necessary to do this necessarily on pygame. no other way. how can this be implemented at all? as I know, pygame does not support multi-window. how to do it then?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":25,"Q_Id":70634829,"Users Score":0,"Answer":"Instead of making multiple windows, you could make a single window and then create 2 functions, 1 for the game and the other for registration. Then at start, you could call the registration function and then, the game function. You have not given any code or anything, so we can't help you a lot...","Q_Score":0,"Tags":"python,pygame,menu,registration","A_Id":70676214,"CreationDate":"2022-01-08T17:36:00.000","Title":"menu registration in pygame","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm not very familiar with pytest but try to incorporate it into my project. I already have some tests and understand main ideas.\nBut I got stuck with test for Excel output. I have a function that makes a report and saves it in Excel file (I use xlsxwriter to save in Excel format). It has some merged cells, different fonts and colors, but first of all I would like to be sure that values in cells are correct.\nI would like to have a test that will automatically check content of this file to be sure that function logic isn't broken.\nI'm not sure that binary comparison of generated excel file to the correct sample is a good idea (as excel format is rather complex and minor change of xlsxwriter library may make files completely different).\nSo, I seek an advice how to implement this kind of test. Had someone similar experience? May you give advice?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":247,"Q_Id":70643411,"Users Score":0,"Answer":"IMHO a unit test should not touch external things (like file system, database, or network). If your test does this, it is an integration test. These usually run much slower and tend to be brittle because of the external resources.\nThat said, you have 2 options: unit test it, mocking the xls writing or integration test it, reading the xls file again after writing.\nWhen you mock the xlswriter, you can have your mock check that it receives what should be written. This assumes that you don't want to test the actual xlswriter, which makes sense cause it's not your code, and you usually just test your own code. This makes for a fast test.\nIn the other scenario you could open the excel file with xslsreader and compare the written file to what is expected. This is probably best if you can avoid the file system and write the xls data to a memory buffer from which you can read again. If you can't do that, try using a tempdir for your test, but with that you're already getting into integration test land. This makes for a slower, more complicated, but also more thorough test.\nPersonally, I'd write one integration test to see that it works in general, and then a lot of unit tests for the different things you want to write.","Q_Score":0,"Tags":"python,pytest,python-unittest","A_Id":70643489,"CreationDate":"2022-01-09T16:40:00.000","Title":"Python Unit Test for writing Excel file","Data Science and Machine Learning":0,"Database and SQL":1,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":1},{"Question":"I have 2 python files main.py and  test.py when I run main.py I want to run test.py and some point of time in new terminal because if I run in same terminal main.py got crashed and closed and program fails.\nAny ideas how can I do this.","AnswerCount":3,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":30,"Q_Id":70666575,"Users Score":0,"Answer":"I cannot say for sure without reading the code whether it will work, but here's the steps to run two pieces of code simultaneously:\n\nOpen File Explorer, and navigate to where you have saved the files.\nWrite cmd in the address bar of the file explorer.\nWhen the prompt opens up, write the python command that you use to run the first file: py <filename>.py or python <filename.py> or python3 <filename.py>.\nRepeat process 2 and 3, but this time, type the name of the second file.","Q_Score":0,"Tags":"python","A_Id":70666628,"CreationDate":"2022-01-11T12:09:00.000","Title":"how to run 2 python files in one go?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have 2 python files main.py and  test.py when I run main.py I want to run test.py and some point of time in new terminal because if I run in same terminal main.py got crashed and closed and program fails.\nAny ideas how can I do this.","AnswerCount":3,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":30,"Q_Id":70666575,"Users Score":0,"Answer":"Main.py must call other files to run them","Q_Score":0,"Tags":"python","A_Id":70666614,"CreationDate":"2022-01-11T12:09:00.000","Title":"how to run 2 python files in one go?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have not managed to install pyserial for use with Spyder 3.9 (launched from Anaconda.Navigator) in Windows 10.\nI tried <conda install -c conda-forge pyserial> from the Windows command terminal and some files were installed, but import pyserial from the Spyder console gives the response <ModuleNotFoundError: No module named 'pyserial'>.\nThen I tried to install it again from the Spyder console with pip install pyserial, which gave the response <Requirement already satisfied: pyserial in c:\\users\\father\\anaconda3\\lib\\site-packages (3.4)>\nThen I tried pip uninstall pyserial, which locked up the Spyder console altogether.\nI'm afraid it looks a bit of a mess.  Can anybody suggest how to clear it up and make pyserial available?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":83,"Q_Id":70679098,"Users Score":0,"Answer":"You should juste write import serial instead of import pyserial.","Q_Score":0,"Tags":"python,installation,pyserial","A_Id":70703063,"CreationDate":"2022-01-12T09:26:00.000","Title":"trouble installing pyserial","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Firstly I guess this question might be duplicated, but I couldn't find it.\nQuestion. It's actually in the title.\n\nCan I get Essential Matrix from Fundamental matrix with few matching keypoints, but without intrinsic parameters?\n\nSituation. I am trying to find Essential matrix. I use my phone camera to take photos, and then extract keypoints using SIFT(or ORB). I have 2 images of an object and it's matching points. I could get F, Fundamental Matrix but I have no idea how to get Essential Matrix from this.\nI don't have camera intrinsic parameters, such as Fx, Fy, Cx, Cy.\nI am stuck to this situation. I googled but couldn't get answers.\nLet me know if it's duplicated then I'd delete this.\nPLUS: I also don't have camera coordinates or world coordinates.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":135,"Q_Id":70693520,"Users Score":0,"Answer":"No you can't, you need to know the metric size of the pixel and the focal because essential matrix is in the real world.","Q_Score":0,"Tags":"python,opencv,matrix,camera-calibration","A_Id":70694262,"CreationDate":"2022-01-13T08:33:00.000","Title":"Can I get Essential Matrix from Fundamental matrix with few matching keypoints, but without intrinsic parameters?","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Hi I've a Lambda function treated as a webhook. The webhook may be called multiple time simultaneously with same data. In the lambda function, I check if the transaction record is present in the DynamoDB or not. If it's present in db the Lambda simply returns otherwise it execute further. The problem arises here that when checking if a record in db the Lambda get called again and that check fails because the previous transaction still not inserted in db. and transaction can get executed multiple times.\nMy question is how to handle this situation. will SQS be helpful in this situation?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":112,"Q_Id":70730423,"Users Score":0,"Answer":"\" if it's present in db the lambda simply return otherwise it execute further\" given that, is it possible to use FIFO queue and use some \"key\" from the data as deduplication id (fifo) and that would mean all duplicate messages would never make it to your logic and then you would also need\ndynamodb's \"strongly consistent\" option.","Q_Score":0,"Tags":"python,aws-lambda,amazon-dynamodb,amazon-sqs,atomic","A_Id":70734230,"CreationDate":"2022-01-16T13:22:00.000","Title":"Prevent duplicate DynamoDB transaction","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Python beginner here. I would like to use Spyder as my Python IDE. Alas the standalone version does not include pip and I want to work with \"Vanilla Python\" rather than Anaconda. So I installed Spyder via\npip install spyder, which works fine. However, when running spyder3 in the command window, nothing happens. I get no error, but Spyder does not launch either. While the Spyder website says custom installation may be tricky, it does not provide a guide on how to get it done. Does someone know how? OS is Windows 10.","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":243,"Q_Id":70731571,"Users Score":0,"Answer":"Update: Tried again with Python 3.10.4. \"spyder\" now exists in the Scripts folder and does launch when typing spyder in cmd. Works for me now.","Q_Score":0,"Tags":"python,spyder","A_Id":71882721,"CreationDate":"2022-01-16T15:35:00.000","Title":"Can't launch Spyder after installing with pip","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":1,"ERRORS":0,"REVIEW":0},{"Question":"I recently uninstalled Anaconda Navigator from C Drive and re-installed in D Drive , However each time I open Navigator and try to launch \u201cJupyterlab\u201d or Notebook etc it only gives the option to \"install \"\nAfter clicking install it first goes to C\/ProgramData\/Anaconda3 and says conda environment not found and only after clicking okay does it start looking in D\/Anaconda where the actual packages\/files are present .And this happens every time you close and relaunch the application\nSo how do I resolve this ? \u2026 i have searched and there aren\u2019t any files left from the old install anymore but maybe there are some hidden files somewhere causing this .\nAlso I kept the add 'Anaconda to PATH \" unchecked as per installation recommendations , Could that be an issue ?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":54,"Q_Id":70746667,"Users Score":0,"Answer":"It is always good practice to keep all the software installations in C drive if you don't want to do extra path correction related work.\nYou have not updated the system environment path probably. There are residuals of anaconda pkg even after uninstallation. Remove the residual folder from there (C:\\anaconda3). And update the environment path (Update the location from C:\\anaconda3\\... to D:\\anaconda3\\...).\nAnaconda navigator issue should also get resolved after that.","Q_Score":0,"Tags":"python,anaconda","A_Id":70765676,"CreationDate":"2022-01-17T19:38:00.000","Title":"Anaconda Navigator asks to install applications every time","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Would there be \u201cdilution\u201d of accuracy if I train the same text classification model with multiple training datasets? For example, my end users would be providing (uploading) their own tagged CSVs to train the model and use the trained model in the future. The contexts of datasets would be different - L&D, Technology, Customer Support, etc.\nIf yes, how do I have a \u201cseparate instance or model\u201d for each user?\nI am using Python and would possibly use Gradio or Streamlit as the UI. Open to advice.","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":42,"Q_Id":70750444,"Users Score":1,"Answer":"I ended up using huggingface's zero-shot classification.","Q_Score":1,"Tags":"python,text-classification","A_Id":72430464,"CreationDate":"2022-01-18T04:54:00.000","Title":"Text Classification - Multiple Training Datasets","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"When making a drawing in pygame, for example the rectangle, how do I make my other sprites show up ontop of the rectangle? Currently they are underneath it","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":24,"Q_Id":70778113,"Users Score":0,"Answer":"when you draw all the objects, sprites should be last drawn on screen.\nSo first rectangles will be draw and sprites on top","Q_Score":0,"Tags":"python,pygame,sprite","A_Id":70780649,"CreationDate":"2022-01-19T21:41:00.000","Title":"How do I get sprites to appear overtop of drawings?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"First off, I might have formulated the question inaccurately, feel free to modify if necessary.\nAlthough I am quite new to docker and all its stuff, yet somehow managed to create an image (v2) and a container (cont) on my Win 11 laptop. And I have a demo.py which requires an .mp4 file as an arg.\nNow, if I want to run the demo.py file, 1) I go to the project's folder (where demo.py lives), 2) open cmd and 3) run: docker start -i cont. This starts the container as:\nroot:834b2342e24c:\/project#\nThen, I should copy 4) my_video.mp4 from local project folder to container's project\/data folder (with another cmd) as follows:\ndocker cp data\/my_video.mp4 cont:project\/data\/.\nThen I run:  5) python demo.py data\/my_video.mp4. After a while, it makes two files: my_video_demo.mp4 and my_video.json in the data folder in the container. Similarly, I should copy them back to my local project folder: 6)\ndocker cp cont:project\/data\/my_video_demo.mp4 data\/, docker cp cont:project\/data\/my_video_demo.json data\/\nOnly then I can go to my local project\/data folder and inspect the files.\nI want to be able to just run a particular command that does 4) - 6) all in one.\nI have read about -v   option where, in my case, it would be(?) -v \/data:project\/data, but I don't know how to proceed.\nIs it possible to do what I want? If everything is clear, I hope to get your support. Thank you.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":38,"Q_Id":70784190,"Users Score":0,"Answer":"Well, I think I've come up with a way of dealing with it.\nI have learned that with -v one can create a place that is shared between the local host and the container. All you need to do is that run the docker and provide -v as follows:\ndocker run --gpus all -it -v C:\/Workspace\/project\/data:\/project\/data v2:latest python demo.py data\/my_video_demo.mp4\n--gpus - GPU devices to add to the container ('all' to pass all GPUs);\n-it - tells the docker that it should open an interactive container instance.\nNote that every time you run this, it will create a new container because of -it flag.\nPartial credit to @bill27","Q_Score":0,"Tags":"python,docker,cmd,windows-11","A_Id":70811427,"CreationDate":"2022-01-20T10:01:00.000","Title":"how to execute a python program (with args) that uses docker container?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Hi how can I get an element by attribute and the attribute value in Python Selenium?\nFor example I have class=\"class1 class2 class3\".\nNow I want to get the element with the attribute class what ca.rries the classes \"class1 class2 class3\".\nIs this possible?\nIf I use xpath, I always need to add the element type, input, option,...\nI try to avoid the element type since it varies sometimes.","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":77,"Q_Id":70804166,"Users Score":0,"Answer":"The CSS selectors would be formatted like this:\n'[attribute]'\n'[attribute=\"value\"]'\nFor example, the selector for the input field on google.com would be:\n'input[name=\"q\"]'","Q_Score":0,"Tags":"python,selenium","A_Id":70804353,"CreationDate":"2022-01-21T16:03:00.000","Title":"Python - Selenium get Element by attribute and the full attribute value","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am trying to find a way to disable debugger going into built-in functions. Is there a way to accomplish this? For some reason, I do not see a tab for the debugger in the preferences-> iPython console. Should there be one and how can I enable this? Thanks\nArun","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":21,"Q_Id":70814540,"Users Score":1,"Answer":"Resolved. Downloaded the latest version of Spyder and it has this functionality. It appears my older version did not have this feature.","Q_Score":0,"Tags":"python,debugging,spyder","A_Id":70828461,"CreationDate":"2022-01-22T15:55:00.000","Title":"Dont see Debugger in Preferences\/ IPython Console (or Python Console)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have a simple python script that I would like to run thousands of it's instances on GCP (at the same time). This script is triggered by the $Universe scheduler, something like \"python main.py --date '2022_01'\".\nWhat architecture and technology I have to use to achieve this.\nPS: I cannot drop $Universe but I'm not against suggestions to use another technologies.\nMy solution:\n\nI already have a $Universe server running all the time.\nCreate Pub\/Sub topic\nCreate permanent Compute Engine that listen to Pub\/Sub all the time\n$Universe send thousand of events to Pub\/Sub\nCompute engine trigger the creation of a Python Docker Image on another Compute Engine\nScale the creation of the Docker images (I don't know how to do it)\n\nIs it a good architecture?\nHow to scale this kind of process?\nThank you :)","AnswerCount":2,"Available Count":2,"Score":0.1973753202,"is_accepted":false,"ViewCount":171,"Q_Id":70820906,"Users Score":2,"Answer":"As I understand, you will have a lot of simultaneous call on a custom python code trigger by an orchestrator ($Universe) and you want it on GCP platform.\nLike @al-dann, I would go to serverless approach in order to reduce the cost.\nAs I also understand, pub sub seems to be not necessary, you will could easily trigger the function from any HTTP call and will avoid Pub Sub.\nPubSub is necessary only to have some guarantee (at least once processing), but you can have the same behaviour if the $Universe validate the http request for every call (look at http response code & body and retry if not match the expected result).\nIf you want to have exactly once processing, you will need more tooling, you are close to event streaming (that could be a good use case as I also understand). In that case in a full GCP, I will go to pub \/ sub & Dataflow that can guarantee exactly once, or Kafka & Kafka Streams or Flink.\nIf at least once processing is fine for you, I will go http version that will be simple to maintain I think. You will have 3 serverless options for that case :\n\nApp engine standard: scale to 0, pay for the cpu usage, can be more affordable than below function if the request is constrain to short period (few hours per day since the same hardware will process many request)\nCloud Function: you will pay per request(+ cpu, memory, network, ...) and don't have to think anything else than code but the code executed is constrain on a proprietary solution.\nCloud run: my prefered one since it's the same pricing than cloud function but you gain the portability, the application is a simple docker image that you can move easily (to kubernetes, compute engine, ...) and change the execution engine depending on cost (if the load change between the study and real world).","Q_Score":0,"Tags":"python,python-3.x,google-cloud-platform,architecture,scalability","A_Id":70826005,"CreationDate":"2022-01-23T09:57:00.000","Title":"Run & scale simple python scripts on Google Cloud Platform","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have a simple python script that I would like to run thousands of it's instances on GCP (at the same time). This script is triggered by the $Universe scheduler, something like \"python main.py --date '2022_01'\".\nWhat architecture and technology I have to use to achieve this.\nPS: I cannot drop $Universe but I'm not against suggestions to use another technologies.\nMy solution:\n\nI already have a $Universe server running all the time.\nCreate Pub\/Sub topic\nCreate permanent Compute Engine that listen to Pub\/Sub all the time\n$Universe send thousand of events to Pub\/Sub\nCompute engine trigger the creation of a Python Docker Image on another Compute Engine\nScale the creation of the Docker images (I don't know how to do it)\n\nIs it a good architecture?\nHow to scale this kind of process?\nThank you :)","AnswerCount":2,"Available Count":2,"Score":0.1973753202,"is_accepted":false,"ViewCount":171,"Q_Id":70820906,"Users Score":2,"Answer":"It might be very difficult to discuss architecture and design questions, as they usually are heavy dependent on the context, scope, functional and non functional requirements, cost, available skills and knowledge and so on...\nPersonally I would prefer to stay with entirely server-less approach if possible.\nFor example, use a Cloud Scheduler (server less cron jobs), which sends messages to a Pub\/Sub topic, on the other side of which there is a Cloud Function (or something else), which is triggered by the message.\nShould it be a Cloud Function, or something else, what and how should it do - depends on you case.","Q_Score":0,"Tags":"python,python-3.x,google-cloud-platform,architecture,scalability","A_Id":70822075,"CreationDate":"2022-01-23T09:57:00.000","Title":"Run & scale simple python scripts on Google Cloud Platform","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Scenario: Lets say I have a REST API written in Python (using Flask maybe) that has a global variable stored. The API has two endpoints, one that reads the variable and returns it and the other one that writes it. Now, I have two clients that at the same time call both endpoints (one the read, one the write).\nI know that in Python multiple threads will not actually run concurrently (due to the GIL), but there are some I\/O operations that behave as asynchronously, would this scenario cause any conflict? And how does it behave, I'm assuming that the request that \"wins the race\" will hold the other request (is that right)?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":54,"Q_Id":70831421,"Users Score":1,"Answer":"In short: You should overthink your rest api design and implement some kind of fifo queue.\nYou have to endpoints (W for writing and R for reading). Lets say the global variable has some value V0 in the beginning. If the clients A reads from R while at the same time client B writes to W. Two things can happen.\n\nThe read request is faster. Client A will read V0.\nThe write request is faster. Client A will read V1.\n\nYou won't run into an inconsistent memory state due to the GIL you mentioned, but which of the cases from above happens, is completely unpredictable. One time the read request could be slightly faster and the other time the write request could be slightly faster. Much of the request handling is done in your operating system (e.g. address resolution or TCP connection management). Also the requests may traverse other machines like routers or switches in you network. All these things are completly out of your control and could delay the read request slightly more than the write request or the other way around. So it does not matter with how many threads you run your REST server, the return value is almost unpredictable.\nIf you really need ordered read write interaction, you can make the resource a fifo queue. So each time any client reads, it will pop the first element from the queue. Each time any client writes it will push that element to the end of the queue. If you do this, you are guaranteed to not lose any data due to overwriting and also you read the data in the same order that it is written.","Q_Score":0,"Tags":"python,multithreading,rest","A_Id":70831893,"CreationDate":"2022-01-24T09:14:00.000","Title":"How Python handles asynchronous REST requests","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I need to implement payment with credit card in a Django Project. But, I don't know how to start, and I can't find any information about do it.\n\nWhat's the best module to do the integration?\nThe module is well documented? and it has code examples about the correct implementation.\n\nPlease, if you know how to do it, help me. I'm collaborating with an ONG and we need to implement this for donations payments.\nThanks. Regards,","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":109,"Q_Id":70869240,"Users Score":0,"Answer":"You need a payment provider. A lot of that. The most popular worldwide are Paypal, Stripe, Braintree, others. You can find local providers if you're outside the USA.\nYou need to check the API documentation of the selected provider. A lot of them have public API docs and links you can find on the landing pages. Usually, this is REST API, so you can use the Requests library to make the integration. Don't forget to write integrational tests!\nYou need to be compliant with the rules and policies of the selected provider.\nYou need to have a bank account to make a settlement from the payment provider.\nMost providers have a sandbox to test API without having a real production-approved account.\n\nWhen I said, \"You need...\" I mean you or your company needs to provide such information or create a needed account(s), bank accounts, etc.","Q_Score":0,"Tags":"python,django,payment","A_Id":70870244,"CreationDate":"2022-01-26T19:36:00.000","Title":"Credit card payment in Django (Python) with RedSys","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":1,"ERRORS":0,"REVIEW":0},{"Question":"I'm trying to deploy my Django 4.0.1 application to Google App Engine. But I'm receiving an error:\n\nCould not find a version that satisfies the requirement Django==4.0.1.\n\nOn a localhost the app works fine. The same error I have with asgiref==3.5.0\nThe full text of this error:\n\nERROR: Could not find a version that satisfies the requirement\nDjango==4.0.1 (from -r requirements.txt (line 6)) (from versions:\n1.1.3, 1.1.4, 1.2, 1.2.1, 1.2.2, 1.2.3, 1.2.4,\n1.2.5, 1.2.6, 1.2.7, 1.3, 1.3.1, 1.3.2, 1.3.3, 1.3.4, 1.3.5, 1.3.6, 1.3.7, 1.4, 1.4.1, 1.4.2, 1.4.3, 1.4.4, 1.4.5, 1.4.6, 1.4.7, 1.4.8, 1.4.9, 1.4.10, 1.4.11, 1.4.12, 1.4.13, 1.4.14,\n1.4.15, 1.4.16, 1.4.17, 1.4.18, 1.4.19, 1.4.20, 1.4.21, 1.4.22, 1.5, 1.5.1, 1.5.2, 1.5.3, 1.5.4, 1.5.5, 1.5.6, 1.5.7, 1.5.8, 1.5.9, 1.5.10, 1.5.11, 1.5.12, 1.6, 1.6.1, 1.6.2, 1.6.3, 1.\n6.4, 1.6.5, 1.6.6, 1.6.7, 1.6.8, 1.6.9, 1.6.10, 1.6.11, 1.7, 1.7.1, 1.7.2, 1.7.3, 1.7.4, 1.7.5, 1.7.6, 1.7.7, 1.7.8, 1.7.9, 1.7.10, 1.7.11, 1.8a1, 1.8b1, 1.8b2, 1.8rc1, 1.8, 1.8.1, 1.8 .2, 1.8.3, 1.8.4, 1.8.5, 1.8.6, 1.8.7, 1.8.8, 1.8.9, 1.8.10, 1.8.11, 1.8.12, 1.8.13, 1.8.14, 1.8.15, 1.8.16, 1.8.17, 1.8.18, 1.8.19, 1.9a1, 1.9b1, 1.9rc1, 1.9rc2, 1.9, 1.9.1, 1.9.2, 1.\n9.3, 1.9.4, 1.9.5, 1.9.6, 1.9.7, 1.9.8, 1.9.9, 1.9.10, 1.9.11, 1.9.12, 1.9.13, 1.10a1, 1.10b1, 1.10rc1, 1.10, 1.10.1, 1.10.2, 1.10.3, 1.10.4, 1.10.5, 1.10.6, 1.10.7, 1.10.8, 1.11a1, 1. 11b1, 1.11rc1, 1.11, 1.11.1, 1.11.2, 1.11.3, 1.11.4, 1.11.5, 1.11.6, 1.11.7, 1.11.8, 1.11.9, 1.11.10, 1.11.11, 1.11.12, 1.11.13, 1.11.14, 1.11.15, 1.11.16, 1.11.17, 1.11.18, 1.11.20, 1 .11.21, 1.11.22, 1.11.23, 1.11.24, 1.11.25, 1.11.26, 1.11.27, 1.11.28, 1.11.29, 2.0a1, 2.0b1, 2.0rc1, 2.0, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.0.5, 2.0.6, 2.0.7, 2.0.8, 2.0.9, 2.0.10, 2.0.12 , 2.0.13, 2.1a1, 2.1b1, 2.1rc1, 2.1, 2.1.1, 2.1.2, 2.1.3, 2.1.4, 2.1.5, 2.1.7, 2.1.8, 2.1.9, 2.1.10, 2.1.11, 2.1.12, 2.1.13, 2.1.14, 2.1.15, 2.2a1, 2.2b1, 2.2rc1, 2.2, 2.2.1, 2.2.2, 2.\n2.3, 2.2.4, 2.2.5, 2.2.6, 2.2.7, 2.2.8, 2.2.9, 2.2.10, 2.2.11, 2.2.12, 2.2.13, 2.2.14, 2.2.15, 2.2.16, 2.2.17, 2.2.18, 2.2.19, 2.2.20, 2.2.21, 2.2.22, 2.2.23, 2.2.24, 2.2.25, 2.2.26, 3 .0a1, 3.0b1, 3.0rc1, 3.0, 3.0.1, 3.0.2, 3.0.3, 3.0.4, 3.0.5, 3.0.6, 3.0.7, 3.0.8, 3.0.9, 3.0.10, 3.0.11, 3.0.12, 3.0.13, 3.0.14, 3.1a1, 3.1b1, 3.1rc1, 3.1, 3.1.1, 3.1.2, 3.1.3, 3.1.4,\n3.1.5, 3.1.6, 3.1.7, 3.1.8, 3.1.9, 3.1.10, 3.1.11, 3.1.12, 3.1.13, 3.1.14, 3.2a1, 3.2b1, 3.2rc1, 3.2, 3.2.1, 3.2.2, 3.2.3, 3.2.4, 3.2.5, 3.2.6, 3.2.7, 3.2.8, 3.2.9, 3.2.10, 3.2.11)     Step #1: ERROR: No matching distribution found for Django==4.0.1 (from -r\nrequirements.txt (line 6)) Step #1: WARNING: You are using pip version\n20.2.2; however, version 21.3.1 is available. Step #1: You should consider upgrading via the '\/env\/bin\/python -m pip install --upgrade\npip' command.\n\nI have Google Cloud SDK 369.0.0\nWhat is the reason and how to fix it?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":158,"Q_Id":70870462,"Users Score":2,"Answer":"The error is telling you that the maximum version of Django available on GCP for GAE is 3.2.11. Instead of specifying version 4.0.1 in your requirements.txt file, you can either use a lower version (any of the ones listed in your error) or don't specify a version and GAE will pick the latest that it has.\nNote: Google (Cloud Providers) don't always\/necessarily support the highest version of an App\/package immediately. It usually takes them a bit of time before they add support for it whereas you can download a latest version to your local environment (your computer and work with it).","Q_Score":0,"Tags":"python-3.x,django,google-app-engine,google-cloud-platform","A_Id":70872771,"CreationDate":"2022-01-26T21:26:00.000","Title":"GCP: Google App Engine flexible + Django 4.0.1 problem on deployment","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"I am testing a React Native app using Appium in Python. This is the first time seeing that the app responds too slow with Appium but works completely fine while testing manually. Any idea on how to improve speed of tests?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":140,"Q_Id":70893889,"Users Score":0,"Answer":"One way to improve test speed is use a modern device. For your issue, because the app runs well without also running appium doesn't mean the device is not the culprit. Appium does run on the device while also running the app, so the device needs to be able to run both the app and other apps at the same time well to be able to run smooth appium tests.","Q_Score":1,"Tags":"python,appium,ui-automation","A_Id":70900023,"CreationDate":"2022-01-28T12:34:00.000","Title":"Appium gets too slow while testing React Native app","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":1},{"Question":"I have a network diagram that is sketched in Visio. I would like to use it as an input for the networkx graph from node2vec python package. The documentation says that there is a function called to_networkx_graph() that takes, as its input, the following types of data:\n\"any NetworkX graph dict-of-dicts dict-of-lists container (e.g. set, list, tuple) of edges iterator (e.g. itertools.chain) that produces edges generator of edges Pandas DataFrame (row per edge) numpy matrix numpy ndarray scipy sparse matrix pygraphviz agraph\"\nBut, still, not mentioning other formats like Visio, pdf, odg, PowerPoint, etc.\nSo, how to proceed?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":68,"Q_Id":70900560,"Users Score":2,"Answer":"I think you need to create some data in the format referred to in the documentation, not just a network diagram. A Visio diagram will not do the job and I know of no way to do a conversion.","Q_Score":0,"Tags":"python-3.x,networkx,visio","A_Id":70907712,"CreationDate":"2022-01-28T21:37:00.000","Title":"How to convert network diagram in Visio format to a a networkx graph?","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am using python 3.9.2 and pip 21.0.1. I've created a virtual environment. In that I installed flask 1.1.2 and Werkzeug 1.0.0.\nI tried to install coolname==1.1.0 and wtforms_components==0.10.5, it says successfully installed but it is not importing files.\nfrom coolname I want generate_slug package\nand from wtforms_components, I want TimeField\nWhat I have done to install them:\npip install WTForms-Components==0.10.5\npip install coolname\nCan you please tell me how can I get these packages?","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":19,"Q_Id":70902489,"Users Score":1,"Answer":"You might be using the global interpreter instead of your virtual environment.\nYou need to check that your IDE's interpreter is configured to that virtual environment you created. if you want to run it from the command line you first need to activate it with env_name\\Scripts\\activate and then run it.","Q_Score":0,"Tags":"python,import","A_Id":70902546,"CreationDate":"2022-01-29T05:12:00.000","Title":"unable to import coolname and wtforms_components","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"How would I go about using BitBlt in python? I know how to use PatBlt, but I was wondering how you use BitBlt. How would I put a image on the GDI?","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":103,"Q_Id":70910211,"Users Score":0,"Answer":"If you already know how to use PatBlt then you are most of the way there.\nBitBlt just transfers pixels from one DC to another. Often one DC has a bitmap selected into it and the other DC is the screen. It can be used to take screen shots, display pictures or do double buffering.\nLet's say you have a bitmap loaded from LoadImage and you want to display it in WM_PAINT.\n\nCall BeginPaint to get a DC for your window (the destination).\nCall CreateCompatibleDC to create a source DC that is compatible with the destination.\nCall SelectObject to select the bitmap (HBITMAP) into the source DC. You should store the return value so it can be restored during cleanup.\nCall BitBlt(destination DC, ..., source DC, ...., SRCCOPY) to copy the bitmap pixels to the window.\nCall SelectObject to restore the original value.\nCall DeleteDC to destroy the source DC.\nCall EndPaint.","Q_Score":0,"Tags":"python,windows,gdi","A_Id":70911661,"CreationDate":"2022-01-29T22:17:00.000","Title":"How to use BitBlt in Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm new to python and I've been seeing import x as _x. I would like to know how this is different from import x. Thanks!","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":81,"Q_Id":70921905,"Users Score":1,"Answer":"Writing import x simply imports the module. When using any class or function from the module x, you have to define the module name like x.foo(). Adding the as _x makes _x an alias of the imported module's name. So, instead of x.foo() you can now write _x.foo(). Note that with the alias, you cannot write x.foo().\nThis helps shortening the module names in cases of large module names such as matplotlib.pyplot or scipy.signal etc. It's certainly much easier to write and read plt.plot() than matplotlib.pyplot.plot().","Q_Score":0,"Tags":"python","A_Id":70922085,"CreationDate":"2022-01-31T06:15:00.000","Title":"Is there a difference between \"import x\" and \"import x as _x\"?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I've been coding with R for quite a while but I want to start learning and using python more for its machine learning applications. However, I'm quite confused as to how to properly install packages and set up the whole working environment. Unlike R where I suppose most people just use RStudio and directly install packages with install.packages(), there seems to be a variety of ways this can be done in python, including pip install conda install and there is also the issue of doing it in the command prompt or one of the IDEs. I've downloaded python 3.8.5 and anaconda3 and some of my most burning questions right now are:\n\nWhen to use which command for installing packages? (and also should I always do it in the command prompt aka cmd on windows instead of inside jupyter notebook)\nHow to navigate the cmd syntax\/coding (for example the python documentation for installing packages has this piece of code: py -m pip install \"SomeProject\" but I am completely unfamiliar with this syntax and how to use it - so in the long run do I also have to learn what goes on in the command prompt or does most of the operations occur in the IDE and I mostly don't have to touch the cmd?)\nHow to set up a working directory of sorts (like setwd() in R) such that my .ipynb files can be saved to other directories or even better if I can just directly start my IDE from another file destination?\n\nI've tried looking at some online resources but they mostly deal with coding basics and the python language instead of these technical aspects of the set up, so I would greatly appreciate some advice on how to navigate and set up the python working environment in general. Thanks a lot!","AnswerCount":3,"Available Count":1,"Score":0.0665680765,"is_accepted":false,"ViewCount":151,"Q_Id":70922321,"Users Score":1,"Answer":"Going over the technical differences of conda and pip:\nSo Conda is a packaging tool and installer that aims to do more than what pip does; handle library dependencies outside of the Python packages as well as the Python packages themselves. Both have many similar functionalities as well, you can install packages or create virtual environments with both.\nIt is generally advisable to generally have both conda and pip installed since there are some packages which might not be available with conda but with pip and vice versa.\nThe commands to install in both the ways is easy enough, but one thing to keep in mind is that\n\nconda stores packages in the anaconda\/pkgs directory\npip stores it in directory under \/usr\/local\/bin\/ for a Unix-based system, or \\Program Files\\ for Windows\n\nYou can use both pip or conda inside the jupyter notebook, it will work just fine, but it may be possible that you get multiple versions of the same package.\nMost of the times, you will use cmd only to install a module used in your code, or to create environments, py -m pip install \"SomeProject\" here basically means that the module \"SomeProject\" will be downloaded in base env.","Q_Score":0,"Tags":"python,pip,jupyter-notebook","A_Id":70922587,"CreationDate":"2022-01-31T07:12:00.000","Title":"Installing packages in python and setting up the working environment","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm working on a project where we are using vanilla javascript, Html and css for frontend while designing the backend in the FastAPI. The way backend connects with the frontend is using Templates, by adding the file name for a particular page and also sending the data as jinja template back to the client side. We have five pages and all are declared in the backend as get requests and we are using a specific html file for loading a particular page. So, there are mainly five html files for five pages\nNow, I was deciding to switch to reactjs as the frontend, however, react being the single page application and also just having the Routes for multiple pages, I'm wondering how to I connect it to the backend and also send data back to the client, the way I was doing it before. I tried to look for answers, couldn't find one as of now...\nAnd also I'm kind of new to Reactjs","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":217,"Q_Id":70947189,"Users Score":0,"Answer":"React, Python, and FastAPI are all great technologies that I too use. But they work more effectively when used for their intended purposes. A hammer is a great tool if you need to pound in some nails, but it's a lousy tool for other purposes such as trying to use it as an eating utensil. So you'd be well advised, if you are going to use React and FastAPI, to use them as they were intended.\nJinja templates are used for server side rendering. But React is (in essence) also a server side rendering system. Both of them will not play nicely together, at least not without more work and complexity.\nInstead you'd be better off committing to either the Jinja templating or React. If you choose Jinja, you figure out what the page will be (render) before sending it off to the client. If you choose React, you write the user-visible application, send that off to the client, and then the application on the client's browser fetches data through (usually JSON) APIs from the FastAPI back end.","Q_Score":0,"Tags":"python,reactjs,jinja2,fastapi,multipage","A_Id":70976227,"CreationDate":"2022-02-01T20:36:00.000","Title":"Is it possible to have React multi-page application while having fastapi as the backend routing each page and sending data as jinja templates","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I use iTerm2 as my default terminal app in OSX. A would like to ask if is possible to insert text automatically with a hotkey (or selecting it from a menu), with iTerm, like the old macros of some word processing packages. My idea is, for example, if I press cmd + ctrl s , iTerm insert automatically \"sftp -i\"\nI know that iTerm has support for scripting with AppleScript and Python  but I'm not sure how I do this","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":163,"Q_Id":70971049,"Users Score":0,"Answer":"You can also use Keyboard shortcuts.\nFrom Preferences -> Keys\nDefine a new shortcut and use the \"Action\" \"Send Text\"\nThis works on iTerm2 build  3.4.15","Q_Score":1,"Tags":"python,scripting,applescript,iterm","A_Id":72213801,"CreationDate":"2022-02-03T12:10:00.000","Title":"Is it possible to create a macro \/ script in iTerm2 that insert text automatically selected from a list?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have to analyze a set of bgp-update-files using python and the pybgpstream with a given routing table file. My task is to analyze these update files regarding prefix hijacking events. As far as I know, analyzing these files means to look for all ASs that advertise prefixes that do not belong to them and list those events.\nMy current code just allows me to go through the directory and check all update files for prefixes and as-paths. Since I do not know how to use the routing table file (ground truth) in pybgpstream, i cannot go any further into analyzing the prefix ownership.\nHas anybody a idea, how to check, whether a prefix belongs to a specified AS?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":84,"Q_Id":70974225,"Users Score":0,"Answer":"Think about what part of AS-Path called origin. Fix research results:\n\nThe last AS along the path to the prefix is considered to be the\norigin AS\n[https:\/\/www.cs.colostate.edu\/~massey\/pubs\/conf\/massey_imw01.pdf]\n\nLittle hint try to use scientific search engines additionaly to google ;)","Q_Score":0,"Tags":"python,network-security,bgp","A_Id":71196103,"CreationDate":"2022-02-03T15:45:00.000","Title":"identify potential prefix hijacking events in BGP update data using Python and pybgpstream","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am working on a project the backend is in python Django and frontend in react-js and database is MySQL. Now the problem is I need to search products from database in my project but don\u2019t know how to get query for frontend to backend. I don\u2019t know the code Moreover I am using rest-framework and Axios library to connect. I am very thankful to you if you help me to create search related queries in my project. Thank you","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":97,"Q_Id":70978611,"Users Score":0,"Answer":"You should elaborate more. What is the issue? means \"do you have issue about how to implement search at DB?\" or 'how to send data from frontend to backend and vice-versa'","Q_Score":0,"Tags":"reactjs,python-3.x,django,django-models,django-rest-framework","A_Id":70978772,"CreationDate":"2022-02-03T21:35:00.000","Title":"Django_React_SQL website product searching","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I want to fetch all the issues which are currently in 'IN PROGRESS' status and previously in 'OPEN'status.\nBy using the following code I would get all the issues that are currently in 'IN PROGRESS' status and the issues that are passed through 'OPEN' status once in its transition state.\neg: issues = jira.search_issues(PROJECT=XYZ AND (status in ('IN PROGRESS')) AND (status WAS in ('OPEN')))\nBut how can I get the issues which are currently in the 'IN PROGRESS' status and previously in 'OPEN' status in JIRA using Jira-Python?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":42,"Q_Id":71019646,"Users Score":0,"Answer":"You can run a search using Jira Python. Use the same search you showed us","Q_Score":0,"Tags":"python,jira,python-jira","A_Id":71022758,"CreationDate":"2022-02-07T13:48:00.000","Title":"How to fetch previous status of an issue in JIRA using Python-Jira?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am trying to communicate with a vehicle control unit (VCU) over can. I have figured out the commands (index, data and frequency) and can verify the functionality through PCanView on Windows. Now I am using Nvidia Xavier system with python-can library to send the same commands, and I can verify the commands with candump. However when I power the vehicle engine on while sending these commands, the canbus freezes (this is when the VCU starts expecting the can commands I am sending, it goes into fault state if it doesn't receive the data it expects)\nI have successfully used python-can in the past to talk to other can devices and I am confident about the correctness of the code itself.\nHardware connection is fine too, because I can receive non-VCU messages from the vehicle. I can also receive VCU messages after I restart the canbus.\nWhat could be causing the bus to freeze? And is there a way to prevent it? (By setting some config in the socket-can layer itself?)\nPlease note that restarting the bus will not fix the problem as the vehicle cannot recover once it goes into fault without a restart.\nAny help will be appreciated!","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":77,"Q_Id":71026164,"Users Score":0,"Answer":"Ok, it turns out it was a hardware problem. The length of CAN cables was a bit too much. The bus receives a lot of data transmission when the vehicle is turned on and the CAN cable was flooded with data. I still don't know the mechanics of the fault but decreasing the cable length made it all work.","Q_Score":0,"Tags":"linux-kernel,can-bus,socketcan,python-can","A_Id":71134010,"CreationDate":"2022-02-07T22:21:00.000","Title":"Canbus freezes - how to ignore error frames?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"I am trying to communicate with a vehicle control unit (VCU) over can. I have figured out the commands (index, data and frequency) and can verify the functionality through PCanView on Windows. Now I am using Nvidia Xavier system with python-can library to send the same commands, and I can verify the commands with candump. However when I power the vehicle engine on while sending these commands, the canbus freezes (this is when the VCU starts expecting the can commands I am sending, it goes into fault state if it doesn't receive the data it expects)\nI have successfully used python-can in the past to talk to other can devices and I am confident about the correctness of the code itself.\nHardware connection is fine too, because I can receive non-VCU messages from the vehicle. I can also receive VCU messages after I restart the canbus.\nWhat could be causing the bus to freeze? And is there a way to prevent it? (By setting some config in the socket-can layer itself?)\nPlease note that restarting the bus will not fix the problem as the vehicle cannot recover once it goes into fault without a restart.\nAny help will be appreciated!","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":77,"Q_Id":71026164,"Users Score":0,"Answer":"The cable length could be the reason, but take care about the bus topology and especially where the CAN terminations are located.","Q_Score":0,"Tags":"linux-kernel,can-bus,socketcan,python-can","A_Id":71430529,"CreationDate":"2022-02-07T22:21:00.000","Title":"Canbus freezes - how to ignore error frames?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"Say you have two random words ('yellow' and 'ambient' or 'goose' and 'kettle'). What tech could be used to rate how similar or different they are in meaning as informed by popular usage? For example, from 0 to 1 where antonyms are 0 and synonyms are 1, 'yellow' and 'ambient' might be 0.65 similar.\nNote: I'm not talking about how close the two strings are to each other, but rather an approximation of how similar their meanings are.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":57,"Q_Id":71027321,"Users Score":0,"Answer":"I do not really understand what you exactly mean with similarity especially if you want to talk about meaning. You would need a dataset to denote meaning unto words. A popular example of this would be sentiment analysis. If you got a lot of textual data, say tweets from twitter, you might want to know if the data is mostly positive or negative. To do this you would find a dataset of similar nature who has labelled the data already into categories. Then you can use this data to classify the texts into categories (e.g with a Naive Bayes classifier). In this way you can denote meaning on texts computationally.\nThis would allow general evaluations but also evaluations on an input to input basis on how well they scored across different categories of meaning.\nI'm not sure if that's what you're looking for in an answer though.","Q_Score":0,"Tags":"python,artificial-intelligence","A_Id":71027535,"CreationDate":"2022-02-08T00:55:00.000","Title":"How to Measure Similarity or Difference of Meaning Between Words?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I use BashOperator to execute a python file called app.py in Airflow.\nI wrote another python script called to_es.py. There is a function called \"df_to_es()\" in it.\nThe app.py should call df_to_es() by from utils.to_es import df_to_es, but the Airflow throws an error in red words: 'there is no module called \"def_to_es\"'.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":92,"Q_Id":71034221,"Users Score":0,"Answer":"Finally I come to answer my own question.\nEven though Airflow may indicate that there is a DAG import error, but if you use BashOperator to execute your Python script, you import your own python functions, classes and modules in that script, they work smoothly if you don't have some other errors. Just double check if you are using correct Airflow DAG directory.\nSo just ignore that DAG import error if you are in my situation. This is something that Airflow develop team need to improve. Something like unit test.","Q_Score":0,"Tags":"python,module,airflow","A_Id":71115168,"CreationDate":"2022-02-08T12:50:00.000","Title":"I use BashOperator to execute a python file in Airflow, how to import other self-defined function?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"I have a command-line python package run in the terminal directly (it was not run inside python environment) that often gives me a maximum recursion error. I know the default setting is 1000, and I know you can use the setrecursionlimit() command to change it. However, every time I change it and exit the python environment, the value resets to the default.\nMy question is, without changing the python package, is there a way I could change the python default recursion depth permanently. I understand this may not be a good practice, so I plan to change it back to 1000 after I finish using the package, which I probably won't need after a week.\nThanks!","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":78,"Q_Id":71041060,"Users Score":0,"Answer":"I agree with others that using sys.setrecursionlimit is the way to go. In the end, that is the reason why sys is part of the Python Standard Library.\nIn an interactive session, you could set your PYTHONSTARTUP global variable to a file with the necessary python commands, however this would still run the exact same code but just a bit more 'hidden' from the user.\nI think that if you'd really like to set this to another value, your only option is to dive deep into the C header files of the cpython source code and custom compile python for your needs.","Q_Score":1,"Tags":"python,recursion,command-line","A_Id":71041226,"CreationDate":"2022-02-08T21:22:00.000","Title":"how to permanently change the maximum recursion depth in python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"Hi I am using the google calendar API for a school project and my tokens have expired and I don't know how to refresh them. Please help!!!","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":28,"Q_Id":71055074,"Users Score":0,"Answer":"Generally, when a token expires, make a new one using the same process and replace the old one in your code with the new one.","Q_Score":1,"Tags":"python,api,calendar","A_Id":71055412,"CreationDate":"2022-02-09T18:46:00.000","Title":"Refresh token for google calendar API","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am using a library django-upgrade to convert the code from django 1.11 to django 3.24\nthe command is like\n\ndjango-upgrade --target-version 3.2 example\/core\/models.py\n\nI want to know that how can I run this command so that it runs on whole django project.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":24,"Q_Id":71060918,"Users Score":0,"Answer":"I am clear on the question but if you are asking how to upgrade Django then in your virtual environment run pip sudo pip install --upgrade django==3.2","Q_Score":0,"Tags":"python,django","A_Id":71063490,"CreationDate":"2022-02-10T06:56:00.000","Title":"how to run a django-upgrade command to whole django project?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have an issue with working with the turtle package in python. I have Anaconda installed on my computer. Within Anaconda I have installed the turtle package with pip command (there is no conda install option for turtle as to my knowledge).\nWhen I start a jupyter notebook and import turtle everything works just fine.\nWhen I start vscode from conda and use the same python environment, I get an import error from vscode saying: importerror: cannot import name Turtle.\nWhy is this happening and how could I start turtle in vscode?\nThank you!","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":67,"Q_Id":71068614,"Users Score":0,"Answer":"Use pip install PythonTurtle in the vs code terminal","Q_Score":0,"Tags":"python,anaconda","A_Id":71068804,"CreationDate":"2022-02-10T16:21:00.000","Title":"Installed turtle package not recognized by vscode","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"I have an issue with working with the turtle package in python. I have Anaconda installed on my computer. Within Anaconda I have installed the turtle package with pip command (there is no conda install option for turtle as to my knowledge).\nWhen I start a jupyter notebook and import turtle everything works just fine.\nWhen I start vscode from conda and use the same python environment, I get an import error from vscode saying: importerror: cannot import name Turtle.\nWhy is this happening and how could I start turtle in vscode?\nThank you!","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":67,"Q_Id":71068614,"Users Score":0,"Answer":"Solved! Shayan solved the problem in the comments... I was so stupid to name my file turtle.py... no comment\nI renamed the file and works really great!\nThank you Shayan!","Q_Score":0,"Tags":"python,anaconda","A_Id":71069198,"CreationDate":"2022-02-10T16:21:00.000","Title":"Installed turtle package not recognized by vscode","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"I have created a Tabular Dataset using Azure ML python API. Data under question is a bunch of parquet files (~10K parquet files each of size of 330 KB) residing in Azure Data Lake Gen 2 spread across multiple partitions. When I try to load the dataset using the API TabularDataset.to_pandas_dataframe(), it continues forever (hangs), if there are empty parquet files included in the Dataset. If the tabular dataset doesn't include those empty parquet files, TabularDataset.to_pandas_dataframe() completes within few minutes.\nBy empty parquet file, I mean that the if I read the individual parquet file using pandas (pd.read_parquet()), it results in an empty DF (df.empty == True).\nI discovered the root cause while working on another issue mentioned [here][1].\nMy question is how can make TabularDataset.to_pandas_dataframe() work even when there are empty parquet files?\nUpdate\nThe issue has been fixed in the following version:\n\nazureml-dataprep : 3.0.1\nazureml-core :  1.40.0","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":171,"Q_Id":71075255,"Users Score":1,"Answer":"Thanks for reporting it.\nThis is a bug in handling of the parquet files with columns but empty row set. This has been fixed already and will be included in next release.\nI could not repro the hang on multiple files, though, so if you could provide more info on that would be nice.","Q_Score":0,"Tags":"azure,azure-machine-learning-service,azureml,azureml-python-sdk","A_Id":71357828,"CreationDate":"2022-02-11T04:14:00.000","Title":"AzureML: TabularDataset.to_pandas_dataframe() hangs when parquet file is empty","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have created a Tabular Dataset using Azure ML python API. Data under question is a bunch of parquet files (~10K parquet files each of size of 330 KB) residing in Azure Data Lake Gen 2 spread across multiple partitions. When I try to load the dataset using the API TabularDataset.to_pandas_dataframe(), it continues forever (hangs), if there are empty parquet files included in the Dataset. If the tabular dataset doesn't include those empty parquet files, TabularDataset.to_pandas_dataframe() completes within few minutes.\nBy empty parquet file, I mean that the if I read the individual parquet file using pandas (pd.read_parquet()), it results in an empty DF (df.empty == True).\nI discovered the root cause while working on another issue mentioned [here][1].\nMy question is how can make TabularDataset.to_pandas_dataframe() work even when there are empty parquet files?\nUpdate\nThe issue has been fixed in the following version:\n\nazureml-dataprep : 3.0.1\nazureml-core :  1.40.0","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":171,"Q_Id":71075255,"Users Score":0,"Answer":"You can use the on_error='null' parameter to handle the null values.\nYour statement will look like this:\nTabularDataset.to_pandas_dataframe(on_error='null', out_of_range_datetime='null')\nAlternatively, you can check the size of the file before passing it to to_pandas_dataframe method. If the filesize is 0, either write some sample data into it using python open keyword or ignore the file, based on your requirement.","Q_Score":0,"Tags":"azure,azure-machine-learning-service,azureml,azureml-python-sdk","A_Id":71108141,"CreationDate":"2022-02-11T04:14:00.000","Title":"AzureML: TabularDataset.to_pandas_dataframe() hangs when parquet file is empty","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am very new to python and I'd like to ask for an advice on how to, where to start, what to learn.\nI've got this fantasy name generator (joining randomly picked letters), which every now and then creates a name which is acceptable, what I'd like to do though is to train an AI to generate names which aren't lets say just consonants, ultimately being able to generate human, elvish, dwarfish etc names.\nI'd appreciate any advice in this matter.\nEdit:\nMy idea is: I get a string of letters, if they resemble a name, I approve it, if not - reject. It creates a dataset of True\/False values, which can be used in machine learning, at least that's what I am hoping for, as I said, I am new to programming.\nAgain, I don't mind learning, but where do I begin?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":70,"Q_Id":71081896,"Users Score":0,"Answer":"Single characters are not really a good fit for this, as there are combinatorial restrictions as to which letters can be combined to larger sequences. It is much easier to not have single letters, but instead move on to bi-grams, tri-grams, or syllables. It doesn't really matter what you choose, as long as they can combine freely.\nYou need to come up with an inventory of elements which comply with the rules of your language; you can collect those from text samples in the language you are aiming for.\nIn the simplest case, get a list of names like the ones you want to generate, and collect three-letter sequences from that, preferably with their frequency count. Or simply make some up:\nFor example, if you have a language with a syllablic structure where you always have a consonant followed by a vowel, then by combining elements which are a consonant followed by a vowel you will always end up with valid names.\nThen pick 2 to 5 (or however long you want your names to be) elements randomly from that inventory, perhaps guided by their frequency.\nYou could also add in a filter to remove those with unsuitable letter combinations (at the element boundaries) afterwards. Or go through the element list and remove invalid ones (eg any ending in 'q' -- either drop them, or add a 'u' to them).\nDepending on what inventory you're using, you can simulate different languages\/cultures for your names, as languages differ in their phonological structures.","Q_Score":1,"Tags":"python,random,dataset,artificial-intelligence","A_Id":71082895,"CreationDate":"2022-02-11T14:40:00.000","Title":"How to train AI to create familiar sounding, randomly generated names?","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm making a music bot for my discord server and I want it to run 24\/7 on repl.it but when I run it on my computer I add executable=\".\/ffmpeg.exe\" to the from_probe function. Nevertheless, replit doesn't support executable files so I need to find an other way to make this work. I tried installing ffmpeg package, I also looked up for tutorials how to use ffmpeg-python with youtube_dl. None of these worked. If you need some additional info, just ask me in the comment section.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":160,"Q_Id":71104685,"Users Score":0,"Answer":"It's not possible on replit. FFmpeg was working on replit before, it does not work now, you possibly could find another module to play music.","Q_Score":0,"Tags":"python,ffmpeg,discord.py,youtube-dl,replit","A_Id":71295381,"CreationDate":"2022-02-13T20:42:00.000","Title":"How to run a music bot on replit (discord.py)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":1,"ERRORS":0,"REVIEW":0},{"Question":"Basically; I messed up. I have pickled some data, a pretty massive dictionary, and while my computer was able to create and pickle that dictionary in the first place, it crashes from running out of memory when I try to unpickle it. I need to unpickle it somehow, to get the data back, and then I can write each entry of the dictionary to a separate file that can actually fit in memory. My best guess for how to do that is to unpickle the dictionary entry by entry and then pickle each entry into it's own file, or failing that to unpickle it but somehow leave it as an on-disk object. I can't seem to find any information on how pickled data is actually stored to start writing a program to recover the data.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":41,"Q_Id":71107148,"Users Score":1,"Answer":"pickle is a serialization format unique to Python, and there is no user-level documentation for it.\nHowever, there are extensive comments in a standard distribution's \"Lib\/pickletools.py\" module, and with enough effort you should be able to use that module's dis() function to produce output you can parse yourself, or modify the source itself. dis() does not execute a pickle (meaning it doesn't build any Python objects from the pickle). Instead it reads the pickle file a few bytes at a time, and prints (to stdout, by default) a more human-readable form of what those bytes \"mean\".","Q_Score":1,"Tags":"python,pickle","A_Id":71107205,"CreationDate":"2022-02-14T04:25:00.000","Title":"How to unpickle part of a pickled dictionary?","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":1,"ERRORS":0,"REVIEW":0},{"Question":"Unlike earlier version 3 releases nowadays building Python 3.10 from source does not seem to run the (time-consuming) tests.\nI need to build Python 3.10 on an oldish platform (no, I can't change that). I would actually like to run the tests, even if they are time consuming.\nUnfortunately, I can't find the way to do it. Googling shows nonsensical results (how to do testing while using Python, unittest etc), while .\/configure --help doesn't show anything.\nHave the tests been removed? If not, how can I enable them?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":38,"Q_Id":71113146,"Users Score":0,"Answer":"Building from source make -j 4 prefix=\"\/usr\" usually does the tests too. At least that's what I've observed.","Q_Score":0,"Tags":"python,compilation,python-3.10","A_Id":71119777,"CreationDate":"2022-02-14T14:04:00.000","Title":"How to run tests while building Python 3.10+ from source?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am working on a script that needs to be run both from a command prompt, such as BASH, and from the Console in Spyder. Running from a command prompt allows the script file name to be followed by several arguments which can then be utilized within the script; >python script1.py dataFile.csv Results outputFile.csv. These arguments are referenced within the script as elements of the list sys.argv.\nI've tried using subprocess.run(\"python script1.py dataFile.csv Results outputFile.csv\") to enable the console to behave as the command line, but sometimes it works fine and other times it needs certain arguments, like -f between python and the file name, before it will display what is displayed in the command line. Different computers disagree on whether such arguments help or hurt.\nI've searched and searched, and found some clever ways to use technicalities of the specific operating system to distinguish, but is there something native to Python I can use?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":63,"Q_Id":71118560,"Users Score":0,"Answer":"If you import sys in the console and then call sys.argv, it will show you the value ['']. While running a script within Spyder expands that array to ['script1.py'] (plus the file address), it will still not get larger than one entry.\nIf, on the other hand, you run the script from the command line the way you showed above, then sys.argv will have a value of ['script1.py', 'dataFile.csv', 'Results', 'outputFile.csv']. You can utilize the differences between these to distinguish between the cases.\nWhat are the best differences to use? You want to distinguish between two possibilities, so an if - else pair would be best in the code. What's true in one case and false in the other? if sys.argv will not work, because in both cases the list contains at least one string, so that will be effectively True in both cases.\nif len(sys.argv) > 1 works, and it adds the capability to run from the command line and go with what is coded for the console case.","Q_Score":0,"Tags":"python,bash,command-line,ipython,spyder","A_Id":71118561,"CreationDate":"2022-02-14T21:34:00.000","Title":"Distinguish runs from Command Prompt vs Spyder console","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I noticed this weird behavior where checking if paths existed with those paths being in \/media mount points that are not mounted (that is: a external removable disc that is not connected) is exponentially slower than checking on local disc paths.\nIs this a known bug? And how can i avoid it?\nShould i just glob the mount points in '\/media' and if a path starts in '\/media' but isn't in the glob, skip it?\nIs there a way to make this idea portable or is it hopeless to try?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":57,"Q_Id":71119085,"Users Score":0,"Answer":"The reason for the 'slowness' is that i had fstab file where i automounted the external drive with a too long timeout.\nSpecifically i had on the options nofail,noatime,x-systemd-automount,x-systemd.device-timeout=1s\nOmitting the option is even more disastrous btw, the default timeout is 90 seconds or something.\nI ended up removing the automount and using '1ms' instead of '1s' for the timeout.\nRemoving the automount is not actually necessary, i think, and i might add it back, because it allows mount to happen even if you don't start gnome, and before autostart gnome programs although it conflicts\/duplicates mountpoints with the gnome 'autostart' from autofs and can only be removed with the 'Disks' program in gnome, and requires using x-gvfs-hide to hide the ugly duplicated mountpoint.","Q_Score":0,"Tags":"python-3.x,performance,io","A_Id":71120389,"CreationDate":"2022-02-14T22:36:00.000","Title":"python 3 path.exists() or os.path.exists(path) or open(path) is very slow if the path is on mountpoint that does not exist","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Hi I am using LightAutoML on supervised data can someone help me with how to do preprocessing in this framework I am using it for the first time\nI have tried to use train split but it says that input contains null values","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":29,"Q_Id":71120633,"Users Score":1,"Answer":"I found out in the documentation of lightautoml that it takes care of data preprocessing and feature engineering too","Q_Score":1,"Tags":"python","A_Id":71553044,"CreationDate":"2022-02-15T03:00:00.000","Title":"how to do LightAutoML data preprocessing especially NaN Values","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am creating a subprocess using this line of code:\np = subprocess.Popen([\"doesItemExist.exe\", id], shell=False)\nand when I run the script while I have the Task Manager open, I can see that it creates two processes and not one. The issue is that when I go to kill it, it kills one (using p.kill()), but not the other. I've tried looking online but the only examples I find are about shell=True and their solutions don't work for me. I've confirmed that that line only gets called once.\nWhat can I do? Popen is only giving me back the one pid so I don't understand how to get the other so I can kill both.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":61,"Q_Id":71129345,"Users Score":0,"Answer":"I ended up being able to deal with this issue by creating a clean up function which just uses the following:\nsubprocess.run([\"taskkill\", \"\/IM\", \"doesItemExist.exe\", \"\/F\"], shell=True)\nThis will kill any leftover tasks. If anyone uses this, be careful that your exe has a unique name to prevent you from killing anything you don't mean to. If you want to hide the output\/errors, just set the stdout and stderr to subprocess.PIPE.\nAlso, if there is no process to kill it will report that as an error.","Q_Score":0,"Tags":"python,subprocess,popen,kill","A_Id":71166078,"CreationDate":"2022-02-15T15:46:00.000","Title":"subprocess.Popen is creating two processes instead of one","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"There is a case in my job where l have to remove a specific section (Glossary) from thousands of pdf documents.\nThe text l want to remove has a different font from the other parts:\nExample:\n\"Floor\"  the lower surface of a room, on which one may walk.\n\"exchange\" an act of giving one thing and receiving another (especially of the same type or value) in return.\nCan you please suggest a way how to do it faster?","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":39,"Q_Id":71134329,"Users Score":2,"Answer":"One of the possible ways to solve this problem is to find the section you want to delete using regex. Then using one of the libraries for pdf editing in python to delete this section.","Q_Score":0,"Tags":"python,pdf","A_Id":71134370,"CreationDate":"2022-02-15T22:44:00.000","Title":"Removing specific section from thousands of pdfs (using python)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"The question may not have been clear as there was not much of a better way for me to word it but I will do my best here: Most scripting is done raw in the IDE. When coding with Python it simply runs everything through the \"console.\" I was wondering how full-on apps with different screens and all that cool stuff are made with Python as well, other than just being a console with many different commands?","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":25,"Q_Id":71136475,"Users Score":1,"Answer":"Basically if you want to design cool stuff with colours and nice picture, you can use turtle. Turtle is a cool library which allows you to draw turtles and other cool animations. Useful for beginners like you :)","Q_Score":0,"Tags":"python,python-3.x,ide","A_Id":71136706,"CreationDate":"2022-02-16T04:38:00.000","Title":"How are complex applications made with Python in an IDE with raw code?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"This is a typical python coding challenge. Many beginners have a hard time handling it.\nFor example, we have a test array as:\ntest = [[1,2],[1,3],[2,4],[2,1],[2],[5,1],[3,4]]\nQ1: count the number of pairs in the list.\nQ2: count the number of pairs for 1.\nI know I can use the least\/greatest function in SQL to do the job, but I don't know how to do it in python, especially in 2 dimension arrays.\nExpected result for Q1 is 5 ([1,2],[1,3],[2,4],[5,1],[3,4]\uff09\nExpected result for Q2 is 3 (2,3,5)","AnswerCount":2,"Available Count":1,"Score":-0.0996679946,"is_accepted":false,"ViewCount":42,"Q_Id":71152445,"Users Score":-1,"Answer":"len([k in test if len(k)==2]) and len([k for k in test if 1 in k]) should get you there.","Q_Score":0,"Tags":"python,arrays,pandas,match","A_Id":71152463,"CreationDate":"2022-02-17T04:14:00.000","Title":"count paired numbers in 2-dimension python","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm currently trying to read from one Kafka topic, doing some transformation and producing the messages to another topic.\nHowever, i am having a lot of issues with the Consumer. First of all, if we set reasonable session timeout\/max poll records values (like 10 s), the consumer takes super long, constantly rebalances and sometimes sends duplicated messages. If we increase the params to crazy values like 30 min, the speed increases dramatically. But the problem is once it reaches the 30 min mark, it rebalances and takes around 30 min to start up again.\nI have been playing with a lot of different params but still lost on how to fix this. Any ideas? Thanks","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":58,"Q_Id":71171812,"Users Score":0,"Answer":"This may be due to some configuration issues. Based on your question I would suggest to please check your auto commit property.\nBecause ideally kafka does rebalance if it does not recieve the acknowledgement of the message read before session timeout happens. If it is set as false then either set it to true or make sure to commit to kafka once you are done processing the message","Q_Score":0,"Tags":"python,apache-kafka,kafka-consumer-api","A_Id":71180171,"CreationDate":"2022-02-18T10:18:00.000","Title":"Kafka consumer speed increases with session timeout\/max poll records","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm trying to run a face detection model in Unity. It gets input from the webcam, then spits out a face. But trying to make this work with C# has been an absolute nightmare. And despite all my suffering, I still haven't been able to make it work!\nIf I could use python, I'd be able to get it done easily. So, obviously, I want to find a way to get a python script working in Unity. But IronPython is the only thing I've been able to find, and it's outdated.\nI need either knowledge of how to make IronPython work in spite of being outdated, or some other method. Please.","AnswerCount":3,"Available Count":2,"Score":-0.0665680765,"is_accepted":false,"ViewCount":640,"Q_Id":71179346,"Users Score":-1,"Answer":"You can just run your python script on playtime and let it create some data in files. Then read the files using C# and display data in Unity.","Q_Score":1,"Tags":"python,unity3d","A_Id":71183873,"CreationDate":"2022-02-18T20:11:00.000","Title":"How do to use a python script in Unity?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm trying to run a face detection model in Unity. It gets input from the webcam, then spits out a face. But trying to make this work with C# has been an absolute nightmare. And despite all my suffering, I still haven't been able to make it work!\nIf I could use python, I'd be able to get it done easily. So, obviously, I want to find a way to get a python script working in Unity. But IronPython is the only thing I've been able to find, and it's outdated.\nI need either knowledge of how to make IronPython work in spite of being outdated, or some other method. Please.","AnswerCount":3,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":640,"Q_Id":71179346,"Users Score":0,"Answer":"Unity not supported python, But you Can write Python Code and run it by Socket programing, Create Server with python and send data,in C# Connect to server and use data sended with python.","Q_Score":1,"Tags":"python,unity3d","A_Id":72337608,"CreationDate":"2022-02-18T20:11:00.000","Title":"How do to use a python script in Unity?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am in the process of converting a JSON into a dateframe.  One of the items in the JSON is a date in the form of a string.  I am calling the item with the following entry:\nmarkets_json['events'][i]['periods']['num_0']['cutoff']\ni is a position number in a list that is being generated from a ```for`` loop.  The other fields are dictionary keys.  It returns a string that looks something like this:\n2022-02-19T21:08:00Z\nI would like to turn this into some sort of real usable date that I might even be able to adjust the time zone on.  The best I have been able to do are to use datetime.datetime.strptime  or  parser.isoparse but those just creates datetime objects (datetime.datetime(2022, 2, 19, 21, 8, tzinfo=datetime.timezone.utc)) which are not usable to me in the dataframe or I need to know how  make them usable.\nThank you in advance for your help.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":53,"Q_Id":71179651,"Users Score":0,"Answer":"I found my problem.  There were two different time date formats in the JSON.  Some look like 2022-02-19T21:08:00Z and some are like 2022-02-18 07:38:53.110000+00:00.  That was causing an issue with the dataframe conversion.  Thank you for your help.","Q_Score":0,"Tags":"python,json,dataframe,date,datetime","A_Id":71180031,"CreationDate":"2022-02-18T20:44:00.000","Title":"Converting a String to a Usable Date","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have a very big data frame with the orders for some products with a reference. This reference has periodical updates, so for the same product there are a lot of rows in the dataframe. I want to choose the last update for each reference, but i dont know why.\nFor a reference, for example there are 10 updates, for another, 34, so there is not a patron...\nAny ideas?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":22,"Q_Id":71203191,"Users Score":0,"Answer":"you can use func iget like this :\ndf['column'].iget(-1);\nor\ndf.iloc[-1:]","Q_Score":0,"Tags":"python,analysis","A_Id":71203744,"CreationDate":"2022-02-21T08:25:00.000","Title":"how to select the last value in a irregular data frame","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am developing an application on a remote server.\nI'm using Python and am connected via ssh with the specific extension.\nI start debugging and everything seems to proceed normally but suddenly debugging stops and there is no reason (error or warning).\nCan anyone suggest me where to look for the reason or how to trace the problem?\nThe script, executed outside VSCode, runs smoothly.\nThanks in advance.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":35,"Q_Id":71213332,"Users Score":0,"Answer":"in the end I found a possible cause and, therefore, the solution.\nThere is a problem with the sequence of imports and module import for MariaDB.  By moving this import to the head, the problem was solved.","Q_Score":0,"Tags":"python,debugging,visual-studio-code,ssh,exit","A_Id":71430912,"CreationDate":"2022-02-21T21:39:00.000","Title":"VSCode Python SSH - Debug aborted without errors or warnings","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"I have a script that I run locally on my laptop, which polls a server and if certain criteria are met, it sends an email. I guess like a heartbeat app of sorts.\nThe server is a Raspberry Pi, it has a public IP address which is all working fine.\nId like to host the python script on Heroku, so that it can run without my laptop having to be on the local network or always running.\nDoes anyone have experience of Heroku to show me how I can have the script hosted and running constantly?\nMy other query is that free tiers of Heroku go to sleep after 30 mins, so would essentially stop the script until getting an http request and spin up the instance once again.\nTrying to find some form of elegant solution.\nMany thanks for any advice you can give,\nAll the best,\nSimon","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":28,"Q_Id":71214164,"Users Score":1,"Answer":"Different approachs would be:\n1- Cloud Functions\n\nCreate lambda function in a cloud provider with your python code (free tier elegible)\nTrigger that function every once in a while\n\n2- Get VM on Cloud\n\nGo to AWS, GCP, etc\nGet a free tier VM\nRun server from there","Q_Score":0,"Tags":"python,heroku","A_Id":71214221,"CreationDate":"2022-02-21T23:21:00.000","Title":"Heroku - Python integration","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am writing a c++ executable which can call python interface. However, I don't know how to make this executable program find the python interpreter and run it on other people's computers. In other words, in what order does Py_Initialize() find the local python interpreter.","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":47,"Q_Id":71231810,"Users Score":1,"Answer":"Py_Initialize does not need to find the Python interpreter, because it is (part of) the Python interpreter! If you can call Py_Initialize, that means that you have made the Python interpreter part of your own program, so there is nothing more to find.\n(If you linked it as a dynamic library, there is the issue of how dynamic libraries are found at runtime, but that is not specific to Python.)\nExecuting stuff on another computer is a completely different problem from embedding the interpreter.","Q_Score":0,"Tags":"python,c++","A_Id":71232014,"CreationDate":"2022-02-23T05:32:00.000","Title":"How does the Py_Initialize() function find the python interpreter","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have a folder that contains several images, I would then like to display the list of images that have the same name and number (eg: myfile_page1.png, myfile_page2.png, myfile_page2.png,) and then display them in the django template show_file.html","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":14,"Q_Id":71252726,"Users Score":0,"Answer":"You can store file names and paths in databases such sqlite3 or Postgres and then using SQL filter the files path and name you want to fetch. This way you can both show files with similar names and render them accordingly.","Q_Score":0,"Tags":"python,django,django-models,django-templates","A_Id":71254076,"CreationDate":"2022-02-24T13:26:00.000","Title":"how can i manipulate several images in a directory and display them conditionally with django?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Good day,\nI have a python code and this code has the following line at the beginning.\nfrom parfile_parser import Parfile\nI am using ipython (python version 3.7) and the OS is Ubuntu 20.04. The above line gives me an error as below.\n\" No module named 'parfile_parser' \"\nSo, I tried to find this module by googling to install on my desktop, but I could not find it. Do you happen to know how I can install this module and how to solve this problem?\nThanks!","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":24,"Q_Id":71253919,"Users Score":0,"Answer":"You said you tried to install it on a desktop, did you install it in your virtual environment. If not try to install it in your virtual environment and then check.","Q_Score":0,"Tags":"python,python-3.x,linux,installation,module","A_Id":71253997,"CreationDate":"2022-02-24T14:56:00.000","Title":"How to install a python-module 'Parfile'?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"I have a 0.4 KV electrical network and I need to use particle swarm optimization algorithm on it to find the optimal place and size for DGs but I'm new to optimization subject I tried a lot but I couldn't know how to do it could anyone help me with it please","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":17,"Q_Id":71258086,"Users Score":0,"Answer":"From the paper \"Prakash, D. B., and C. Lakshminarayana. \"Multiple DG placements in distribution system for power loss reduction using PSO algorithm.\" Procedia technology 25 (2016): 785-792\", PSO algorithm is given below\nStep 1: Input data such as line impedance, line power.\nStep 2: Calculate voltages at each node and total power loss in the distribution network using forward backward sweep method.\nStep 3: Initialize population size.\nStep 4: Initialize number of particles to be optimized.\nStep 5: Set bus count x=2.\nStep 6: Set generation count y=0.\nStep 7: Generate random position and velocity for each particle.\nStep 8: Calculate power loss for each particle using Active power loss minimization.\nStep 9: Initialize current position of each particle as \u2018Pbest\u2019.\nStep 10: Assign \u2018Gbest\u2019 as best amont \u2018Pbest\u2019.\nStep 11: Update velocity and position of each particle using  velocity and position update equations respectively.\nStep 12: If generation count reaches maximum limit, go to Step 13 or else increase the counter by one and go to Step 7.\nStep 13: If bus count reaches maximum limit, go to Step 14 or else increase the counter by one and go to Step 6.\nStep 14: Display the results.","Q_Score":0,"Tags":"python,matlab,particle-swarm","A_Id":71704199,"CreationDate":"2022-02-24T20:49:00.000","Title":"optimal location of DGs","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I need some help how to write the type hints, and it is not purely technical.\nAs an example, imagine a get_state() function returning the current state as a string.\nThe documentation states the initialize() must be called first and the result of get_state() is undefined prior to initialization. Actually it returns None when uninitialized, but that is an implementation detail.\nThe annotation could be:\n\nget_state() -> str which is correct assuming a proper usage. I find it helpful from the developer's point of view, but mypy complains because it is clear that the return value could be also None.\nget_state() -> str|None which matches the reality the most, but may change in the future and it introduces mypy warnings everywhere the return value is used and is obviously expected to be a string there.\nget_state() -> Any which exactly matches the documented API, but is useless.\n\nSo, who is the main recipient of the information in the annotation? Is it the developer getting additional information when reading the code? Or is it the type checker tool like the mypy that tries to find possible problems?","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":44,"Q_Id":71264160,"Users Score":0,"Answer":"Probably str|None is what you want.\nIn my view, type annotations in Python try to reap some of the same benefits that static type systems bring to languages that have them. Good examples of languages with strong static type systems are Haskell and Rust. In such languages type annotations can never overpromise, like would happen with get_state() -> str. So that possibility is ruled out. get_state() -> str|None happens to be what the code is capable of supporting, so that is one option, and the documentation should probably then reflect that as well. If the developers think that this return type is likely to change or be different on different systems then it could be reasonable to go for a type like Any, but that would also have implications for how this function should be used. If all you know about this function is that it could return Any(thing) then what exactly can you do with this value? You could test whether it is a string and then use it as a string, but is that the way recommended in the documentation? If yes then the Any type is reasonable, if not then not.","Q_Score":1,"Tags":"python,python-typing","A_Id":71264351,"CreationDate":"2022-02-25T10:04:00.000","Title":"annotation for the documentation differs from the annotation for the type checking","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I need some help how to write the type hints, and it is not purely technical.\nAs an example, imagine a get_state() function returning the current state as a string.\nThe documentation states the initialize() must be called first and the result of get_state() is undefined prior to initialization. Actually it returns None when uninitialized, but that is an implementation detail.\nThe annotation could be:\n\nget_state() -> str which is correct assuming a proper usage. I find it helpful from the developer's point of view, but mypy complains because it is clear that the return value could be also None.\nget_state() -> str|None which matches the reality the most, but may change in the future and it introduces mypy warnings everywhere the return value is used and is obviously expected to be a string there.\nget_state() -> Any which exactly matches the documented API, but is useless.\n\nSo, who is the main recipient of the information in the annotation? Is it the developer getting additional information when reading the code? Or is it the type checker tool like the mypy that tries to find possible problems?","AnswerCount":2,"Available Count":2,"Score":-0.0996679946,"is_accepted":false,"ViewCount":44,"Q_Id":71264160,"Users Score":-1,"Answer":"These annotations are mostly for the developer as they don't affect runtime. That said, the type checker is also there to make your life easier. So if any of these are making it harder for you don't have to use them...\nAnd more practically, can you return an empty sting ('') instead of None?","Q_Score":1,"Tags":"python,python-typing","A_Id":71264229,"CreationDate":"2022-02-25T10:04:00.000","Title":"annotation for the documentation differs from the annotation for the type checking","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have very little experience in manipulating pdfs using python, and my experience is restricted only to reading using 'pdfreader' a python library. I have a pdf, (which in this case is a past exam paper), I want it to split a page when it encounters a question number, let's say 12 for this example (it would be formatted \"12.\"), and save the split part containing the number 12. in a new pdf. How do I do this?\nI'm not a very good programmer so sorry if my question is stupid, but searching on the internet I could not find how to do this.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":43,"Q_Id":71268927,"Users Score":0,"Answer":"The solution at the end was to transform the pdf page into an image, crop it where I want it, then back to a pdf. To get the coordinates I had to use pdf miner, to then get the pixels to modify the image I had to make a proportion between the height of the page in pdf coordinates and the height of the image I wanted to create in pixels, so then I could transform the coordinates of one into the coordinates of the other.","Q_Score":0,"Tags":"python,python-3.x,pdf,pdf-generation,crop","A_Id":71423984,"CreationDate":"2022-02-25T16:35:00.000","Title":"How do I get a specific part of a page in a pdf and save it to a new pdf in python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am coding kivy app on PC. At the end, I will convert it to .apk on my android phone (redmi note 9 pro). Which window size should I choose? It will be easier to code with this specific window size (add buttons and text on specific place).\nAnd how to do it. Because I heard that using window.size is not good\/not working.\nThanks","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":48,"Q_Id":71284215,"Users Score":0,"Answer":"It's usually a better idea not to code for a specific window size, but to code the gui in such a way that regardless of the window size it tries to do something sensible. For instance, your app might have a navigation bar at the top that is always 40dp high, then the rest of the app is taken up by something else that grows to fill all the available space.\nYou can code the whole gui to a fixed size if you want of course, but it probably isn't the best solution.","Q_Score":0,"Tags":"python,android,kivy","A_Id":71287391,"CreationDate":"2022-02-27T11:06:00.000","Title":"Kivy window size for mobile","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am using coc.nvim in neovim together with Pylint.\nIf I try to import my own module e.g. src.reverse_linked_list or an installed module like selenium, CoC displays the error message\n[pylint E0401] [E] Unable to import 'xxxxx' (import-error)\ndouble checked that init.py is in my directories\nRunning the code does not lead to any errors\nDoes anyone know how to fix this?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":161,"Q_Id":71291601,"Users Score":0,"Answer":"The python path need to be the same when running pylint inside neovim vs when running the code. The import using src.reverse_linked_list is suspicious in this regard, src is not generally used in the import.","Q_Score":0,"Tags":"python,pylint,neovim","A_Id":71292862,"CreationDate":"2022-02-28T07:10:00.000","Title":"PyLint not recognizing modules but code runs fine","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"I am currently writing a python file that is meant to be run through the command line like pip and npm, but I also need to know when the user launches it directly through the file explorer (as in windows). Is this completely impossible (restricted to the program only knowing that it's run with no sys.argv arguments), or is there a way to make the program differentiate if it's being run directly through something like  the file explorer, or if it's being run through the command line? Thanks!","AnswerCount":3,"Available Count":1,"Score":0.0665680765,"is_accepted":false,"ViewCount":55,"Q_Id":71297138,"Users Score":1,"Answer":"Be sure to capture the user's operating system first before implementing a Windows specific approach.","Q_Score":0,"Tags":"python","A_Id":71297572,"CreationDate":"2022-02-28T15:16:00.000","Title":"how can you know if the python file is run directly and not from the command line?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I was asked to make an animation using python, and I was thinking to animate an object making a circular path in uniform motion, but it would be really great if the plane of the circular motion also changes constantly over time (like those oversimplified atom animations), so I tried to figure some parametric equation using spherical coordinates, but I landed on differential equations something that I was supposed to learn next year. Does anyone know how to parameterize this kind of motion?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":46,"Q_Id":71302001,"Users Score":0,"Answer":"For the orientation of the plane, you could use latitude and longitude of the normal vector, with a third parameter to describe the angle along the circular path. In order to get cartesian coordinates you will need to figure out the transformation (x, y, z) = f(latitude, longitude, rotation). There are no differential equations involved, just a lot of sin() and cos().","Q_Score":0,"Tags":"python,animation,math","A_Id":71302280,"CreationDate":"2022-02-28T23:04:00.000","Title":"Modeling a circular trajectory with the plane of the circle changing over time","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have entered a string as:\nstr_data = 'Hi'\nand then I converted the string to binary using format() as:\nbinarystr = ''.join(format(ord(x),'b') for x in str_data)\nNow, I want to convert binary string back to my original string. Is it possible to do so in Python? If yes, then how to do that?\nI know chr() gives character corresponding to the ascii value but how to use it with binary string?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":51,"Q_Id":71311082,"Users Score":0,"Answer":"2 approaches: assuming a fix length for your source string (7 binary entries) or allowing a flexible length\nfix length (standard alphabet)\nHere we assume that all the binary mapped from a chr entry have always 7 entries (quite standard).\nsplit_source = [''.join(x) for x in zip(*[iter(binarystr)]*7)]\nstr_data_back = ''.join([chr(int(y, 2)) for y in split_source])\nflexible length (more general, but maybe useless)\nYou need to add a separator when you create binarystr\nE.g. binarystr = '-'.join(format(ord(x),'b') for x in str_data)\notherwise it is not possible to say what was from where.\nBy adding the -, you can reconstruct the str_data with:\nstr_data_back = ''.join([chr(int(x, 2)) for x in binarystr.split('-')])","Q_Score":0,"Tags":"python-3.x","A_Id":71311453,"CreationDate":"2022-03-01T15:45:00.000","Title":"How to convert a binary String to Original String","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"For my college project, I'm developing an application that analyzes\/detects anomalies in videos.\nThe backend is Python and the frontend is JS\/NodeJS. I setup the backend so it runs 4 ML models and writes the outputs to 4 separate .txt files. I created a JS file that reads the .txt files and reformats the data to be saved as 4 .json files. Currently, the frontend just reads the .json files and displays the data... I run npm start to display the application in the browser at localhost:3000. Here is my problem:\nIn the application, the user can upload a .mp4 file and watch the video (react-player). I think I can setup a button interaction to execute a script that runs the backend .py file. However, I don't know how to continue from there. I need to exchange data twice: First, I need to download the video to the .py file local directory as input to the ML models. Once the models have finished running, I need to\ntransfer the outputs (Python list or .json format... I know how to do either) back to the application so it can be displayed to the user.\nI'm reading online that I can execute data transfer using jquery and\/or ajax calls? Or maybe I setup a database? I have 0 experience w\/ any of that so I'd like advice on the easiest approach. If you can recommend resources that can help me learn more on the topic, that'd also be helpful.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":46,"Q_Id":71314500,"Users Score":0,"Answer":"You can use WebSocket to transfer the files, initially after sending the video to the backend there would be quite a bit of delay for the ML model to process it and come up with the output JSON files, WebSocket would make it easier to make this communication.\n(I'm not saying it's not possible to use a rest API to do the same, but it would be easier to use WebSockets)","Q_Score":0,"Tags":"javascript,python,node.js,reactjs","A_Id":71342959,"CreationDate":"2022-03-01T20:49:00.000","Title":"Transferring data through localhost?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am trying to create a python program for my Casio fx-9750GIII calculator that computes the molar mass of a given chemical formula. To do this I need more methods for strings from curses.ascii such as isalpha. Unfortunately I don't know how modules work on a non-networked device. Do I just need to download a file and put it on the calculator for an import statement to work or is there something else I need to do?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":66,"Q_Id":71315099,"Users Score":0,"Answer":"As the commenter Lecdi said, it is a native python string method, I just made the mistake of typing isalpha() without a string beforehand.","Q_Score":0,"Tags":"python,python-3.x,calculator","A_Id":71316096,"CreationDate":"2022-03-01T22:00:00.000","Title":"Python Modules on a Calculator","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"When starting IDA in GUI mode to analyze the binary, it automatically locates and displays the actual main function code (not the entry point encapsulated by the compiler, but the main function corresponding to the source code).\nMy question is how to get that address in batch mode (without GUI) via idapython script? I don't see the relevant interface in the IDAPython documentation.\nFor example, _mainCRTStartup --> ___mingw_CRTStartup --> _main is a sequence of function calls, where _mainCRTStartup is the entry point of the binary, but I want to get the address of _main, can it be done?\nAny help or direction would be much appreciated.!","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":96,"Q_Id":71319464,"Users Score":0,"Answer":"Know the answer, it is idaapi.inf_get_main()","Q_Score":1,"Tags":"python,ida","A_Id":71566465,"CreationDate":"2022-03-02T08:23:00.000","Title":"How to get the actual main address use idapython when starting IDA in batch mode?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have imported data from excel to python and now want to draw multiple plots on a single figure but for that I will need separate variables like 'x' & 'y' etc because we know that plt.plot(x,y), basically I have two datasets in which I am doing Time series analysis. In first data set I have Monthly+Yearly data in which I combined both columns and formed one column having name Year-Month, In second dataset I have Daily+Yearly data in which I formed one column by merging both and named it as Year-Daily. Now the dependent variable in both datasets is the number of sunspots.\n\nNow I want to Plot Daily and Monthly sunspot numbers on a single Graph in Python, so how will I do that?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":34,"Q_Id":71327624,"Users Score":0,"Answer":"What is the library that are you using to import the data?","Q_Score":0,"Tags":"python,jupyter-notebook,time-series,jupyter","A_Id":71327904,"CreationDate":"2022-03-02T18:37:00.000","Title":"Imported data from excel and assigning variables in python","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Dear Stackoverflow community. I need to know how to build a GeoJson map that allows me to draw a polygon and add the coordinates of this drawed polygon to a python list or a json file.\nI have been reading all kind of documentation but I didn\u00b4t find anything like I\u00b4m searching.\nIf anybody could help me with code or specific documentation, I would be great for me!!!!!\nThanks a lot.\nPablo.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":244,"Q_Id":71336442,"Users Score":0,"Answer":"Ok, let me explain you with an example.\n\nYou have a common map made it with folium. Now I need to know how to do the next two points:\nI need to know how click on the map and \u201cdraw\u201d a polygon or shape.\nI can \"draw\" the polygon or any shape, but with a python script specifying the coordinates (latitude and longitude). I don't want that, I want to draw the polygon by clicking on the map.\nFinally, I want the polygon coordinates to be automatically added to a python list or a json script.\n\nI hope I was clear explaining the problem.","Q_Score":1,"Tags":"python,json,list,polygon,geojson","A_Id":71351551,"CreationDate":"2022-03-03T11:30:00.000","Title":"Draw a GeoJson map polygon and extract the coordinates to a python list or a json file","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":1,"ERRORS":0,"REVIEW":0},{"Question":"I'm building a basic Instagram bot, and it got me wondering, how could I get to auto-run at a certain time, or when a certain condition is satisfied (eg. when there's a new file in a folder)?\nHelp much appreciated.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":26,"Q_Id":71342166,"Users Score":1,"Answer":"make a while loop and check your condition each time, suggest you to put some kind of sleep (eg. asynco.sleep() or time.sleep()) and if the condition is true then run the bot","Q_Score":0,"Tags":"python,selenium,selenium-webdriver,automation,bots","A_Id":71343448,"CreationDate":"2022-03-03T18:37:00.000","Title":"How can I get bot to auto-run at a certain time, or when a certain condition is satisfied?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have a python script that previously worked but that now throws the error:ImportError: DLL load failed while importing _gdal: The specified module could not be found. I am trying to upload a shapefile using fiona and originally the message read: ImportError: DLL load failed while importing _fiona: The specified module could not be found. I am using anaconda navigator as my IDE on windows 11.\nI am aware that this is a question that has been asked before and I have read the answers to those questions. The solutions, however, hove not worked either due to my circumstance or my misinterpretation and action in following through with it. So my question is either how do I fix this, or, if it is not that simple, to better understand the problem.\nI have looked inside the DLLs folder within the environment folder that I am using and there is nothing in there with name fiona, gdal or geopandas.\nMy attempts so far:\n1. uninstall and re-install fiona gdal and geopandas (as I believe they are dependent).\n2. update all libraries and anaconda to latest verions.\n3. download Visual C++ Redistributable for Visual Studio 2015. Ran into issue during download as it was already installed on my computer, likely because it is a windows computer. Is it possible that this would help if i moved it to a different path\/folder?\n4. Uninstall and re-install anaconda navigator on cumputer. Re-create virtual environemt and import necessary libraries. result: error in line: import geopandas as gpd: ImportError: DLL load failed while importing _datadir: The specified module could not be found.\nIf there is a fix that I have not mentioned or if you suspect that I attempted one of the above fixed incorrectly because  of my limited understanding of how python libraries are stored please make a suggestion!\nThank you","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":449,"Q_Id":71344780,"Users Score":1,"Answer":"I was struggling badly with the same problem for the last couple of days. Using conda, I've tried everything I found on the internet such as:\nconda update gdal\nconda update -n base -c defaults conda   \nCreating new environments (over and over again).\nDespite it's not recommended I even tried it with     pip install... but no results.\nAt the end what worked for me was to create a new environment with Python version 3.6\nconda create -n env python=3.6 gdal spyder   \nLet me know if it worked.","Q_Score":0,"Tags":"python,dll,package,conda,dllimport","A_Id":71396790,"CreationDate":"2022-03-03T22:59:00.000","Title":"ImportError: DLL load failed while importing _gdal: The specified module could not be found","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"I want to make a calculator for my data.\nBasically I have multiple measurements in different .csv files that are named as their physical representation (temperature_1, current_1, voltage_1 ecc.) and I am trying to make a calculator in python that given a certain expression [e.g. (current_1 * voltage_1) + (current_2 * voltage_2)] is able to load the data from each file and evaluates the result of the expression on the dataframes.\nI already made simple functions in order to sum, subtract, multiply and divide dataframes but I am stuck on how to handle complex expressions like the sum of many multiplications [e.g. (current_1 * voltage_1) + (current_2 * voltage_2) + (current_3 * voltage_3) ecc.].\nI tried to use a parser but still got no result.\nSomebody has any idea on how to handle this?\nNote: all the .csv have 2 columns, time and measurement, the number of rows are the same and the acquisition time is at the same timestamp.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":18,"Q_Id":71350849,"Users Score":0,"Answer":"I have solved the issue. For anybody who will need similar functions i report here the solution in steps\n\nWrite your equation with the name of your files. E.g. current_1 * voltage_1 (you need file current_1.csv, voltage_1.csv)\n\nparse your equation with any parser. I used py_expression_eval.\n\nExtract the variables from the equation (variables = parser.parse(equation).variables())\n\niterate over the variables and at each step:\n\nload the data in a dataframe\ninsert the column of the measurement in general dataframe\nchange the name of that column to the name of your file (e.g. current_1)\n\nby doing this you will obtain a dataframe with columns: time, measurement_1, measurement_2 ecc.\n\nUse df.eval('result= ' + expression, inplace=True) to evaluate your initial expression using the columns you have added to the general dataframe\n\n\nHope this helps somebody","Q_Score":0,"Tags":"python,dataframe,calculator","A_Id":71351112,"CreationDate":"2022-03-04T11:35:00.000","Title":"Calculator for Dataframes","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have the following data frame structure:\n\n\n\n\nid_trip\ndtm_start_trip\ndtm_end_trip\nstart_station\nend_station\n\n\n\n\n1\n2018-10-01 10:15:00\n2018-10-01 10:17:00\n100\n200\n\n\n2\n2018-10-01 10:17:00\n2018-10-01 10:18:00\n200\n100\n\n\n3\n2018-10-01 10:19:00\n2018-10-01 10:34:00\n100\n300\n\n\n4\n2018-10-01 10:20:00\n2018-10-01 10:22:00\n300\n100\n\n\n5\n2018-10-01 10:20:00\n2018-10-01 10:29:00\n400\n400\n\n\n\n\nAnd I would like to check, using python, how often a trip starts and ends in a given season. The idea was to do these average intervals per day, per hour and then in intervals of a few minutes.\nWhat would be the best approach to doing this?\nMy desired output would be something to inform  eg: for station 100 on 2018-10-01, a travel starts, on average, every 4 minutes","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":50,"Q_Id":71380793,"Users Score":0,"Answer":"In order to do that you could group your DataFrame by different travels. Firstly, I would make a new column with a travel id, so travels starting and ending in the same stations can be grouped.\nThen you can easily group those rows by travel id and get all the information you need.\nPlease note that your data sample does not include any \"same travel\". Also, consider providing a code sample for your data, it would be easier for us to work with and run tests.","Q_Score":0,"Tags":"python,pandas,dataframe","A_Id":71380893,"CreationDate":"2022-03-07T12:03:00.000","Title":"Check average travel intervals for each station - pyhton","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am collecting time series data, which can be separated into \"tasks\" based on a particular target value. These tasks can be numbered based on the associated target. However, the lengths of data associated with each task will differ because it may take less time or more time for a \"task\" to be completed. Right now in MATLAB, this data is separated by the target number into a MATLAB cell, which is extremely convenient as the analysis on this time-series data will be the same for each set of data associated with each target, and thus I can complete data analysis simply by using a for loop to go through each cell in the cell array. My knowledge on the closest equivalent of this in Python would be to generate a ragged array. However, through my research on answering this question, I have found that automatic setting of a ragged array has been deprecated, and that if you want to generate a ragged array you must set dtype = object. I have a few questions surrounding this scenario:\n\nDoes setting dtype=object for the ragged array come with any inherent limitations on how one will access the data within the array?\n\nIs there a more convenient way of saving these ragged arrays as numpy files besides reducing dimensionality from 3D to 2D and also saving a file of the associated index? This would be fairly inconvenient I think as I have thousands of files for which it would be convenient to save as a ragged array.\n\nRelated to 2, is saving the data as a .npz file any different in practice in terms of saving an associated index? More specifically, would I be able to unpack the ragged arrays automatically based on a technically separate .npy file for each one and being able to assume that each set of data associated with each target is stored in the same way for every file?\n\nMost importantly, is using ragged arrays really the best equivalent set-up for my task, or do I get the deprecation warning about setting dtype=object because manipulating data in this way has become redundant and Python3 has a better method for dealing with stacked arrays of varying size?","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":25,"Q_Id":71397763,"Users Score":1,"Answer":"I have decided to move forward with a known solution to my problem, and it seems to be adapting well.\nI organize each set of separate data into it's own array, and then store them in a sequence in a list as I would with cells in MATLAB.\nTo save this information, when I separated out the data I stored the subsequent index value in a list. By this I mean that:\n\nI identify the location of the next separate set of data.\nI copy the data up until that index value into an array that is appended to a list.\nI store the index value that was the start of the next separate set of data.\nI delete that information from a copy of my original array.\nI repeat steps 1-4 until there is only one uniquely labelled sequence of data left. I append this set of data. There is no other index to record. Therefore the list of indices is equal to the length of the list of arrays -1.\nWhen saving data, I take the original array and save it in a .npz file with the unpacking indices.\nWhen I want to use and reload the data into it's separate arrays for analysis, I can 'pack' and 'unpack' the array into it's two different forms, from single numpy array to list of numpy arrays.\n\nThis solution is working quite well. I hope this helps someone in the future.","Q_Score":0,"Tags":"python-3.x,deprecated,data-management,ragged","A_Id":71588373,"CreationDate":"2022-03-08T15:46:00.000","Title":"Python: Is there a better way to work with ragged arrays than a list of arrays with dtype = object?","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I want to make a binary classifier that classifies the following:\nClass 1. Some images that I already have.\nClass 2. Some images that I create from a function, using the images of class 1.\nThe problem is that instead of pre-creating the two classes, and then loading them, to speed up the process I would like the class 2 images to be created for each batch.\nAny ideas on how I can tackle the problem? If I use the DataLoader as usual, I have to enter the images of both classes directly, but if I still don't have the images of the second class I don't know how to do it.\nThanks.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":29,"Q_Id":71399540,"Users Score":1,"Answer":"You can tackle the problem in at least two ways.\n\n(Preferred) You create a custom Dataset class, AugDset, such that AugDset.__len__() returns 2 * len(real_dset), and when idx > len(imgset), AugDset.__getitem__(idx) generates the synthetic image from real_dset(idx).\nYou create your custom collate_fn function, to be passed to DataLoader that, given a batch, it augments it with your synthetic generated images.","Q_Score":0,"Tags":"python,pytorch","A_Id":71400516,"CreationDate":"2022-03-08T17:57:00.000","Title":"How can I create images for each batch using Pytorch?","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"After learning how to code Python I'm starting to learn and figure out how to structure projects and set virtual environments up, but I can't make my mind up on how are packages managed when the virtual environment is activated. To make an example: I want to make a Django project. So, first of all, mkdir the project folder, cd into it and then execute python -m venv [whatever]. cd into Scripts folder and execute 'activate'. Then, pip install Django and pip list and shows Django. At last, I deactivate the virtual environment and make pip list again. Why is Django listed there? Should it?","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":45,"Q_Id":71402468,"Users Score":0,"Answer":"You might have installed Django both inside and outside the venv (outside being the system python installation). Deactivate the venv and run pip uninstall django then try again.","Q_Score":0,"Tags":"python,pip,python-venv","A_Id":71402661,"CreationDate":"2022-03-08T23:04:00.000","Title":"How does pip work under virtual environments?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"After learning how to code Python I'm starting to learn and figure out how to structure projects and set virtual environments up, but I can't make my mind up on how are packages managed when the virtual environment is activated. To make an example: I want to make a Django project. So, first of all, mkdir the project folder, cd into it and then execute python -m venv [whatever]. cd into Scripts folder and execute 'activate'. Then, pip install Django and pip list and shows Django. At last, I deactivate the virtual environment and make pip list again. Why is Django listed there? Should it?","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":45,"Q_Id":71402468,"Users Score":0,"Answer":"Okay, finally I understood what was happening and I didn't realize. On one hand, virtual environments are completely independent from the global or system, so what is being installed in one side it shouldn't affect the other. On the other hand, what happened was, that for being inside the Scripts folder, when trying to execute Python commands I was actually executing the scripts with the same name, which are copies to use with the virtual environment and which can be used calling the \"activate\" script. There was actually no problem, it was me messed up.\nThanks to all contributors for their help.","Q_Score":0,"Tags":"python,pip,python-venv","A_Id":71416871,"CreationDate":"2022-03-08T23:04:00.000","Title":"How does pip work under virtual environments?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have trained a Scikit Learn model in Python environment which i need to use it for inference in GoLang. Could you please help me how can i export\/save my model in python and then use it back in GoLang.\nI found a solution for Neural Network model where i can save Tensorflow model in ONNX format and load it using Onnx-go in GoLang. But this is specific for Neural Network models. But I am unable to figure it out for scikit-learn models.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":241,"Q_Id":71403705,"Users Score":0,"Answer":"You can develop an REST json API service to expose your scikit-learn model and  communicate with go client.","Q_Score":0,"Tags":"python,go,scikit-learn","A_Id":71403744,"CreationDate":"2022-03-09T02:38:00.000","Title":"How to use trained Scikit Learn Python model in GoLang?","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I want to train my YOLOv4 detector on 5 classes [Person,Car,Motorcycle,Bus,Truck]. I used around 2000 images for training and 500 for validation.\nThe dataset I used is from OID or from COCO.\nThe main problem is that, when the training is over, the detector finds only one class in the image every time. For example, if it's a human in a car, it returns only the Car or the Person bounding box detection.\nI saw that the .txt annotation on every image is only for one class.\nIt's difficult to annotate by myself 10.000 images.\nAll the tutorials usually detect only one class in the image.\nAny ideas on how to train my model on all 5 classes?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":97,"Q_Id":71406898,"Users Score":0,"Answer":"i finally found the solution.\nThe problem was that OID dataset downloads images with one specific class, like person, car etc.\nAS Louis Lac mentioned i must train my model on dataset with all relevant classes","Q_Score":0,"Tags":"python,object-detection,training-data,yolo","A_Id":71496500,"CreationDate":"2022-03-09T09:17:00.000","Title":"Train multi classes object detector (YOLOv4)","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"My yolov5 model was trained on 416 * 416 images. I need to detect objects on my input image of size 4008 * 2672. I split the image into tiles of size 416 * 416 and fed to the model and it can able to detect objects but at the time of stitching the predicted image tiles to reconstruct original image, I could see some objects at the edge of tiles become split and detecting half in one tile and another half in another tile, can someone tell me how to made that half detections into a single detection in the reconstruction.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":128,"Q_Id":71407415,"Users Score":0,"Answer":"Running a second detection after offseting the tiles split would ensure that all previously cut objects would be in a single tile (assuming they are smaller than a tile). Maybe you could then combine the two results to get only the full objects","Q_Score":0,"Tags":"python,opencv,computer-vision,object-detection,yolov5","A_Id":71407894,"CreationDate":"2022-03-09T09:55:00.000","Title":"Detect Objects on high resolution image by splitting the image into tiles and reconstruct the tiles into single image","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have made an application using python using some libraries installed as needed on the go. Now I want to make it usable for person who doesn't know how to install dependencies and which ones are needed.\nWhat to do to transform it into an easy to use application and probably make it able to run on Mac too??\nPlease suggest some resources that might help me know more.","AnswerCount":3,"Available Count":1,"Score":0.0665680765,"is_accepted":false,"ViewCount":285,"Q_Id":71408434,"Users Score":1,"Answer":"As Wouter K mentioned, you should install Pyinstaller (pip install pyinstaller for pip) and then cd to the directory you want and type pyinstaller --onefile file.py on the terminal. If you cded in the directory your file is, you just type the name and the extension (.py) of your file. Else, you will have to specify the full path of the file. Also, you can't make an mac os executable from a non mac os pc. You will need to do what I mentioned above on a mac.","Q_Score":1,"Tags":"python,dependency-management,.app","A_Id":71408912,"CreationDate":"2022-03-09T11:14:00.000","Title":"How to make a Python exe file automatically install dependancies?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Having trouble getting Pandas data reader to retrieve price quotes from Yahoo\u2019s API. The most up to date answer seems to be:\n\n\"pip install --upgrade pandas pip install --upgrade pandas-datareader\n\nHowever, for the time being I will be using Google Collab and its Python platform, does anyone know how to update the pandas here? Or has the API truly just been discontinued?","AnswerCount":3,"Available Count":1,"Score":0.0665680765,"is_accepted":false,"ViewCount":184,"Q_Id":71414673,"Users Score":1,"Answer":"In Colab you need to put a ! before pip","Q_Score":0,"Tags":"python,pandas,finance,yahoo-api","A_Id":71414712,"CreationDate":"2022-03-09T18:57:00.000","Title":"Python, Pandas, Yahoo Finance API","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Normally when I would click on \"Run\" button in VSCode for a Python script it would activate the currently selected virtual environment and simply call python <script_name.py> in the terminal and it all worked fine.\nNow all of a sudden every time I try to run a script what is does is instead call a subprocess via conda like so:\nconda run -n <environment_name> --no-capture-output --live-stream python <script_name.py>\nAnd this new version is causing some issue because for whatever reason conda refuses to recognise some of the packages as having been installed. The code still works fine when I manually type the run command in the terminal but I want the old behaviour to be back.\nAnyone knows how to fix this?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":71,"Q_Id":71419174,"Users Score":0,"Answer":"Input: Ctrl + Shift + P .\nEnter: Terminal: select default profile .\nChange the default to CMD .\nMaybe this can help you.","Q_Score":0,"Tags":"python,visual-studio-code,conda","A_Id":71419633,"CreationDate":"2022-03-10T05:16:00.000","Title":"VSCode suddenly started executing Python scripts as a subprocess","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"i am learning how to use coverage package for evaluating which statements in django\/python application are covered by unit tests and which are not. I ran command:\ncoverage run --source \"APP\" manage.py test && coverage report && coverage html\n, which created htmlcov folder and multiple html-files inside it. Each file corresponds to the .py file, however in the beginning of each file-name , i see a strange prefix, something like this: \"d_10d11d93a0707d03_example_py.html\" instead of expected \"example_py.html\". I wasn't able to google any explanations to this. Please help if you know why is this happening and how to avoid this prefix if at all possible.\nThanks!","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":70,"Q_Id":71430001,"Users Score":0,"Answer":"The prefix is there so that same-named files in different directories won't collide.  There isn't a way to avoid the prefix.  You should open the htmlcov\/index.html file, and navigate from there.","Q_Score":0,"Tags":"python,django,code-coverage","A_Id":71442919,"CreationDate":"2022-03-10T19:51:00.000","Title":"Coverage html report in django python application created htmlcov folder with files, however each file has strange prefix","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have two questions:\n\nIs it possible to increase somehow size of the icon in tkinter? Because the icon choosen by me is not clear visible when I use root.iconbitmap(..).\nI also have another icon, but it's black and is not visible on black taskbar. What can I do?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":117,"Q_Id":71449956,"Users Score":0,"Answer":"I don't believe it's possible to change the size of the icon, unfortunately. However, make sure that the icon your using is a .ico file not some other format. .ico files show up bigger and clearer than other formats.\nAs for the black icon problem, the color of the taskbar is determined by your Windows color settings. There isn't much you can do other than to make an icon that works for both dark and light colors. Although you could get rid of the default taskbar and make your own taskbar in tkinter with whatever colors you would like, if that's something you would like to undertake.","Q_Score":0,"Tags":"python,tkinter","A_Id":71451702,"CreationDate":"2022-03-12T13:07:00.000","Title":"Tkinter - how to change icon size or make black icon visible","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"When trying to write script with python, I have a fundamental hole of knowledge.\nUpdate: Thanks to the answers I corrected the word shell to process\/subprocess\nNomenclature\n\nStarting with a Bash prompt, lets call this BASH_PROCESS\nThen within BASH_PROCESS I run python3 foo.py, the python script runs in say PYTHON_SUBPROCESS\nWithin foo.py is a call to subprocess.run(...), this subprocess command runs in say `SUBPROCESS_SUBPROCESS\nWithin foo.py is subprocess.run(..., shell=True), this subprocess command runs in say SUBPROCESS_SUBPROCESS=True\n\nTest for if a process\/subprocess is equal\nSay SUBPROCESS_A starts SUBPROCESS_B. In the below questions, when I say is SUBPROCESS_A == SUBPROCESS_B, what I means is if SUBPROCESS_B sets an env variable, when it runs to completion, will they env variable be set in SUBPROCESS_A? If one runs eval \"$(ssh-agent -s)\" in SUBPROCESS_B, will SUBPROCESS_A now have an ssh agent too?\nQuestion\nUsing the above nomenclature and equality tests\n\nIs BASH_PROCESS == PYTHON_SUBPROCESS?\nIs PYTHON_SUBPROCESS == SUBPROCESS_SUBPROCESS?\nIs PYTHON_SUBPROCESS == SUBPROCESS_SUBPROCESS=True?\nIf SUBPROCESS_SUBPROCESS=True is not equal to BASH_PROCESS, then how does one alter the executing environment (e.g. eval \"$(ssh-agent -s)\") so that a python script can set up the env for the calller?","AnswerCount":2,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":83,"Q_Id":71456175,"Users Score":2,"Answer":"None of those equalities are true, and half of those \"shells\" aren't actually shells.\nYour bash shell is a shell. When you launch your Python script from that shell, the Python process that runs the script is a child process of the bash shell process. When you launch a subprocess from the Python script, that subprocess is a child process of the Python process. If you launch the subprocess with shell=True, Python invokes a shell to parse and run the command, but otherwise, no shell is involved in running the subprocess.\nChild processes inherit environment variables from their parent on startup (unless you take specific steps to avoid that), but they cannot set environment variables for their parent. You cannot run a Python script to set environment variables in your shell, or run a subprocess from Python to set your Python script's environment variables.","Q_Score":1,"Tags":"python,linux,process,subprocess","A_Id":71456241,"CreationDate":"2022-03-13T11:12:00.000","Title":"Python, the relationship between the bash\/python\/subprocess processes (shells)?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm a python newbie and am using The Python Bible 7 in 1 written by Florian Dedov to learn.\nI've been doing well but I've hit a barrier with list functions as described in the book and would like help.\nI can't figure out how to use the list(element) function in the book it is described as typecasts element into list.\nMy attempt and error have been as follows\nnumbers= [10,22,61,29]\nprint(numbers(29))\nwhich gives me type error 'list' object is not callable\nHow would you use this function properly?","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":46,"Q_Id":71460681,"Users Score":1,"Answer":"print(numbers(29)) needs to be print(numbers[29])\nThe round brackets (i) are asking the interpreter to call a function with argument iand square brackets [i] is looking for index i in an object with indexes such as a list.","Q_Score":1,"Tags":"python,python-3.x,python-2.7","A_Id":71460962,"CreationDate":"2022-03-13T20:42:00.000","Title":"How would I go about using the list(element) function? How would you use this function?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":1,"ERRORS":1,"REVIEW":0},{"Question":"I am quite new in Airflow. However I tried to delete some DAGs in airflow (manually; using just bottom) ,but after deletion I got message (so the physically DAG do not exist anymore)\nBroken DAG: [\/usr\/local\/airflow\/dags\/reports_general\/templates\/data_quality_report_airflow__.py] Invalid control character at: line 2 column 116 (char 118)\nAnyone has idea how to resolve?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":47,"Q_Id":71460988,"Users Score":0,"Answer":"You have to delete the .py dag file from the dag storage volume and then also from the UI. In the version we use the UI only deletes the data for that dag from the metadata db.","Q_Score":0,"Tags":"python,airflow","A_Id":71488988,"CreationDate":"2022-03-13T21:26:00.000","Title":"delete Airflow DAG","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Not able to figure out how i can get rid of '' character. I have tried few things but it didnt work out for me.\nI think postgressql changes json string like that.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":28,"Q_Id":71470723,"Users Score":0,"Answer":"I do realize now that the back slash is a representation and its not coming when i am posting the data. .\nThanks for taking the time to contribute an answer. It\u2019s because of helpful peers like yourself that we\u2019re able to learn together as a community :)","Q_Score":0,"Tags":"python,json,sqlalchemy,graphql","A_Id":71538497,"CreationDate":"2022-03-14T16:00:00.000","Title":"'\\' character is getting added when executing in graphql","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"So you know how all coding languages usually have a terminal command to run it, like this:\npython3 main.py\nAnd then it runs whatever is in 'main.py'? I'm trying to make something similar to that, except it's for txt files, so when you run:\nCUSTOM greeting.txt\nIt will tell Python to read everything in greeting.txt, so if 'Hello' is in greeting.txt, and you run CUSTOM greeting.txt, it will print out 'Hello' in terminal. Any help is appreciated!","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":27,"Q_Id":71473284,"Users Score":0,"Answer":"In your example case, alias CUSTOM=cat in your shell to have cat do the heavy lifting, but in general, yeah, just like Python or any other program can read command line arguments, so could your hypothetical interpreter.\nIf you were to implement your language in Python, I'd tell you to look at sys.argv...","Q_Score":0,"Tags":"python,shell","A_Id":71473334,"CreationDate":"2022-03-14T19:34:00.000","Title":"Is there a way to make your own custom terminal command via .sh and .py?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I want to regex a list of URLs.\nThe links format looks like this:\nhttps:\/\/sales-office.ae\/axcapital\/damaclagoons\/?cm_id=14981686043_130222322842_553881409427_kwd-1434230410787_m__g_&#038;gclid=Cj0KCQiAxc6PBhCEARIsAH8Hff2k3IHDPpViVTzUfxx4NRD-fSsfWkCDT-ywLPY2C6OrdTP36x431QsaAt2dEALw_wcB\nThe part I need:\nhttps:\/\/sales-office.ae\/axcapital\/damaclagoons\/\nI used to use this:\nre.findall(':\/\/([\\w\\-\\.]+)', URL)\nHowever, it gets me this:\nsales-office.ae\nCan you help, please?","AnswerCount":4,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":45,"Q_Id":71488504,"Users Score":0,"Answer":"Based on your example, this looks like it would work:\n\\w+:\/\/\\S+\\.\\w+\\\/\\S+\\\/","Q_Score":0,"Tags":"python,regex","A_Id":71488596,"CreationDate":"2022-03-15T20:19:00.000","Title":"how to regex this link?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I want to create a python form with a textfiled and a button where a user will enter his\/her link and it will create a webview flutter apk for that url. I want advice from the community if it is possible or not. If it is possible, please let me know how can I achieve it.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":22,"Q_Id":71503709,"Users Score":0,"Answer":"Maybe you can achieve this via using a remote server. You can create a connection between your python program and the server, and you can create the apk file in server and send it to your python program.","Q_Score":0,"Tags":"python,flutter,dart,webview,automation","A_Id":71509534,"CreationDate":"2022-03-16T20:14:00.000","Title":"Make a WebView flutter app with different urls everytime using python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I try to intercept requests by seleniumwire.\nIf I dont use option --user-data-dir everything is fine. All requests are showed by driver.requests.\nBut I need parse some sites with authentication. So I provide in --user-data-dir option profile with remembered accounts. But in this case HTTPS requests not intercepted.\nCommand driver.requests showes only requests to google-ads and some other trash.\nSo how to intercept HTTPS requests while providing profile?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":23,"Q_Id":71539741,"Users Score":0,"Answer":"I should to disable all proxy extensions.\noptions.add_arguments(\"--disable-extensions\")","Q_Score":0,"Tags":"python-3.x,selenium,https,selenium-chromedriver,seleniumwire","A_Id":71563645,"CreationDate":"2022-03-19T16:03:00.000","Title":"Seleniumwire dont intercept HTTPS if user-data-dir is defined","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have made a file .xinitrc in the users home directory. In the file I've put\nexec python3 \/srv\/Game\/main.py\nBut the python script doesn't run when launching x with\nstartx\nWhat am I doing wrong? I thoght this was how you used .xinitrc","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":96,"Q_Id":71579886,"Users Score":1,"Answer":"I solved it, and it was mostly issued with permissions in both the directory for the python file and for .xinitrc. Used chmod -R to solve it. Thank you for the suggestions.","Q_Score":0,"Tags":"python,bash,xorg","A_Id":71593135,"CreationDate":"2022-03-22T22:53:00.000","Title":".xinitrc doesn't run script when using startx","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"data = [{\"name\":\"Anne\", \"followers\":[\"Brian\"]}, {\"name\":\"Cindy\", \"followers\":[\"Brian\",\"G\nosh\",\"Anne\"]},{\"name\":\"Dave\", \"followers\":[]}]\noutput :  [{\"name\": [\"Brian\"] , \"follows\":[\"Anne\",\"Cindy\"]},...] etc...\nmy code from now :\nfrom operator import itemgetter\ndata = data = [{\"name\":\"Anne\", \"followers\":[\"Brian\"]}, {\"name\":\"Cindy\", \"followers\":[\"Brian\",\"Gosh\",\"Anne\"]},{\"name\":\"Dave\", \"followers\":[]}]\nx = list(map(itemgetter('followers'), data))\ny = list(map(itemgetter('name') ,data))\nprint(\"name : \" + str(x), \" follow : \" + str(y))\nhow to get combine same values and get from key ?\ni think this is a list in dict ...sorry if mistake . i am newbie using this language","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":23,"Q_Id":71595710,"Users Score":0,"Answer":"It looks like there's a couple errors in your code. First off, in the place where you're defining x and y, it needs to be on separate lines. In other words, change\nx = list(map(itemgetter('followers'), data)) y = list(map(itemgetter('name') ,data))\nto\nx = list(map(itemgetter('followers'), data))\ny = list(map(itemgetter('name') ,data))\nto be on separate lines. Also, since that is the only error in your code it looks like, what is it that you are trying to achieve with this code? Since when I run it, all it outputs is name : [['Brian'], ['Brian', 'Gosh', 'Anne'], []]  follow : ['Anne', 'Cindy', 'Dave']. Other than that, good luck with your programming adventures!","Q_Score":0,"Tags":"python,list,dictionary,nested,tuples","A_Id":71595776,"CreationDate":"2022-03-24T00:38:00.000","Title":"how to get a key and values and combine in list","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"tried adding it to code preference settings json as an executable path and it still defaulted to python 2.7 instead of 3.9.7 like i wanted it to. anyone know how to fix this im running visual studio code 2020 for mac\nhere is the path i added to the settings json\n\"python.pythonpath\": \"\/Library\/Frameworks\/Python.framework\/Versions\/3.9\/bin\/python3\"","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":22,"Q_Id":71597027,"Users Score":0,"Answer":"On the MacOs, you need to take python3 instead of python to run the python3 interpreter. And of course, you can rename the python executable of the python2 to something others such as python2 to avoid the problem.","Q_Score":0,"Tags":"python,visual-studio-code","A_Id":71645205,"CreationDate":"2022-03-24T04:20:00.000","Title":"trying to make python3 defualt python version in visual studio code for mac instead of python 2.7","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"on Stackoverflow I have found many posts about how to find the prevalent color of an image in python. However, I have not found anything about videos. Maybe because it could be possible to process each frame, but I was wondering if there is any easier method. In particular, I would like to study the dominant color of a whole movie.\nThank you a lot in advance.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":17,"Q_Id":71606863,"Users Score":0,"Answer":"A video consists of multiple frames(images). If you would like to get the dominant color, you should get it per image and merge your results.","Q_Score":0,"Tags":"python,machine-learning,data-science","A_Id":71607290,"CreationDate":"2022-03-24T17:24:00.000","Title":"Find dominant color of a video","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"In my company intranet, any request to an external website X in Internet will be redirected to an internal page containing a button that I have to click on. Then the external website X in Internet will be loaded.\nI want to write a program that automatically clicks this button for me (so I don't have to click it manually). After that, the program will make the browser redirect to a re-configured website Y (not X) for the purpose of security testing.\nI don't have much experience with Python. So I would be really thankful if someone can tell me how I can write such a program.\nMany thanks","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":44,"Q_Id":71624216,"Users Score":0,"Answer":"Python has Selenium and BS4 library to help You out, but if You are not experienced with python, You might as well pick up node.js and puppeteer, its far superior in my opinion.","Q_Score":0,"Tags":"python,python-3.x,google-chrome,browser,microsoft-edge","A_Id":71624264,"CreationDate":"2022-03-25T23:48:00.000","Title":"How to write a python program to interact with the browser?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm trying to connect my python scripts to an MySQL or MariaDB Server on my RaspberryPi4.\nMy python script right now just contains import mysql.connector. But when I try to start it via sudo python3 startdb.py I just get import mysql.connector ModuleNotFoundError: No module named 'mysql' as an error.\nI get an other error, when I start the script via sudo python startdb.py:  import mysql.connector ImportError: No module named mysql.connector.\nI searched for a solution on many sites or forums. I mostly just found various versions of pip install mysql-connector-python (also with pip3, mysql-connector-python-rf or mysql-connector) to run but none of them worked for me. The only difference I recognized is that I previously got the error ModuleNotFoundError with both sudo python and sudo python3, but now I only get it with sudo python3.\nDoes anyone know how to solve this?\nCould the fact that my script isn't in a sub-directory of \/home\/pi\/, but instead of \/home\/, be the problem?\nEdit: I just tried executing the script via the desktop mode using my mouse and just clicking on run and it worked. But when I'm using the command line in desktop mode or with a SSH session it doesn't work.\nAnother Edit: It looks like when I'm starting the script without sudo it'll work just fine. Don't actually know why's that, but I'm good for now. But would be very interesting to know and understand why the sudo makes it \"crash\".\nThanks and happy to hear some solutions :D\nCooki","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":104,"Q_Id":71631409,"Users Score":0,"Answer":"raspbian give user mode in running, just in Desktop gives some permission to user for run app as root to access all necessary attributes , use sudo with all initial steps when you download and install project package's","Q_Score":1,"Tags":"python,raspberry-pi,raspbian,mysql-connector,raspberry-pi4","A_Id":72359440,"CreationDate":"2022-03-26T20:01:00.000","Title":"ModuleNotFoundError: No module named 'mysql' with mysql-connector-python already installed","Data Science and Machine Learning":0,"Database and SQL":1,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"I am trying to use pyglet in a framework I am working on but I keep running into an error when I run it and cant tell if im a idiot or not.\nTraceback (most recent call last:\nFile \"C:\\Users\\Admin3\\Desktop\\custom framework\\main.py\", line 6, in <module>\nimport pyglet\nModuleNotFoundError: No module named 'pyglet'\nI dont know if I have imported or installed it incorrectly but every time I run the code it comes back with this error, even though I have pyglet installed and have used it before. Does anyone know how to fix this?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":32,"Q_Id":71634886,"Users Score":0,"Answer":"Double check that you have python pyglet specifically installed. sometimes you need to have a version thats specific to python. if that doesn't work, try making sure everything is spelled correctly. looks fine to me, but idk.","Q_Score":1,"Tags":"python,pyglet","A_Id":71684594,"CreationDate":"2022-03-27T08:45:00.000","Title":"trying to use pyglet in python but i keep running into an error","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"I'm currently trying to use a number of medical codes to find out if a person has a certain disease and would require help as I tried searching for a couple of days but couldn't find any. Hoping someone can help me with this. Considering I've imported excel file 1 into df1 and excel file 2 into df2, how do I use excel file 2 to identify what disease does the patients in excel file 1 have and indicate them with a header? Below is an example of what the data looks like. I'm currently using pandas Jupyter notebook for this.\nExcel file 1:\n\n\n\n\nPatient\nPrimary Diagnosis\nSecondary Diagnosis\nSecondary Diagnosis 2\nSecondary Diagnosis 3\n\n\n\n\n\nAlex\n50322\n50111\n\n\n\n\n\nJohn\n50331\n60874\n50226\n74444\n\n\n\nPeter\n50226\n74444\n\n\n\n\n\nPeter\n50233\n88888\n\n\n\n\n\n\n\nExcel File 2:\n\n\n\n\nPrimary Diagnosis\nMedical Code\n\n\n\n\nDiabetes Type 2\n50322\n\n\nDiabetes Type 2\n50331\n\n\nDiabetes Type 2\n50233\n\n\nCardiovescular Disease\n50226\n\n\nHypertension\n50111\n\n\nAIDS\n60874\n\n\nHIV\n74444\n\n\nHIV\n88888\n\n\n\n\nIntended output:\n\n\n\n\nPatient\nPositive for Diabetes Type 2\nPositive for Cardiovascular Disease\nPositive for Hypertension\nPositive for AIDS\nPositive for HIV\n\n\n\n\nAlex\n1\n1\n0\n0\n0\n\n\nJohn\n1\n1\n0\n1\n1\n\n\nPeter\n1\n1\n0\n0\n1","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":60,"Q_Id":71638833,"Users Score":0,"Answer":"Maybe you could convert your excel file 2 to some form of key value pair and then replace the primary diagnostics column in file 1 with the corresponding disease name, later apply some form of encoding like one-hot or something similar to file 1. Not sure if this approach would definitely help, but just sharing my thoughts.","Q_Score":0,"Tags":"python,excel,pandas,jupyter-notebook,jupyter","A_Id":71638966,"CreationDate":"2022-03-27T17:49:00.000","Title":"How do i use medical codes to determine what disease a person have using jupyter?","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Im working on Topic Modeling on Twitter Data. I extracted the data and stored it in MySQL table. The columns are Date, Place, UserID, Text, tweetID, likes, weekID(based on date I have assigned what week it belongs to).\nI have also taken data of each week and built a LDA model for each week. Im currently using pyLDAvis from Gensim to visualize the topics in each week.\nIs there any way I can compare the LDA models which I have for each week. I want to compare them so I can see how a specific topic has been changing over the weeks.\nAny ideas is much appreciated.\nI have tried to build LDA models of each week and I have saved them into html and LDA model files. I want to see how topics have been changing between the weeks.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":62,"Q_Id":71652128,"Users Score":0,"Answer":"Building a separate LDA model per week means the algorithm's definition of different topics will change from week-to-week. That raises the thorny question of whether particular distinct per-week topics are in any way overlaps or evolutions of previous topics.\nSuch a comparison might be possible, but seems more complicated than an alternative approach: train your LDA model on the entire corpus, without segmentation by weeks. Then you have one model for \"the whole discourse\".\nYou could then provide the more-simple analysis of comparing how each week's articles reflect a different mix of topics. For example, does a single topic become more or less prevalent over time?","Q_Score":0,"Tags":"python,gensim,lda","A_Id":71655336,"CreationDate":"2022-03-28T18:35:00.000","Title":"Compare two LDA models","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am trying to compile some c++code that uses matplotlibcpp and I am having quite a difficult time. In my makefile, I am following the example on the matplotlibcpp documentation and adding a -lpython3.9 flag (I am using python 3.9 because my macs python2.7 doesnt allow me to link -lpython2.7).\nWhen I try to compile I get an error stating:\n\"\"ld: library not found for -lpython3.9\"\nI would like to know what the correct library name I need to use is so I can have access to python 3.9.\nFor context I am using clang++ and python 3.9 installed using homebrew\nPS: I searched in my Versions\/3.9\/lib folder and it has a file called \"libpython3.9.dylib\" which seems like it might be what I want but I dont know how to include it that same way I would -lpython3.9.","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":25,"Q_Id":71655157,"Users Score":1,"Answer":"What is the equivalent of -lpython2.7 for python 3.9 (ie where is the python3 library?)\n\nIt doesn't have much to do either with C++ or with makefiles, but with a conventional Python 3.9 installation, the analogue of -lpython2.7 is -lpython3.9.\n\nWhen I try to compile I get an error stating:\n\"\"ld: library not found for -lpython3.9\"\n\nThat is almost certainly a sign that the library is outside the applicable library search path, not that you have an inappropriate -l option.  You would typically resolve that by using an -L\/path\/to\/directory\/of\/libpython option earlier on the command line.","Q_Score":1,"Tags":"c++,python-3.x,matplotlib,makefile,compiler-errors","A_Id":71655222,"CreationDate":"2022-03-29T00:30:00.000","Title":"C++ Makefiles: What is the equivalent of -lpython2.7 for python 3.9 (ie where is the python3 library?)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"I am working on a project to convert Python code that's using the soon-to-be-discontinued Adwords API to the new version Google Ads API v10.\nI have a query that needs a few metrics, but when I use the main customer ID that works to connect, I get REQUESTED_METRICS_FOR_MANAGER error saying I need to \"issue separate requests against each client account under the manager account\".\nHow do I generate a client account to do this? I haven't seen any examples of this step.\nThanks much!","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":107,"Q_Id":71670081,"Users Score":0,"Answer":"The account ids I needed were in a local MySQL database that a colleague on the project guided me to look at.\nSo in general: check with your management and colleagues ...","Q_Score":0,"Tags":"python-3.x,google-ads-api","A_Id":71683533,"CreationDate":"2022-03-30T00:02:00.000","Title":"Google ads api v10: how to generate \"client account\" to use to get metrics?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"I am using plotly to display a line chart and a pie chart using python, but when i run the code it opens the charts in two separate browsers. I was wondering how I can get both charts to open in one single browser.\nThe code for both works but separately on different browsers. I tried using the plotly.subplots library but this is what it prints:\nValueError: Trace type 'pie' is not compatible with subplot type 'xy'\nat grid position (2, 1)\nSee the docstring for the specs argument to plotly.subplots.make_subplots\nfor more information on subplot types","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":31,"Q_Id":71681256,"Users Score":0,"Answer":"Did you try using plotly.graph_objects.Pie?","Q_Score":0,"Tags":"plotly-python","A_Id":71795005,"CreationDate":"2022-03-30T16:58:00.000","Title":"Displaying two different chart types in a single browser (plotly with python)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Is there a way to create a nested bucket in minio using python?\nI have not found exact documentation on how to do so however, I read some answer that one can create a folder (is that the same as a bucket?) inside a bucket using fput_object command.\nI am not sure how to proceed! Super new to minio! Please help!","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":105,"Q_Id":71701688,"Users Score":1,"Answer":"I got the answer however, I will leave the solution here just in case someone else gets stuck at the same place.\nIt was a simple detail I missed about put_object.\nA folder can be created while adding an object to a bucket!\nHere is how,\nminioclient.put_object(\nbucket_name,\nf\"folder_name\/\" + \"object_name\",\ndata,\nlength\n)","Q_Score":0,"Tags":"python-3.x,amazon-web-services,amazon-s3,minio","A_Id":71701867,"CreationDate":"2022-04-01T04:07:00.000","Title":"Nested buckets minio","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":1,"ERRORS":0,"REVIEW":0},{"Question":"how can I get every artist name from specific country? Is this even possible? I tried and I didn't find it","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":139,"Q_Id":71713315,"Users Score":1,"Answer":"Artists on Spotify are not publicly tied to a specific country, and are simply \"on the platform\", therefore you can't get all the artists from a country. Spotify may collect details about their country based on publicly known information (such as their Artist bio), Spotify Premium subscription, Spotify for Artists account, or tax details, but none of this data is public (for obvious privacy concerns, primarily for smaller artists).\nAs mentioned by oda, you may be able to determine what (artist's) songs are available in a market, however this only tells you if you are able to listen to the song in your region. You can achieve this either by using the available_markets response on the Get Track endpoint, or searching by market as oda mentioned.","Q_Score":0,"Tags":"python,spotify,spotipy","A_Id":71760702,"CreationDate":"2022-04-01T22:24:00.000","Title":"Spotify API (spotipy) - get artist names from specific country","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have made a Ai cursor controller by face land marks by using python open cv, So i need to use this module inside my web browser application that made from .net c# chromium framework. How can i do this , please help me\nI need to embed python module inside .net c# project","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":46,"Q_Id":71734120,"Users Score":1,"Answer":"Rather than trying to use the library directly from C#, you can create a Python based web service and invoke that service from your C# code. Data can be passed back and forth using MessagePack.","Q_Score":2,"Tags":"python,c#,.net,opencv,python.net","A_Id":71734590,"CreationDate":"2022-04-04T08:30:00.000","Title":"how can i Embed python module in .net?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am a beginner and I want to work with the pygame module. I have already used pip install to install pygame and it says so on my command prompt. On my command prompt it says:\nRequirement already satisfied: pygame in c:\\users\\35192\\appdata\\local\\packages\\pythonsoftwarefoundation.python.3.10_qbz5n2kfra8p0\\localcache\\local-packages\\python310\\site-packages (2.1.2)\nHowever, when I try to import pygame in vscode, the module won't import and it says: \"ModuleNotFoundError: No module named 'pygame'\"\nDoes anyone know how to fix this?","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":66,"Q_Id":71742916,"Users Score":1,"Answer":"I solved the problem. I basically just used Ctrl+Shift+P to open up the command palette. From there, I opened \"Python: Select interpreter\" and then I just changed the python interpreter to be the global one (which I assume is the one used by the command prompt)","Q_Score":1,"Tags":"python,pip,pygame,modulenotfounderror","A_Id":71749937,"CreationDate":"2022-04-04T19:40:00.000","Title":"No module named \"pygame\" after using pip","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Is it possible?\nI want to create a command for my discord bot that makes the bot offline for everyone. I want to type that command in any discord server and then the bot just goes offline. This is much easier than going into your files or terminal to press ctrl+c. Is a command like this possible to even make? And if so, can I please know how to add that command? I want to add some admin commands to my bot and this is definitely a great addition to the list. Thanks -","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":121,"Q_Id":71752045,"Users Score":0,"Answer":"If I'm understanding what you're trying to do here, you can just add a command that exits the bot.py program by making a call to something like sys.exit(). This would just terminate the program running the bot, making the bot go offline.","Q_Score":0,"Tags":"python,discord,discord.py,command,bots","A_Id":71752227,"CreationDate":"2022-04-05T12:45:00.000","Title":"How do you create a command that makes the bot go OFFLINE in discord.py","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am doing this project where i need to install a package called Twint.\nI want to install this package and use it's commands in my VS Code.\nWhat happends when i for example type this in my Windows CMD?\npip3 install --user --upgrade git+https:\/\/github.com\/twintproject\/twint.git@origin\/master#egg=twint\nBecause i can't type this in my VS code terminal, where i usually install packages with pip.\nIt will return an error that says ERROR: Cannot find command 'git' - do you have 'git' installed and in your PATH?''\nNow if i run this in my Windows Command it seems that i can't directly import the package in VS code?\nCan anyone help me out with this confusion, where does the files get stored and how do i create good habbits around installing packages?\nHope someone understands what im struggeling with here.\nBest","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":31,"Q_Id":71766622,"Users Score":0,"Answer":"It is often the case that computers have more than one version of python installed and that editors like VS code use a different version than pip uses on the command line. pip installs packages where the version of python it is linked to expects them to be, but VScode doesn't know to look there.\nIt sounds like you have git installed where pip installs things, so you can upgrade from the command line without issue, but there's no installation of git where VScode is looking, so there's nothing to upgrade.\nYou either need to find where pip installs things and add it to the $PATH VScode uses, or try running a variation of python -m pip install --user git (specifying a specific url, or other things, as needed) from within VScode, which will ensure the package gets installed in a place that VScode looks for packages.","Q_Score":2,"Tags":"python,visual-studio-code,command","A_Id":71767101,"CreationDate":"2022-04-06T12:19:00.000","Title":"What is the difference between installing a package in my Windows CMD and in VS Code terminal?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"I am trying to create a script in Python to be used with Notepad++'s PythonScript plugin. So far I've gotten Pandas working correctly in the environment and I've read in a CSV and sorted it the way I desired, the end goal is to remove all of the text in Notepad (which I know how to work with at this point) and write in the text from my Pandas sorted CSV.\nThe issue is that when I write the text from that CSV to the console to check it, Pandas has reformated my CSV to make it easier to look at, it removes all of the quotes from the fields and adjusts the tab sizes (my files are tab delimited, with some tabs having different length). I need my CSV to be the exactly the same just sorted differently, If anyone can help it would be greatly appreciated.\nSome statements I'm using:\n(csv is a String containing all of the text in my CSV file)\npanda_csv = pd.read_csv(csv, sep=\"\\t\")\nsorted = panda_csv.sort_values(by=[\"Name\"], ascending=True, inplace=False)\nconsole.write(sorted.to_string())","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":41,"Q_Id":71783681,"Users Score":0,"Answer":"Since your original file seems to be tab-delimited, you can use the following to write output with a tab separator.\nsorted.to_csv('output.csv', sep ='\\t')","Q_Score":0,"Tags":"python,pandas,csv","A_Id":71783747,"CreationDate":"2022-04-07T14:04:00.000","Title":"How to read a CSV with Pandas but raw?","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"as the title says really. I've managed to implement a very simple LSTM model that takes an input sequence and outputs a given float value.\nFirstly, I'd like to know if it's possible to get answers taken from a set of possible answers. E.g. if I know the answer should be in [1,2,3] to output the answer as being 1.\nSecondly, if possible I'd like the output to be a probability distribution on the possible answers, e.g. [0.5,0.3,0.2].\nI've implemented my simple LSTM model in Python using the various keras packages. Any pointers to the right direction to learn about how to implement this would be great!","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":26,"Q_Id":71829227,"Users Score":2,"Answer":"LSTM is basically one type of recurrent neural network which provide many to many functionality. For that you need to add final dense layer with same number of input class in softmax layer, so you will get exact probability for each input class.","Q_Score":0,"Tags":"python,machine-learning,keras,lstm","A_Id":71839746,"CreationDate":"2022-04-11T14:03:00.000","Title":"Is it possible for LSTM to output a list of probabilities from a given list of possible outputs?","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Let's say I want to create a blueprint of an online store that I can sell to potential clients. However, the idea is to make it so that the client chooses features that they want their store to have (from a pre-designated list) and pay only for those features, that way avoiding paying for something they don't need.\nSo for example, one client wants to have and online store with a Cart, Purchase History, Graphs, Reports. Another one only wants simple registration and cart (but maybe in future they will want me to \"enable\" other features as well).\nMy question is: what, in your opinion, is the best way to tackle this problem from a Django developer perspective?\nMy thoughts:\n\nCreate every feature as a separate app and deploy the whole thing commenting out the features that client did not pay for. And when a client wants additional features, I simply go to settings.py and uncomment the app they requested. Can I even make changes on the settings.py file on a live website without restarting it?\nCreate an admin panel for myself (the superuser) that will have an ability to turn features on or off. So when the client pays for a new feature, I simply go to my admin panel and put a tick mark next to it, and voila! That way I don't have to make changes in settings.py file (and I don't need access to the hosting server, just the django admin panel). Thought I'm not sure how to do this programmatically. I think I need a separate Model with a lot of BooleanFields(?)\n\nWhat are pros and cons of each approach and what other ways to achieve this can you think of?\nEdit 1.\nTo clarify, this will not be a shopify-style service, but simply a website that I will create separately for each client. But I want to have a blueprint to quickly create one and add\/remove features on the fly.","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":30,"Q_Id":71831903,"Users Score":1,"Answer":"I would recommend the admin panel approach.  If you plan to launch a service online that many people can access to generate a store front, you don't want to push code changes for a simple thing like adding a feature.  That would get cumbersome and is not a good practice.  Also modifying the settings.py file would typically need to have the web service (i.e. Apache) restarted so the file is reinitialized.\nWith the admin panel approach, then all you have to do is look up a customer, see what features they have and check boxes.  You could make it more complex of course, especially if a new added feature is going to cost the customer more.  But simply, the admin approach is best, it gives you the flexibility and you don't have to be worried about potentially taking down the site with a code push.","Q_Score":0,"Tags":"python,django","A_Id":71833195,"CreationDate":"2022-04-11T17:23:00.000","Title":"Django. General design philosophy question: best way to implement \"toggleable\" separate features in a website","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":1},{"Question":"I used 3 different algorithms (Linear Regression, Logistics Regression, Decision Tree) to solve the same prediction problem and I have to compare their error measures. The problem at first was that the MAE, MSE, and RMSE values kept changing with each run, it was really problematic for me. The suggested solution was to use random_state.\nThe \"random_state\" argument works for Logistic Regression and Decision Tree but Linear Regression doesn't take this argument. In that case, how do I keep the error measure values from changing? Is there any alternative to \"random_state\" for Linear Regression?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":28,"Q_Id":71845879,"Users Score":0,"Answer":"The answer is simple : you don't need it since there is no local optima to stuck in with different random seeds\nbecause generally in logistic regression problems; there is a global optimum.","Q_Score":0,"Tags":"python,python-3.x,machine-learning,data-science,linear-regression","A_Id":71847954,"CreationDate":"2022-04-12T16:04:00.000","Title":"Alternative to \"random_state\" for Linear Regression?","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"I was able to use selenium to log into a scheduling website and click to the list of clients. Every client can be clicked on, to gather info about how many appointments they have left. What I want to do now is loop through all the clients, clicking on them, getting whatever info I need in an array or whatever (problem for later).\nAs of right now my main question would actually just be clicking on one client and then clicking on the next one until the list is complete. I can figure out the rest later.\nHow do I go about doing this? In previous questions I see that many people already have the list of URLs ready, here I obviously don't.","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":32,"Q_Id":71875624,"Users Score":1,"Answer":"You can first fetch all the links you would want to click on by using\nfindElements method.\nThen you will need a loop using foreach.\npseduo code will be\nforeach(linkwebelement in listoflinks){\nlink.click\ndo your work\ngo back to page\n}\nyou may come across in here stale element excpetion, if you do, you will need page handle again.\nhope this helps.","Q_Score":0,"Tags":"python,selenium,automation","A_Id":71879672,"CreationDate":"2022-04-14T17:33:00.000","Title":"Looping through a list of clicks in selenium python and gathering info","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"with other projects I've developed I have been able to hit 'run' to launch my application, and then shift+F10 from then on.\nIt seems excessively cumbersome to have to launch the terminal and type python manage.py runserver every time I want to test something...\nIs there a better way? can I write a python file like run.py with some script that will launch the app, or some other solution?\nEdit:\nI worked out to add 'runserver' as an argument to the run config for manage.py.... is there a better way?\nI've searched for ages, and all I can find is a thousand tutorials telling me how to start a project, rather than how to launch it more easily.\nthanks","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":23,"Q_Id":71899153,"Users Score":0,"Answer":"it' so simple. i've been trying all manner of hacky approaches to make a script, but i finally found 'django server' in the run configurations, complete with a launch browser option.\nawesome.","Q_Score":0,"Tags":"python,django,pycharm","A_Id":71899191,"CreationDate":"2022-04-17T03:52:00.000","Title":"How to launch a Django project from within pycharm without using terminal?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":1,"ERRORS":0,"REVIEW":0},{"Question":"About 4 days ago, while I was doing my schoolwork I noticed that the variable colors don't turn blue like they used to, and it does not show me problems in the code anymore. I am a beginner in coding, so the \"not showing problem\" thing is a big issue for me. Would anyone know how can I get them back?\nAlso, this problem is in all of my Visual Studio Code tabs, so its not just a specific code doing it.\n[EDIT: nothing that i tried fixed the issue, since uninstalling or changing files is not an option for me since i need administrator rights to do so [which i do not have], but it is alright, i have installed another linter and now everything should be fine]","AnswerCount":3,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":65,"Q_Id":71935260,"Users Score":0,"Answer":"Maybe you need to install a vs code plug-in called pylance and make sure that it is not disabled in your workspace.","Q_Score":0,"Tags":"python,visual-studio-code","A_Id":71935326,"CreationDate":"2022-04-20T06:46:00.000","Title":"Visual Studio Code does not show variable color or problems anymore","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"About 4 days ago, while I was doing my schoolwork I noticed that the variable colors don't turn blue like they used to, and it does not show me problems in the code anymore. I am a beginner in coding, so the \"not showing problem\" thing is a big issue for me. Would anyone know how can I get them back?\nAlso, this problem is in all of my Visual Studio Code tabs, so its not just a specific code doing it.\n[EDIT: nothing that i tried fixed the issue, since uninstalling or changing files is not an option for me since i need administrator rights to do so [which i do not have], but it is alright, i have installed another linter and now everything should be fine]","AnswerCount":3,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":65,"Q_Id":71935260,"Users Score":0,"Answer":"uninstall Visual Studio Code\nand delete user\\AppData\\Roaming\\Code (windows)\nand the install it again,\nmay be it's due to a buggy extension or some setting","Q_Score":0,"Tags":"python,visual-studio-code","A_Id":71935640,"CreationDate":"2022-04-20T06:46:00.000","Title":"Visual Studio Code does not show variable color or problems anymore","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am currently working with cx_oracle\nHere with SELECT statements I am able to use the fetchall() function to get rows.\nBut how to get the outputs for queries that fall under Data Definition Language (DDL) category.\nFor example, after executing a GRANT statement with cursor.execute(), the expected output assuming the query is valid would be,\n\"GRANT executed successfully\"\nBut how do I get this with cx_oracle, Python.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":30,"Q_Id":71941855,"Users Score":1,"Answer":"The answer is that you have print it yourself, which is what SQL*Plus does.\nDDL statements are statements not queries because they do not return data.  They return a success or error condition to the tool that executed them, which can then print any message.  In your case the tool is cx_Oracle.  There isn't a way to get the type (GRANT, CREATE etc) of the statement automatically in cx_Oracle.  Your application can either print a generic message like 'statement executed successfully', or you can extract the first keyword(s) from the SQL statement so you can print a message like SQL*Plus does.","Q_Score":0,"Tags":"python,ddl,cx-oracle","A_Id":71946901,"CreationDate":"2022-04-20T14:54:00.000","Title":"how to get the output of DDL commands Python cx_oracle","Data Science and Machine Learning":0,"Database and SQL":1,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"i want to control every pixel of my tkinter program but when i search how, i just found out that the only solution is to use 'canvas' and even if it allows us to draw lines, i think i didnt find out how to change for exemple the color of the pixel (x=200, y=478)\nand i m also afraid that when i use my code on a really big size of pixels, the program becomes slow with tkinter.. i m still a beginner for those who havent noticed it yet.. so i m curious to know if there is no tool in tinker that actually is used like it takes the x, y of the pixel and the color you wanna apply! i guess it should be possible bcs how either tkinter is supposed to be programmed.. (i m still a beginner ^^) anyways if this tool exists pls tell me about it and if it is supposed to be as slow as canvas i can actually just try a better code..","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":29,"Q_Id":71957089,"Users Score":0,"Answer":"so i m curious to know if there is no tool in tinker that actually is used like it takes the x, y of the pixel and the color you wanna apply!\n\nThere is no such tool. Tkinter simply isn't designed to do this. If you need to control individual pixels in a GUI, tkinter is the wrong tool to use.","Q_Score":0,"Tags":"python,tkinter,canvas,pixel","A_Id":71957512,"CreationDate":"2022-04-21T15:30:00.000","Title":"how to change the color of our pixels using tkinder?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have clustered the pixels of an image into clusters of different sizes and shapes. I want to max pool each cluster as fast as possible because the max pooling happens in one layer of my CNN.\nTo clarify:\nInput is a batch of images with the following shape [batch_size, height of image, width of image, number of channels]. I have clustered each image before I start training my CNN. So for each image I have a ndarray of labels with shape [height of image, width of image].\nHow can I max pool over all pixels of an image that have the same label for all labels? I understand how to do it with a of for loop but that is painstakingly slow. I am searching for a fast solution that ideally can max pool over every cluster of each image in less than a second.\nFor implementation, I use Python3.7 and PyTorch.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":24,"Q_Id":71967972,"Users Score":0,"Answer":"I figured it out. torch_scatter. scatter_max(img, cluster_labels) outputs the max element from each cluster and removes the for loop from my code.","Q_Score":0,"Tags":"python-3.x,pytorch,conv-neural-network,k-means,max-pooling","A_Id":72337879,"CreationDate":"2022-04-22T11:25:00.000","Title":"How can I speed up max pooling clusters of different sizes and shapes of an image?","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm still new to coding and I'm asked to create a Patients part in a hospital management system\nIt should include:\n1- Add Patients Records (Name Age, Gender, ID, Insurance, Phone Number)  (write it in file)\n2- Add Health Condition (write it in file)\n3- Add Appointments (write it in file)\n4- Cancel Appointments (clear or remove whatever in file)\n5- Get Appointments (read it from file)\n6- Get Patients Records (read it from file)\nI wanna make sure to use proper classes, methods, inheritance, overriding, polymorphism, reading and writing from files, and exception handling\nThe thing is I don't know how to start this and since this is a hospital management system, there will be a class named hospital and under it will be staff, patients, pharmacy, and etc\npatients are considered what? should they be an individual class?\nand how can I fill all the requirements?\nSo how this code should look like?","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":52,"Q_Id":71977727,"Users Score":1,"Answer":"This question is too broad to be answered, but I will try to provide you with answers to your questions.\n\nWill there be a class named hospital and under it will be staff,...\n\nhospital would not have to be an object unless your system encompasses multiple hospitals (and each of them specialises in an area, etc...). By what I understand you don't need something like that, so you can ignore it.\n\nstaff, patients, pharmacy, and etc patients are considered what?\n\nThey would be each considered an object.\n\nshould they be an individual class?\n\nYes.\nAn example of where you can use polymorphism and inheritance would be between staff and patients. They are both people with common attributes such as name, gender, etc... So you could, create a superclass called person and have both staff and patient inherit it. Then create member variables and methods that are common to all people in the person class, while things such as health condition which are specific to patients can be kept in the patient class.\nThat was just an example. If you were to get a thorough understanding of the OOP concepts you mentioned yourself, everything would start to fit into place. It is also best if you created a class diagram, or some sort of overview diagram and look through the architecture of your system before you start implementing it.","Q_Score":0,"Tags":"python,oop","A_Id":71977846,"CreationDate":"2022-04-23T07:31:00.000","Title":"Patients part in a Hospital Management System","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am working on a project which will require the user to enter the UI and create the table name on their own. Inputting table name and columns (column name, type, and other info).\nAlthough it's easy to parametrize standard queries (i.e. insert\/replace\/update), I couldn't find ANY resource on how to parametrize DDL statements such as CREATE. Nor libraries that can handle that easily.\nI was planning to apply (1) controls on the UI and (2) controls on the API I am going to call to run this DDL. But do you have any better idea\/resource on how to get a CREATE statement from i.e. a JSON input? I am working on redshift.. Cheers!","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":32,"Q_Id":71979203,"Users Score":0,"Answer":"I\u2019ve used jinja2 templates and json config for this type of process.  It integrates with python and can be used standalone.  Just template your create table statements and apply the json config.","Q_Score":0,"Tags":"python,amazon-redshift,ddl,create-table","A_Id":71979484,"CreationDate":"2022-04-23T11:27:00.000","Title":"Create DDL statement from JSON file. How to avoid\/minimize SQL injection?","Data Science and Machine Learning":0,"Database and SQL":1,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"skeleton for the code\nThe functions you need to write are as follows:\ndef create grid(grid):\n\"\"\"create a 4x4 array of zeroes within grid\"\"\"\ndef print grid (grid):\n\"\"\"print out a 4x4 grid in 5-width columns within a box\"\"\"\ndef check lost (grid):\n\"\"\"return True if there are no 0 values and there are no\nadjacent values that are equal; otherwise False\"\"\"\ndef check won (grid):\n\"\"\"return True if a value>=32 is found in the grid; otherwise\nFalse\"\"\"\ndef copy grid (grid):\n\"\"\"return a copy of the given grid\"\"\"\ndef grid equal (grid1, grid2):\n\"\"\"check if 2 grids are equal - return boolean value\"\"\"","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":46,"Q_Id":71983693,"Users Score":0,"Answer":"If your util.py is just responsible for editing grid you can write code as you mentioned. But if your util.py has more functionalities, for instance opening dataset, multi dimension grid and ... you can use classes. Put your function which related each other to the classes and import classes from util.py wherever you want. You can read single responsibility design pattern.","Q_Score":0,"Tags":"python,arrays,unit-testing","A_Id":71984872,"CreationDate":"2022-04-23T21:19:00.000","Title":"how do i code a module of utility functions called util.py for manipulating 2-dimensional arrays of size 4x4?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I came across everything related to iterators today and there are still some things I don't understand. I'm still a Python beginner but I'll try to explain the best I can.\n\nI understand the difference between an iterable and an iterator. However, couldn't we just simply implement the __next__ method on a list and somehow make it to go back to list[0] when StopIteration was raised? Wouldn't that free up some memory as iterators also allocate space in memory? What's really the reason for iterators to exist?\nI also understand the difference between a generator and a list, for example. Also, there is a type of iterator for each object (e.g range_iterator). How are generator_iterators different from other iterator objects? Are they added values on the fly?","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":30,"Q_Id":71989052,"Users Score":1,"Answer":"Iterators (objects representing streams of data) are created because\niterables (which iterators can be created from) couldn't keep the index\nof the last element returned, because otherwise, you would only be\nable to use it one at a time. So for that reason, each time you iterate over the same object, a new iterator is created. From the Python Wiki:\n\n\nIterators will typically need to maintain some kind of position state information (e.g., the index of the last element returned). If the iterable maintained that state itself, it would become inherently non-reentrant (meaning you could use it only one loop at a time).\n\n\nGenerator iterators (which in turn are returned by generator\nfunctions) are also streams of data but generated on the fly. From\nthe Python Documentation:\n\n\ngenerator iterator\nAn object created by a generator function.\nEach yield temporarily suspends processing, remembering the location execution state (including local variables and pending try-statements). When the generator iterator resumes, it picks up where it left off (in contrast to functions which start fresh on every invocation).","Q_Score":0,"Tags":"python,iterator,language-features","A_Id":71991420,"CreationDate":"2022-04-24T13:51:00.000","Title":"How do python iterators work memory-wise? What are they designed for?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I want to change the title text to other names but i don't know the command.\nLike from C:\\windows\\py.exe to a better looking title like Python but I cannot find how to do it.\nI need the Python 3.10 version of Windows command 'title ...'\nThanks for your help!","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":45,"Q_Id":71993399,"Users Score":0,"Answer":"You can use os module system command os.system(\"title your title\").","Q_Score":1,"Tags":"python,python-3.x","A_Id":71993411,"CreationDate":"2022-04-25T00:33:00.000","Title":"How to change python window title?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am new to RASA. I gone through updated documentation Rasa 3 but I don't know how to pre-process the message of the user before nlu-model.\ne.g., if user enter hi, so i want to read that text before any action taken by rasa like tokenization etc.\nIf anyone can please guide me for this.\nEDIT: I want to capture user text in rasa itself, before any other pipeline action, so that I can do my own processing. (for learning purpose)","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":31,"Q_Id":71993870,"Users Score":0,"Answer":"In such scenario, you can handle the user message from front end (chatbot widget), specifically from JS script.","Q_Score":2,"Tags":"python,rasa,rasa-nlu,rasa-core","A_Id":71994843,"CreationDate":"2022-04-25T02:16:00.000","Title":"RASA preprocessing, user entered text","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have python code that depends on specific libraries like selenium and interaction with google chrome to extract data from the web.\nmy code works fine but i need a lot of records to do analysis, so i can't leave my computer on, to run the script for a month.\nThat's why I thought of running the script in a cloud service like aws but I don't have a clear idea of \u200b\u200bhow to do it, because I need the script to not stop\nand I would rather not have to pay for it (or at least not that much money)\nThat said, my code opens a website, looks for a specific text data and saves it in a csv document.\nI thank you in advance for the help","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":27,"Q_Id":71998750,"Users Score":1,"Answer":"You will have to check the terms of each cloud service as many do have downtime\/restarts on their free tiers.\nThe kind of task you're describing shouldn't be very resource hungry, so you may be better off setting up your own server using a Raspberry Pi or similar.","Q_Score":0,"Tags":"python,selenium,web-scraping,automation,cloud","A_Id":71998861,"CreationDate":"2022-04-25T11:23:00.000","Title":"Run pythom code in cloud without stopping","Data Science and Machine Learning":0,"Database and SQL":1,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I want to remove backslash from a string,\nI tried result.replace('\\\\','') but nothing changed.\nAnyone has an idea how I can remove it?\nresult = '[(\\'company_ids\\', \\'in\\', company_id), (\\'warehouse_ids\\', \\'in\\', warehouse_id)]'","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":56,"Q_Id":72002357,"Users Score":0,"Answer":"it's no a part of the string but you can use result.replace(\"\\\",\"\") to remove it","Q_Score":0,"Tags":"python,python-3.x,string,replace,odoo","A_Id":72123517,"CreationDate":"2022-04-25T15:56:00.000","Title":"Can't remove backslash from string in Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am a designer and I code only a little bit. I would like to know how I could use the output of the Twitter API (which I master) to use them on Unity. Which programming language would be the best? The goal is for me to do real-time creation on Unity.\nThanks in advance for your help! :)","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":38,"Q_Id":72019704,"Users Score":1,"Answer":"I believe you can have your twitter bot communicate with unity by using files. So you can write in a file then read the content with C# during runtime.","Q_Score":1,"Tags":"unity3d,twitter,twitterapi-python","A_Id":72043963,"CreationDate":"2022-04-26T19:46:00.000","Title":"Twitter API to Unity","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am trying to use wand on python on my Mac Monterrey. When I run the command on python  from wand.image import Image as Img I get the error ImportError: MagickWand shared library not found. You probably had not installed ImageMagick library.\nThis is what I had done, following diverse guidelines. Any suggestions as to how to make wand find imagemagick?\nI installed imagemagick via homebrew. I can confirm that I have that the following items exist in my computer: \/opt\/homebrew\/Cellar\/imagemagick and \/opt\/homebrew\/Cellar\/imagemagick@6.\nI also did a brew unlink imagemagick && brew link imagemagick\nI added the following line to the end of my .zshrc:\nexport MAGICK_HOME=\"\/opt\/homebrew\/Cellar\/imagemagick\"\nI installed Wand via pip install in my local environment","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":20,"Q_Id":72029757,"Users Score":0,"Answer":"That was the wrong path to put in the .zshrc. The correct path was export MAGICK_HOME=\"\/opt\/homebrew","Q_Score":0,"Tags":"python,imagemagick,homebrew,wand","A_Id":72041140,"CreationDate":"2022-04-27T13:34:00.000","Title":"Installation of imagemagick with Homebew not found by python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"I have 3 scripts at the end of each script i have a dataframe results and i want to run this 3 scrips from one script and to show results (3 dataframes) that i will regroupe in one dataframe.\nIf you know how to run this 3 scripts at the same time and get results in one file (Dataframe)","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":29,"Q_Id":72032280,"Users Score":0,"Answer":"In scripts make sure you run them inside if __name__ == __main__: block(so you don't run then while importing). Turn those scripts into functions (or classes, depending on the structure of your code) and then import them to the main python file. Then write their results to one file inside the main script.","Q_Score":0,"Tags":"python","A_Id":72032349,"CreationDate":"2022-04-27T16:25:00.000","Title":"How run multiple scripts from one scripts and retrieve results","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am using the tf_Agents library for contextual bandits usecase.\nIn this usecase predictions (daily range between 20k and 30k predictions, 1 for each user) are made daily  (multiple times a day) and training only happens on all the predicted data from 4 days ago (Since the labels for predictions takes 3 days to observe).\nThe driver seems to replay only the batch_size number of experience (Since max_step length is 1 for contextual bandits). Also the replay buffer has the same constraint only handling batch size number of experiences.\nI wanted to use checkpointer and save all the predictions (experience from driver which are saved in replay buffer) from the past 4 days and train only on the first of the 4 days saved on each given day.\nI am unsure how to do the following and any help is greatly appreciate.\n\nHow to (run the driver) save replay buffer using checkpoints for the entire day (a day contains, say, 3 predictions runs and each prediction will be made on 30,000 observations [say batch size of 16]). So in this case I need multiple saves for each day\nHow to save the replay buffers for past 4 days (12 prediction runs ) and only retrieve the first 3 prediction runs (replay buffer and the driver run) to train for each day.\nUnsure how to handle the driver, replay buffer and checkpointer configurations given the above #1, #2 above","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":38,"Q_Id":72032751,"Users Score":1,"Answer":"On the Replay Buffer I don't think there is any way to get that working without implementing your own RB class (which I wouldn't necessarily recommend). Seems to me like the most straight forward solution for this is to take the memory inefficiency hit and have two RB with a different size of max_length. One of the two is the one given to the driver to store episodes and then rb.as_dataset(single_determinsitic_pass=true) is used to get the appropriate items to place in the memory of the second one used for training. The only thing you need to checkpoint of course is the first one.\nNote: I'm not sure off-the-top-of-my head how exactly single_determinsitic_pass works, you may want to check that in order to determine which portion of the returned dataset corresponds to the day you want to train from. I also have the suspicion that probably the portion corresponding to the last day shifts, because if I don't remember wrong the RB table that stores the experiences works with a cursor that once reached the maximum length starts overwriting from the beginning.\nNeither RB needs to know about the logic of how many prediction runs there are, in the end your code should manage that logic and you might want to keep track (maybe in a pickle if you want to save this) how many predictions correspond to each day so that you know which ones to pick.","Q_Score":0,"Tags":"python,tensorflow,machine-learning,bandit,tf-agent","A_Id":72049599,"CreationDate":"2022-04-27T17:05:00.000","Title":"How to use the replay buffer in tf_agents for contextual bandit, that predicts and trains on a daily basis","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm working on Program, api application to python of telegram, in version 2, filter edited has replaced with a decorator of his own, @clinet.on_edited_message,\nthe problem is that I want to invert is action, and get only not edited messages, with filter is easy, add  ~ in the beginning, but how do I do that in a decorator? thanks","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":31,"Q_Id":72044152,"Users Score":0,"Answer":"As the Release Notes for Version 2 describe, @app.on_edited_message() only filters edited messages. If you want non-edited messages, use @app.on_message() instead.","Q_Score":0,"Tags":"python,python-decorators,pyrogram","A_Id":72044245,"CreationDate":"2022-04-28T13:01:00.000","Title":"Invert the action of an decorator in python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Anyone know how to actually enable auto imports? I've tried in the pref's auto-import settings, cleared my project cache and restarted but I never get any auto import prompts!\nOn mac, running latest pyCharm CE version.\nthis is not simply a matter of enabling the setting; that setting is enabled in the preferences but still I get no suggestions for auto-imports\nie\nimport requests\ngets me nothing no popup, no suggestion to import it etc.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":34,"Q_Id":72051064,"Users Score":0,"Answer":"You can simply follow these steps:\n\nIn the Settings\/Preferences dialog (Ctrl+Alt+S), click Editor | General | Auto Import.\nIn the Python section, configure automatic imports:\nSelect Show import popup to automatically display an import popup when tying the name of a class that lacks an import statement.Select one of the Preferred import style options to define the way an import statement to be generated.\n\nLet me know how it goes!","Q_Score":0,"Tags":"python,pycharm","A_Id":72051089,"CreationDate":"2022-04-28T22:57:00.000","Title":"Enable PYCharm auto-Imports for python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I've been wanting to make a program that hides a folder that has a lot of my sensitive files on it.  I use python as my main programming language.\nI need a way to hide the folder from Windows Explorer, even if the \"Show Hidden Files\" option is checked. I know how to hide it normally, right-clicking on the folder and checking the \"hidden\" option, but I need users to not be able to see it at all. I also need to be able to unhide it using the same program.\nIf anyone knows a solution, please let me know!\nThank you!","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":44,"Q_Id":72062151,"Users Score":0,"Answer":"I have opted for a secured, hidden folder marked as hidden, system reserved and encrypted, and requiring a python script to unlock. Using the attrib DOS command, but it does the trick. I'm also using EFS encryption on the folder, so even if the system and hidden attributes are cleared, people still can't access it.","Q_Score":0,"Tags":"python","A_Id":72067157,"CreationDate":"2022-04-29T18:13:00.000","Title":"Is there a way to hide a folder even when \"show hidden files\" is checked using python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I've been wanting to make a program that hides a folder that has a lot of my sensitive files on it.  I use python as my main programming language.\nI need a way to hide the folder from Windows Explorer, even if the \"Show Hidden Files\" option is checked. I know how to hide it normally, right-clicking on the folder and checking the \"hidden\" option, but I need users to not be able to see it at all. I also need to be able to unhide it using the same program.\nIf anyone knows a solution, please let me know!\nThank you!","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":44,"Q_Id":72062151,"Users Score":0,"Answer":"Theoretically, you could make a program that loads your folder into the RAM on startup while deleting it and re-saving the folder on shutdown, however this would be very risky when you press \"shutdown anyways\". If a certain condition is met, you could show the folder(e.g. saving it to file system).\nAnother Idea would be to try to remake it as the very infuriating folder in C:\\Program Files\\WindowsApps which you can only access in command-line\nAlso if you are able to complete this project, I would be very interested in using it too.","Q_Score":0,"Tags":"python","A_Id":72062347,"CreationDate":"2022-04-29T18:13:00.000","Title":"Is there a way to hide a folder even when \"show hidden files\" is checked using python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I want my python code to be run in external terminal (window).\nObviously i have to edit 'launch.json' file, where I should\nchange the option 'console:internalConsole' to 'console:externalTerminal'.\nProblem is, I don't find a 'launch.json' file. I guess I have\nto set up one, but I'm not sure how to do it.\nSeems that the extension 'code runner' could do this trick,\nbut the extension breaks down.\nI tried to make changes in the settings menu, I chose code to be run\nin external terminal, but it still uses the internal one.\nMay be you can give me a direction ?\nThanks","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":31,"Q_Id":72077096,"Users Score":0,"Answer":"it's done.Created launch.json file and 'console: externalTerminal'","Q_Score":0,"Tags":"python,visual-studio-code,terminal","A_Id":72078811,"CreationDate":"2022-05-01T13:20:00.000","Title":"How to run my code in external window (terminal)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"macos monterey 12.3.1\npython -V: python3\nwhich python3: \/usr\/local\/bin\/python3\nalias python=\"\/usr\/bin\/python3\"\npath: \/Users\/Bill\/Public\/browser\/depot_tools \/usr\/local\/bin \/usr\/bin \/bin \/usr\/sbin \/sbin\nproxy: proxychains4 + tor socks5 127.0.0.1 9150\ncloned dedepot_tools in git clone https:\/\/chromium.googlesource.com\/chromium\/tools\/depot_tools.git\nrun gclient working good\nrun: fetch v8\nrun: gclient sync working good\nrun: tools\/dev\/gm.py x64.release\nshow:\nenv: python: No such file or directory\nhow to fix it?\nshould install python-is-python3?\nbrew info python-is-python3\nError: No available formula with the name \"python-is-python3\". Did you mean python-tk@3.9?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":75,"Q_Id":72082131,"Users Score":0,"Answer":"As a short-term workaround, you have two options:\n(1) Create a symlink python in your $PATH that references python3. This can be done in one of several ways:\n\nSome Linux distros have a python-is-python3 package for that\nSome distros have other \"official\" ways to do it\nOr you can just sudo ln -s \/usr\/local\/bin\/python3 \/usr\/local\/bin\/python (or whatever the correct paths are on your system).\n\n(2) You can call gm.py with an explicit Python binary:\npython3 tools\/dev\/gm.py\nMedium-term, gm.py should be updated to require python3 directly. The fact that it doesn't do so yet is an artifact of the Python2-to-Python3 migration.","Q_Score":0,"Tags":"python-3.x,build,v8,gm,gn","A_Id":72084334,"CreationDate":"2022-05-02T03:43:00.000","Title":"gm.py x64.release Errorr---env: python: No such file or directory","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I installed WSL2 and use Visual Studio (VS) 2022 on the windows. I want to configure my VS 2022, so I can develop Python projects in WLS2. All tutorials I find online only talks about visual studio code. I don't want to install another IDE. Does anybody know how to do that or point me to some material?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":66,"Q_Id":72087332,"Users Score":0,"Answer":"Unfortunately not at this time, no.  The VSCode integration with WSL is done through the use of an extension that creates an interop server between Windows VSCode and the Linux side of WSL.  There isn't an extension like that for Visual Studio, however.\nThe only WSL integration that I'm aware of in Visual Studio 2022 is the inclusion of a WSL toolchain that allows you to target WSL\/Linux in C++ projects.  But nothing that I'm aware of for Python, no.\nI believe you'll need to install an additional IDE to get Python\/WSL support, sorry.","Q_Score":0,"Tags":"python,visual-studio,wsl-2","A_Id":72087945,"CreationDate":"2022-05-02T13:19:00.000","Title":"Configuring Visual Studio 2022 to develop Python projects in WSL2","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have a question, how do I refresh the page where I am currently in django? I am new with all this, add a favorite button, but I am doing a redirect to a page, it is wrong, since I only need the page where I am currently to be refreshed, could someone help me?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":30,"Q_Id":72089883,"Users Score":0,"Answer":"greeted, I just had to do a redirect to a request.META.get['HTTP_REFERER']","Q_Score":0,"Tags":"python,django","A_Id":72104224,"CreationDate":"2022-05-02T16:54:00.000","Title":"refresh web in django","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I want to create MS Teams chat-bot without using MS Bot Framework.\nHowever, in the official document, there was only an example of using the MS Bot Framework.\nI want to develop this process through message processing through FastAPI and my own AI logic.\nIs there a guide for proper usage?","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":63,"Q_Id":72093935,"Users Score":1,"Answer":"If you're only looking to send the odd notification to a user you can do this via Graph as Conrad said (there are reasons why this might not be the best solution and taking the bot approach is usually the better option - being able to send a notification from an \"app\" rather than a user with rich adaptive cards, for example)\nThe main thing to remember here is that a \"bot\" is just an api endpoint and the \"bot framework sdk\" largely exists to simplify the process of parsing and processing the messages that are sent on that endpoint (and some additional complexities around auth with the Azure bot service, etc). The interaction between Teams and your bot is also not request\/response it's actually request\/request and the SDK does a reasonable job of abstracting this so you don't have to worry about it.\nHaving said that, as long as you have an api endpoint that will accept the messages being sent from Teams (and proxied through the bot service) you don't have to use the sdk, plus it's all open source so you can inspect the framework to see what it's doing... I'd highly recommend using it though as it really does make your life a lot easier and some of those message structures aren't very well documented... the bottom line is that it's not trivial, but it is possible!","Q_Score":0,"Tags":"python,microsoft-teams,fastapi","A_Id":72223142,"CreationDate":"2022-05-03T01:16:00.000","Title":"Can I create a Teams bot without using Bot Framework?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have two large datasets. Let's say few thousands rows for V dataset with 18 columns. I would need to find correlations between individual rows (e.g., row V125 is similar to row V569 across the 18 columns). But since it's large I don't know how to filter it after. Another problem is that I have B dataset (different information on my 18 columns) and I would like to find similar pattern between the two datasets (e.g., row V55 and row B985 are similar, V3 is present only if B45 is present, etc...). Is there a way to find out? I'm open to any solutions. PS: this is my first question so let me know if it needs to be edited or I'm not clear. Thank you for any help.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":70,"Q_Id":72095659,"Users Score":0,"Answer":"Row V125 is a value, perhaps you meant row 125. If two rows are the same, you can use the duplicate function for pandas or find from the home menu in excel.\nFor the second question, this can be done using bash or the windows terminal for large datasets, but the simplest would be to merge the two datasets. For datasets of few thousand rows, this is very quick. If you are using a pandas dataframe, you can then use the append function to merge them and find the duplicates.","Q_Score":0,"Tags":"python,statistics,data-science,correlation","A_Id":72102325,"CreationDate":"2022-05-03T06:42:00.000","Title":"Data science: How to find patterns and correlations in two datasets in python","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I want to implement the Cognito Hosted UI for some users in my Django application.\nI have successfully been able to redirect the users to the desired url for authentication using the following:\nreturn redirect(https:\/\/....amazoncognito.com\/oauth2\/authorize?client_id=....redirect_uri=localhost).\nI am able to successfully authenticate and redirect back to my localhost where the url in the browser is localhost\/?code=xyz. I do not understand how I can retrieve this code xyz back in python to perform next steps? I see that in the Django Terminal that it reads the required code. This is what the terminal shows:\n[04\/May\/2022 16:08:15] \"POST \/login HTTP\/1.1\" 302 0\n[04\/May\/2022 12:09:04] \"GET \/?code=xyz HTTP\/1.1\" 200 8737\nI just do not know how to get this code xyz in my views.py so that I can continue the login. I tried variations of request.GET that did not work.\nAny help is appreciated!!","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":18,"Q_Id":72119094,"Users Score":0,"Answer":"I just figured it out 5 days later (what 5 days of not looking at your code can do!)\nrequest.GET.get(\u2018code\u2019) gives back the 'xyz' that shows up in the url in the browser.","Q_Score":2,"Tags":"python,django,authentication,amazon-cognito","A_Id":72190667,"CreationDate":"2022-05-04T20:25:00.000","Title":"How to get the code returned by Cognito Hosted UI Autentication in Django?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am trying to edit some docs on github, here are my instructions:\n\nClone the repo\nCreate a virtual environment\nInstall dependencies\nStart a local server\n\nI am able to 1 and 2 no problem, and 3 installs: mkdocs and mkdocs-material\nI run into an issue on #4 with an error:\n\"ERROR    -  Config value: 'pages'. Error: The configuration option 'pages' was removed from MkDocs. Use 'nav' instead.\nAborted with 1 Configuration Errors!\"\nThe MkDocs website does state this:\n\"Breaking change: the pages config option that was deprecated for a very long time now causes an error when used (#2652)\nTo fix the error, just change from pages to nav.\"\nI am not a dev, so not sure what changing pages to nav means. There are some files named pages, but changing to nav would be nav(2).\nHow would I fix this?\nTIA!","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":37,"Q_Id":72120181,"Users Score":0,"Answer":"So MkDocs no longer supports the 'pages' tag on generating the site. The replacement for it is called 'nav'.\nSo all you have to do generally is replace 'pages' in your mkdocs with 'nav' and that should fix it","Q_Score":0,"Tags":"python-3.x,windows,mkdocs","A_Id":72137941,"CreationDate":"2022-05-04T22:42:00.000","Title":"Error when starting a local server on Mkdocs Windows, how do I fix?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"context: I have a python program which relies on multiple libraries implemented in C++, exposed via pybinder.\nMy impression is: when python import xxx, it loads shared libraries (.so) into virtual memory. This is something I remember I read from book or webpage but cannot find it now.\nI want to know how I can verify it in Linux? I tried to strace with event open, the only shared libraries opened are something like py\/__init__.so (all python internal libraries), which doesn't look correct to me.\nIn the code base, I have multiple libcurl with multiple versions, all of them are introduced by 3-rd parties libraries. I want to know if I have a way to enforce when running python applications, they don't intervene?\nFor example: python program A relies on C++ shared library B and C.\nB relies on libcurl (V1), statically linked.\nC also relies on libcurl (V2), also statically linked.\nBad things could happen if B invokes libcurl (V2), since there might be conflict.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":52,"Q_Id":72122320,"Users Score":0,"Answer":"On Linux systems, you can see which dynamic libraries are loaded into a process by running cat \/proc\/pid\/maps where pid is the relevant process ID.\nAbout your second question: If the libraries are statically linked to libcurl then they cannot use the wrong library version: the linking is static.\nIf the linking is dynamic then only one libcurl can be loaded. However libcurl seems to be relatively API\/ABI stable so this usually wouldn't be a problem.","Q_Score":1,"Tags":"python,c++,pybind11","A_Id":72129431,"CreationDate":"2022-05-05T05:28:00.000","Title":"How python loads C++ shared library","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have a file that holds a JSON which is read and written when devices log onto a server I have.  Each device spawns its own process, and I have run into the issue where it looks like somehow two processes have written to the file concurrently. I assumed that using json.dump(object,open(filename,'w')) would be fast enough to prevent this issue, but clearly not.\nIs there a way to block write access to an open file?  I didn't see a way to do this in the open() documentation.  I could control it with some sort of control file, but this seems like a problem that has already been solved.  I just don't know where to look.","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":54,"Q_Id":72133004,"Users Score":0,"Answer":"While it is not the best way to do it, I personally would create a second file that contains a flag or a single integer or some text and use it as a marker that a process is using the file. Just remember to reset the file when the process is done writing to avoid locking the main text file forever.\nBut I would highly recommend trying felipecrp answer first.","Q_Score":0,"Tags":"python","A_Id":72133289,"CreationDate":"2022-05-05T20:01:00.000","Title":"Prevent concurent writing to a file in python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm trying to debug pytest tests in Visual Studio 2022.  I have the tests showing up in test explorer and when I run them they execute, however when I set a breakpoint and try to debug the test the breakpoints show the warning symbol and when I hover over it, it informs me that the breakpoint will not be hit because symbols are not loaded.  The test does actually run, I just can't figure out how to get it to load whatever it needs to in order for me to debug.\nIt's python so there's no module to inspect in the modules window to tell it to load symbols for and nothing is compiled so I don't know where symbols would even be.  Is there something that needs to be configured in the pyproject (besides setting the test framework to pytest)?  Debugging in my other python projects just worked out of the box.  Is there a setting for loading symbols for your own python code?  If so, does anyone know where or why it would be disabled for pytest tests while testing?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":27,"Q_Id":72135205,"Users Score":0,"Answer":"It turns out this was a bug in VS.  Simply updating to the latest version resulted in everything magically working as expected.","Q_Score":0,"Tags":"python,debugging,pytest,visual-studio-2022","A_Id":72178245,"CreationDate":"2022-05-06T01:24:00.000","Title":"Cannot debug pytest tests in Visual Studio 2022 -- symbols not loaded for my python code","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am following along an Edureka video from 2020 about random forest models in Python in preparation for a data science internship.   I am trying to follow the speaker's code, but I am running into an issue when I copied his\nimport pydotplus\ncode.   Here is the code I tried instead after some searching.   It is the first block that was not giving me a syntax error, but it seems to be taking an indefinite amount of time to run.\nimport sys\n!{sys.executable} - m pip install pydotplus\nAny ideas on how I can improve the code?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":47,"Q_Id":72153583,"Users Score":0,"Answer":"Edit\nI think I found the issue.\npip install pydotplus\nshould work.   I think I just needed to refresh the kernel and run everything again!","Q_Score":0,"Tags":"python,jupyter-notebook,anaconda","A_Id":72153788,"CreationDate":"2022-05-07T14:46:00.000","Title":"How can I install pydotplus in Jupyter Notebook via Anaconda?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":1},{"Question":"img_height,img_width=180,100 batch_size=32 train_ds = tf.keras.preprocessing.image_dataset_from_directory(data_dir1,validation_split=0.01,subset=\"training\",seed=123,image_size=(img_height, img_width),batch_size=batch_size)\nOutput: Found 1376 files belonging to 4 classes.\nUsing 1363 files for training.\nhow can I get the total number of classes in a variable?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":39,"Q_Id":72167658,"Users Score":0,"Answer":"label_map = (train.ds.class_indices)","Q_Score":0,"Tags":"python,tensorflow,keras","A_Id":72168046,"CreationDate":"2022-05-09T06:15:00.000","Title":"how to obtain the number of classes using tf.keras.preprocessing.image_dataset_from_directory?","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have a question about working with huge amount of data. I am working with Google Big Query (i don't think it is a problem of this DB) and need to SELECT data from one table, change it (using python) and then INSERT to another table. Could you tell me, how can i speed up these operations. I use the for loop for each row of my SELECT command. And working with only 15k rows is very long-time process. Maybe multithreading or some libraries could help me to do EXACTLY the same function to all of my >15k rows in DB. Thanks.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":46,"Q_Id":72171831,"Users Score":0,"Answer":"Missing some details about the process (which DB server is it ?)\nAnyway, The best approach would be:\n\nFetch by buffering: dbChunk = \"DB Cursor\".fetchmany(buffer_size)\nChange the data in Python  Data structures (LIST) ==> dbChunk2\nLoad into second table, using \"DB Cursor\".executemany(InsertString, dsChunk2)\n\ndsChunk2 is the updated LIST item where data was fetched into ([ (...), (...), ... ])\n\n\n\nyou can tune the buffer_size to get the best results. (start with 1000,I think)\nNote: InserString should be included Columns, Values and bind variables - match to the Select statement.","Q_Score":0,"Tags":"python,sql,database,loops,google-bigquery","A_Id":72172135,"CreationDate":"2022-05-09T12:14:00.000","Title":"How to speed up my python code working with DB?","Data Science and Machine Learning":0,"Database and SQL":1,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm just learning learning python and don't know many things. At the moment I'm building a telegram bot that can help you to find appropriate text to read in foreign lang.\nThe core function I want to implement is:\nThe bot suggest you the text to read based on you your vocabulary. (when you mark a text as \"read\", all the words are added to your dictionary. like that bot collects info)\nFor example you are user A, you know 500 words, and you want to get the text from the bot database where you know at least 75% of words or at least 90% of words.\nRight now I have the database of user words and texts. How should I approach indexing, that whould tell me how many words user know from each text?\nObviously, I can compare the list of user words with the list of words from each text at every bot start. But I'm not sure if it is the most efficient way. Each time indexing 100+ texts feels like a strange idea.\nCould you please suggest me where can I read about similar problems? Or how can i search it? I don't even know how to google it...","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":18,"Q_Id":72173449,"Users Score":0,"Answer":"You can use database like Elasticsearch that allows you to do full-text search. And when you'll query with user words, it will also give you confidence value, with which you can decide which text has better matching.","Q_Score":0,"Tags":"python,algorithm","A_Id":72174811,"CreationDate":"2022-05-09T14:14:00.000","Title":"How to approach a search\\comparison problem for the large database?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm just learning learning python and don't know many things. At the moment I'm building a telegram bot that can help you to find appropriate text to read in foreign lang.\nThe core function I want to implement is:\nThe bot suggest you the text to read based on you your vocabulary. (when you mark a text as \"read\", all the words are added to your dictionary. like that bot collects info)\nFor example you are user A, you know 500 words, and you want to get the text from the bot database where you know at least 75% of words or at least 90% of words.\nRight now I have the database of user words and texts. How should I approach indexing, that whould tell me how many words user know from each text?\nObviously, I can compare the list of user words with the list of words from each text at every bot start. But I'm not sure if it is the most efficient way. Each time indexing 100+ texts feels like a strange idea.\nCould you please suggest me where can I read about similar problems? Or how can i search it? I don't even know how to google it...","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":18,"Q_Id":72173449,"Users Score":0,"Answer":"You don't need to process every text at every bot start.\nProcess every text once.\nThen write the results of all the processing to a file. When the bot starts, recover the data by reading that data file.","Q_Score":0,"Tags":"python,algorithm","A_Id":72174569,"CreationDate":"2022-05-09T14:14:00.000","Title":"How to approach a search\\comparison problem for the large database?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have a text file with lines like this one:\nCubo: 100% (left_x:  744   top_y:  395   width:  167   height:  181)\nI would like to assign the appropiate int for each one of the variables, something like: left_x = 744, top_y = 395, width = 167, height = 181 but without having to do it manually.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":38,"Q_Id":72190387,"Users Score":0,"Answer":"You can open a file by using the open method. For example, you could do\nexternal_code = open(\"src\/external_path.txt\")\n... and get the text inside of the file by doing...\ntext = external_code.read()\nBecause it returns the string, you will need to parse the data from it.\nFor the parsing, I am unsure what would the best route for it. You could split the string different keywords and set your variable based on what number resides with the keyword...\nAlso, you may want to include more information next time you post; people tend to get a little annoyed with it. :\/","Q_Score":0,"Tags":"python","A_Id":72190590,"CreationDate":"2022-05-10T17:03:00.000","Title":"how do I find and get text from a text file in python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"We use opnerp (odoo) on a linux server (debian), I want to locate the python interpreter used by the odoo daemon,\nSo the question is how I can change the path to my new python interpreter.\nIn other words, how does odoo choose its interpreter to run the modules?","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":30,"Q_Id":72221834,"Users Score":1,"Answer":"In odoo-bin its called out like #!\/usr\/bin\/env python3","Q_Score":1,"Tags":"python,linux,odoo","A_Id":72222480,"CreationDate":"2022-05-12T20:38:00.000","Title":"what is the python interpreter for odoo serveur (openERP)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Many answers about using the Youtube Data API v3 to get the thumbnail of a playlist; and many answers for how to get or set the thumbnail of a video.\nBut none about how to set the thumbnail of a playlist. The documentation shows nothing and no searches into the API documentation or Stack Overflow find the question or its answers.\nI tried using the thumbnails().set() method for setting thumbnails to videos, but that returns a permission denied error indicating that using playlist IDs in its request for video IDs is not a good monkey patch.\nPlease help.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":36,"Q_Id":72230074,"Users Score":0,"Answer":"My original question is invalid.\nYouTube allows users to set thumbnails of videos to be any properly formatted image. YouTube then only allows users to set a specific video thumbnail as the playlist thumbnail. It is not possible to set an image as the thumbnail of the playlist unless it is a thumbnail of a video in that playlist; and in that use case the video is associated to the playlist for the representative thumbnail.","Q_Score":1,"Tags":"youtube-api,youtube-data-api,google-api-python-client","A_Id":72244432,"CreationDate":"2022-05-13T13:04:00.000","Title":"Q: set thumbnail of a playlist?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":1,"ERRORS":1,"REVIEW":0},{"Question":"I am doing a little project where i have prepared the back end in python and the graphic user interface woth HTML, CSS & JS.\nThe python script doesn't require any external librariesand the only thing that it does is opening a JSON file with the data processed, since it's a game the results are casually generated, and because of this I don't have to pass any parameters to the script.\nThe problem is that I don't know how to trigger the script so it generates the json that i can access trough JabaScript.\nthe scheme of the project is this:\nindex.html\npages (folder)\n\nnewGame.html\nloadGame.html\nrules.html\n\npython (folder)\n\npython_script1.py\npython_script2.py\npython_script3.py\nmain.py\n\nspecifically i have to trigger the script once the user has loaded the newGame page or the loadGame one.\n(obiuvsly the js isn't node.js is actual client-side JavaScript)\nI obiuvsly did some research and i found the pyodyde open source project does what i want, the fact is that i can't figure out how to connect the interface file with the back-end one with this resource.","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":58,"Q_Id":72243590,"Users Score":0,"Answer":"But than, once i typed in the command and created the html file from the python script, how do I connect it to the \"newLevel\" page?","Q_Score":0,"Tags":"javascript,python,browser,client-side","A_Id":72246099,"CreationDate":"2022-05-14T20:16:00.000","Title":"Trigger A Python Script By Using JavaScript","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am researching uses for Javacards and smartcards utilizing\ndifferent ATRs. I want to change these card's ATRs via python to be\ndifferent from the OEM ATR that comes on these cards as default. I\nfigured out a way to change the card's atr, however, it is utilizing a\nscript online - which really doesn't help.\nBelow is the script I found to change the ATR using PyResMan\nscript mode, however, it is only set to one atr, which is a bank and I\nhave no use for it.\nThe Script I found Online: {\n(Beginning numbers show line numbers)\n\n00A4040010********************************\n\n00F00000\n\nC0D6029A02F807\n\nC0D601240108\n\nC0D601470108\n\nC0D601260403600000\n\nC0D601490403600000\n\nC0D6012201FE\n\nC0D601360E0D80318065B0893501F183009000\n\nC0D601590E0D80318065B0893501F183009000\n\nC0D603010101\n\nC0D6030510404142434445464748494A4B4C4D4E4F\n\nC0D6031d0101\n\nC0D6032110404142434445464748494A4B4C4D4E4F\n\nC0D603390101\n\nC0D6033D10404142434445464748494A4B4C4D4E4F\n\n\n}\nThe problem with this script is that I only know what the first 2\nlines do, and that lines 9&10 are the lines that actually contain the\ndata for the ATR changing process. I need to know how I can change the\nATR using the ATR in regular expression form.\nIf anyone knows a way to decode this script, and be able to edit it,\nor knows an easier way to change the ATR of an Unfused or non\npre-presonialized javacard, please let me know! I've been researching\nthose for over a month now, and cannot find an answer that actually\nworks.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":21,"Q_Id":72266413,"Users Score":0,"Answer":"Setting the ATR for a smartcard is not primarily the domain of Javacard specification. Today there is no generic specification or method to set the ATR for all smartcards, as there is no universal way to initialize or personalize the smartcard itself and this is mostly vendor specific.\nThe script that you found online belongs to an NXP Javacard, this information is not standardized and is also not intended for public use to my knowledge, therefore is removed some sensible information. Please contact your card vendor to get information on how to change the ATR(it might not be possible or easy).","Q_Score":1,"Tags":"python,smartcard,javacard","A_Id":72270470,"CreationDate":"2022-05-16T22:53:00.000","Title":"Changing A JavaCard's ATR","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Looking for a way to be able to find the color data of a pixel(s) on a Canvas. I'm sort of a beginner to coding, just gauging if this is possible\/how to go about this. This is for a project I've been working on, and for part of it, it's necessary to compare the color data of a Canvas to an Image. I know how to find the per pixel color data of an Image, but I haven't found anything for a canvas. I'm using a Tkinter Canvas at the moment, but if it's not possible on that library, I'm open to switching to another library. Any ideas? Thanks guys!","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":30,"Q_Id":72266604,"Users Score":0,"Answer":"Looking for a way to be able to find the color data of a pixel(s) on a Canvas.\n\nTkinter doesn't provide the ability to do this.","Q_Score":0,"Tags":"python,tkinter,canvas,colors","A_Id":72266773,"CreationDate":"2022-05-16T23:22:00.000","Title":"How to get color of pixel on Tkinter Canvas in Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have installed miniforge on my mac , in that using a 'local env' on jupyter notebook. I can't change the numpy version (need to downgrade to 1.19.5) on this kernel, have tried:\n(1)pip install numpy==1.19.5 &\n(2)conda install -c conda-forge numpy=1.19.5.\nnumpy version seems to be changing easily on conda-ipython3 kernel, but my project is running on 'local env'\nvery new to all this, still learning. Please help","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":29,"Q_Id":72303328,"Users Score":0,"Answer":"first make sure that your local environment is activated by running: ...\/{your venv folder path}\/Scripts\/activate. Because if you install numpy on the wrong virtual environment then it won't work.\nThen uninstall numpy by running pip uninstall numpy. Then install the numpy version you want.","Q_Score":1,"Tags":"python,macos,numpy,pip,virtualenv","A_Id":72303828,"CreationDate":"2022-05-19T10:59:00.000","Title":"how to change numpy version with miniforge","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":1,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"There probably isn't one \"right answer\" to this question. I'm interested in thoughts and opinions.\nWe have a couple hundred RHEL7\/Centos7\/Rocky8  nodes. Many of them have python modules installed via pip\/pip3.\nI've been searching for a best practices on routine\/monthly patching these modules...so I far haven't found any. Obviously things installed with rpm\/yum\/dnf are pretty easy to deal with.\nFrom the pip man page:\npip install --upgrade SomePackage\nGreat!\nBut how do you update all of them?\nSure. It is possible to do a \"pip list\/freeze\" pipe that to awk...etc..\nSurely, there's a better way. Ideally, one that captures things like \"boto3 V1.2 replaced with boto3 V1.3\"\nRight now it feels like I'm the only one thinking about this. Maybe I am and it is stupid. I'm ok with that response as well (but please tell me why).","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":15,"Q_Id":72306570,"Users Score":1,"Answer":"A common solution is to deploy the application code inside a Docker container - the container image contains its own version of Python and all the dependency modules, so you don't have to update each module on all the host machines individually.  It also means that the combination of OS, Python and modules that you deploy can be tested and then \"frozen\" into an immutable image which is then deployed the same everywhere.\n\nRight now it feels like I'm the only one thinking about this.\n\nI realise the above answer is probably not helpful in your situation as you already have a fairly large system deployed...  but it might help to explain why not many people are developing solutions to your problem!","Q_Score":0,"Tags":"python,linux,security,pip,patch","A_Id":72306793,"CreationDate":"2022-05-19T14:39:00.000","Title":"Patching Linux systems with python modules installed via pip","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":1},{"Question":"I need reflection, vision and documentation on my problem.\nI wrote a python script to calculate something from an API and export the result in a CSV file. Then, I use a JavaScript script to display the data from this CSV file on a building website.\nI need to have the latest data available for my website, so I opened a VM instance in Google Cloud Platform (Google Compute Engine) and set a Crontab job to run automatically my python script. The calculation is now executed every day and the result is exported to the CSV file, but stored in this VM instance.\nHere is my goal: How can I get my CSV file on my website? The CSV is always on the virtual machine and I do not know how to communicate with my JavaScript script to the VM. Do I have to communicate directly with the VM? Do I have to go through another step before (server, API, etc.)?\nI cannot find a specific solution for my problem on the internet.\nThanks in advance.","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":64,"Q_Id":72308508,"Users Score":0,"Answer":"How can I get my CSV file on my website?\n\nBy making your python script output the CSV into your website's root folder.\nExample, if you're running apache, chances are your root folder is somewhere in \/var\/www\/html\/...\nIf the script is generated from another machine (not the one with your website), then I would host it and make the server hosting your website fetch it via cronjob.\nBasically:\nIf your CSV is generated from the same machine as the website that will use it - simply output it to the website's folder\nIf your CSV is generated from another machine, make it publicly accessible and have your website's machine cronjob fetch that CSV a few minute after it's generated.","Q_Score":0,"Tags":"javascript,python,python-3.x,csv,google-cloud-platform","A_Id":72326689,"CreationDate":"2022-05-19T17:05:00.000","Title":"I'm looking to connect a Google VM to a website","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I\u2019m trying to figure out how to get a list of all substrings within a given range of lengths. For example, I have a string of n= 123456789 and I need to get all substrings between mmin and mmax. Let\u2019s define mmin=7 and mmax=9.\nHow would you loop over the range of 7 to 9 to produce a list of substrings from n with a length that is within the range? The function should be dynamic to handle any range as long as it doesn\u2019t exceed the length of the initial string. I\u2019m expecting substrings with a length of 7,8,9","AnswerCount":2,"Available Count":1,"Score":-0.0996679946,"is_accepted":false,"ViewCount":32,"Q_Id":72313010,"Users Score":-1,"Answer":"if mmax < len(n):\nsub_string = []\nfor i in range(mmin, mmax):\nsub_string.append(n[i])","Q_Score":0,"Tags":"python,python-3.x,algorithm","A_Id":72313157,"CreationDate":"2022-05-20T02:41:00.000","Title":"How to get list of substrings within a range of lengths?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"My project is the conception and realization of a web application for the detection of ransomwares based on machine learning.\nFor the realization, I made a web application with python, Django, HTML and CSS.\nOn the other hand i have to create a machine learning code that makes the detection of these ransomware viruses.\nNow what I have to do is deploy the machine learning code in my web app.\nI'll explain a little how it works, the user first registers and then he chooses a csv file to scan, he uploads it and then he chooses the machine learning model he wants  use and then he clicks on scan, when he clicks on scan the file will be scanned by the model he has chosen and a result will be returned to him which is either 1: the file is a ransomware or 0: it is not a ransomware.\nSo,\nI built the web app, I built the model\nNow my problem is how to pass user input to the model\nAnd than take the model's out put to the user.\nNeed help please.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":40,"Q_Id":72315885,"Users Score":0,"Answer":"I've managed to do something like this using a deep learning model.\nIt's fairly simple everything you're doing in python can be done in the django project you just have to create views and forms to handle the user data input.\nSo you're either new to django or want the whole code snippets ?","Q_Score":0,"Tags":"python,django,machine-learning","A_Id":72322203,"CreationDate":"2022-05-20T08:35:00.000","Title":"How to deploy a machine learning model in a django web app?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have a series of lists with 7 elements (but could be any number). I am trying to find the lists that have all positive elements, all negative elements, and those that change sign at ANY point,\nfor example [3, 6, 7, -2, -5, -1, -1] or [3, 1, -1, -2, -1, -5, -1].\nNote that, though I used integers in my example, the lists are actually made of floats.\nI can easily find all lists that are always positive or negative, but how do I find those that change sign (it could go from positive to negative as in example or from negative to positive).","AnswerCount":3,"Available Count":1,"Score":0.0665680765,"is_accepted":false,"ViewCount":29,"Q_Id":72320439,"Users Score":1,"Answer":"Use the for loop to iterate from 0th element to penultimate element and compare the signs or check if the product of 2 consecutive numbers is less than 0.\nIf yes, then append the elements in the list.","Q_Score":0,"Tags":"python,pandas,list,dataframe","A_Id":72320504,"CreationDate":"2022-05-20T14:16:00.000","Title":"Find sequences where all elements have same sign and then change sign","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have 2 Python servers which are cyclically receiving data from 2 different sensor systems. Both servers are running fine individually.\nI would now like to run both servers simultaneously and process the received data together in one application which receives the data from one of the servers and then requests the data from the other server. However, I currently have no approach how I could implement this in an efficient way.\nDoes anyone here have an approach, a similar problem or an idea how this could be implemented efficiently?\nThanks in advance! :)","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":24,"Q_Id":72320611,"Users Score":0,"Answer":"if you are working with IOT system, i think you should use mqtt broker","Q_Score":0,"Tags":"python,server","A_Id":72320744,"CreationDate":"2022-05-20T14:28:00.000","Title":"Run 2 Python servers simultaneously and process received data","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have a file that is only local, and I wanted to see if there is a way to show the changes or last saves made to the file.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":50,"Q_Id":72344823,"Users Score":0,"Answer":"If you keep vscode up to date in recent update devs introduced local history that is independent of git. You can find it by searching for Local History in command pallet (you can access it with CTRL+Shift+P by default)","Q_Score":0,"Tags":"python,visual-studio-code","A_Id":72344904,"CreationDate":"2022-05-23T07:37:00.000","Title":"How to show a VSCode file\u2019s change history that isn\u2019t a got repository","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have a problem at work where I need to perform series of sequential tasks on different devices. These devices do not need to interact with each other and also each of the sequential tasks can be performed on each of the devices independently.\nAssuming I have Tasks (A->B->C->D)(Ex: End of A triggers B and end of B triggers C and so on), Devices(dev1, dev2) can execute these tasks independent of each other.\nHow can I design a centralized system that executes each task on each device. I cannot use Threading or Multiprocessing due to Infra limitations.\nI'm looking for some design suggestions(Classes) and How I can go about designing it.\nFirst approach I thought about was brute force where I blindly use loops to loop over devices and perform each task.\nSecond approach I was reading about State Design Pattern and I was not sure how I can implement it.\nEDIT: I have implemented the answer I have provided below. However I would like to know the correct way to transfer information between states. I know states needs to be mutually exclusive but each task needs to access certain resources that are common amongst all the resources. How can I structure this ?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":14,"Q_Id":72388072,"Users Score":0,"Answer":"I probably try something with flask for super simple api and a client app on devices that \"pool\" data from center api and post results so center server know the progress and what is current used. client app would be super simple loop with sleep so it wont 100% cpu without needed.","Q_Score":0,"Tags":"python-3.x,data-structures,design-patterns","A_Id":72388960,"CreationDate":"2022-05-26T07:09:00.000","Title":"Designing a system to centrally manage series of events on different systems","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have running python file \"cepusender\/main.py\" (and another python files), how can i restart\/kill only main.py file?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":29,"Q_Id":72410838,"Users Score":0,"Answer":"kill is the command to send signals to processes.\nYou can use kill -9 PID to kill your python process, where 9 is the number for SIGKILL and PID is the python Process ID.","Q_Score":1,"Tags":"python,linux,ubuntu,script,terminate","A_Id":72410937,"CreationDate":"2022-05-27T20:37:00.000","Title":"How to restart specific running python file Ubuntu","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I need help trying to find out how to get the X position of the right side of the text, not to be confused with anchors or alignments, I haven't seen this be answered anywhere so if you could help then that would be great!","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":9,"Q_Id":72411779,"Users Score":0,"Answer":"Sovled it on my own:\nWhat you need to do is:\nProvide the text e.g: test = \"hello\"\nthen get mask and box e.g: test_width = FontNameHere.getmask(test).getbbox()[2]","Q_Score":0,"Tags":"python-imaging-library","A_Id":72440561,"CreationDate":"2022-05-27T23:04:00.000","Title":"How would I get the X postion of the right side of text in pillow","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am currently trying to develop an employee scheduling tool in order to reduce the daily workload. I am using pyomo for setting up the model but unfortunately stuck on one of the constraint setting.\nHere is the simplified background:\n\n4 shifts are available for assignation - RDO (Regular Day Off), M (Morning), D (Day) and N (Night). All of them are 8-hrs shift\nEvery employee will get 1 RDO per week and constant RDO is preferred (say staff A better to have Monday as day off constantly but this can be violate)\nSame working shift (M \/ D \/ N) is preferred for every staff week by week (the constraint that I stuck on)\na. Example 1 (RDO at Monday): The shift of Tuesday to Sunday should be \/ have better to be the same\nb. Example 2 (RDO at Thursday): The shift of Mon to Wed should be same as the last working day of prior week, while the shift of Fri to Sun this week also need to be same but not limit to be which shift\n\nSince the RDO day (Mon - Sun) is different among employees, the constraint of point 3 also require to be changed people by people conditionally (say if RDO == \"Mon\" then do A ; else if RDO == \"Tue\" then do B), I have no idea how can it be reflected on the constraint as IF \/ ELSE statement cant really work on solver.\nAppreciate if you can give me some hints or direction. Thanks very much!","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":22,"Q_Id":72432296,"Users Score":1,"Answer":"The constraints you are trying to create could be moderately complicated, and are very dependent on how you set up the problem, how many time periods you look at in the model, etc. etc. and are probably beyond the scope of 1 answer.  Are you taking an LP course in school?  If so, you might want to bounce your framework off of your instructor for ideas.\nThat aside, you might want to tackle the ROD by assigning each person a cost table based on their preferences and then putting in a small penalty in the objective based on their \"costs\" to influence the solver to give them their \"pick\" -- assumes the \"picks\" are relatively well distributed and not everybody wants Friday off, etc.\nYou could probably do the same with the shifts, essentially making a parameter that is indexed by [employee, shift] with \"costs\" and using that in the obj in a creative way.  This would be the easiest solution...  others get into counting variables, big-M, etc.","Q_Score":0,"Tags":"python,scheduling,pyomo","A_Id":72436983,"CreationDate":"2022-05-30T09:47:00.000","Title":"Employee Scheduling Constraints Issue","Data Science and Machine Learning":0,"Database and SQL":1,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I deleted .idea on pycharm, how can I regenerate it?\nI tried looking for project structure but can't find it.\nI searched in Google \"how to regenerate .idea\" and found no explanation.\nHow can I do it on Mac, and how can I do it on Windows?","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":27,"Q_Id":72459027,"Users Score":1,"Answer":"Re-opening the directory\/folder from within PyCharm will create a new .idea directory structure.","Q_Score":0,"Tags":"python,pycharm","A_Id":72474035,"CreationDate":"2022-06-01T08:57:00.000","Title":"I deleted .idea on pycharm, how can I regenerate it?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Am building a model using K nearest neighbours. The model predicts if someone has cancer or not. 1 for true, 0 for false. I need the model other than predicting presence of cancer or not giving a 0 or 1,how can i make the model also show the probability of the prediction being 1?\nEdit:Am doing a project and it specifies i use the K nearest Neighbour classifier","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":36,"Q_Id":72487146,"Users Score":0,"Answer":"You must use a regressor instead of a classifier, meaning that a regression model can give you a probability of someone having a concern or not and the probability between the two values of 0 and 1, 0~1 (0~100%).","Q_Score":0,"Tags":"python,pandas,numpy,scikit-learn","A_Id":72487230,"CreationDate":"2022-06-03T08:58:00.000","Title":"How to make a model predict probability","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I hope this isn\u2019t off topic, I am not really sure which forum to use for a question like this:\nI have a series of datapoints of about an hour in time from a sensor that retrieves data 20 times per second. Along with it I receive timestamps of a periodic event in this data in the format of %Y-%m-d %H:%M:%S.%f, which looks e.g. like this 2019-05-23 17:50:34.346000.\nI now created a method to calculate these periodic events myself and was wondering how I could evalute my methods accuracy. My calculations are sometimes bigger and sometimes smaller by a few milliseconds compared to the actual timestamp. But when I run my own calculated timestamp against the actual timestamp by using pythons scipy.stats.pearsonr(x,y) method, I always receive a correlation of nearly 1. I assume that\u2018s because these small differences in the order of millisenconds don\u2018t seem relevant in an hour of data. But how could I evaluate the accuracy of two timestamps a reasonable way? Are there better metrics to use than the correlation?","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":11,"Q_Id":72490580,"Users Score":1,"Answer":"It seems that you are trying to compute a linear statistical correlation (pearson) for something that is, by nature, a timeseries data. This will not tell you much and drawing a conclusion based on the results is dangerous.\nIt so happens that your two vectors x and y are growing linearly in the same direction which is not surprising given that they are timestamps.\nLet's take an example for stationary data and time series data:\nTime series data:\nYour sensor starts giving measurements at time t1 and continues to do so until time t2 is reached. You compute the periodic event's timestamp using your own method then compare it to the actual timestamp. However, there is no reliable way using linear statistical correlations to see if the two are related and how related are they.\nStationary data :\nNow consider the same sensor giving measurements, but now instead of computing your periodic events all at once, take a single event and compute it multiple times using your empirical data using different measurements (so forget about any notion of time at this point (i.e. repeat the measurement multiple times). The result can be averaged and an error on the mean can be computed (see info on standard error). This, now, can be compared to your single event. Based on the error, you can get a more or less feel of how good or bad your method is.\nI would recommend the following :\n\nYou have your ground truth answer (say, the periodic event) y_truth. You compute a vector of the periodic events based on your sensor and your own method mapped as a function  f(sensor_input) = y_measured\n\nNow you have two vectors, one measured and one that is ground truth. In each of those vectors, you have an indicator of a the periodic events such as an  id. I would repeat the whole set of measurements, on all  id's tens of times.\n\nFor each 'id' I would compute whatever measurement you are looking for (either a timestamp or time in seconds or whatever...) then I would subtract the two timestamps :  |y_truth - y_measured|. This is called residuals or in other words, your error.\n\nNow averging all the residuals of all the id's gives you something called mean absolute error (1\/n * sum (|y_truth - y_measured|) which you can very confidently use to report how much error, in a unit of time (seconds for example), your method produces.","Q_Score":0,"Tags":"python,statistics,timestamp,correlation","A_Id":72491026,"CreationDate":"2022-06-03T13:47:00.000","Title":"Correlation between timestamps","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I need advice. I want make 3 types of user:\n\nmember (only nickname\/password\/email)\ncompany (nickname\/password\/email\/company\/regon + permision for edit model)\nadmin\n\nMy question is aobut how make model for this users:\n\nmake big model for member and company together but field which are only for comapny make empty for member. Next to by admin panel i can make group and add \"comapny\" ppl\nmake 2 type of user (here i will need advice like what i should use on it) and seperate website register for member and company and login should be the same form\n\nThank you for answer","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":19,"Q_Id":72492175,"Users Score":0,"Answer":"You can achieve this simply by creating a Boolean field for each type of user (member, company, admin) in your User model. Save the different type of users from different URLs, when save just change the Boolean flag into True. Then, you can handle the user in view like if user_type.member: and so on. It also can be achieved by using Enum (choice) field.","Q_Score":0,"Tags":"python,django,django-models,user-permissions,django-users","A_Id":72493387,"CreationDate":"2022-06-03T15:53:00.000","Title":"Django, more type of user - I need advice","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I want to run a Python script in my terminal (mac) that takes a csv file as input. At the beginning of the Pyton script, a package named cvxpy is imported. When running the code with data in the terminal I get the error:\nImportError: No module named cvxpy.\nI'm feeling it's a directory fault, but I don't know how to fix this (e.g. how to get the Python script and python packaga in the same directory)\nSomebody got a clue?\nThanks.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":59,"Q_Id":72560729,"Users Score":0,"Answer":"You need to have the module installed.\nTo install it, type : pip3 install cvxpy\nIf you already have it installed, please double check by typing pip3 list","Q_Score":0,"Tags":"python,terminal,package","A_Id":72560782,"CreationDate":"2022-06-09T12:58:00.000","Title":"Import python package from terminal","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"Im trying to convert pine script to python. I use security function for requesting data in pine script. Can someone help me how the exact implementation would be ?\nsecurity(tickerid, timeframe, close, gaps=barmerge.gaps_off, lookahead=barmerge.lookahead_on)\nAlso im using lookahead_on (this is basically used for backword compatibility for pine script version i guess)\nI tried to find security function lib code but couldn't find it.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":201,"Q_Id":72562201,"Users Score":0,"Answer":"For example if running a strategy looking at the 4h timeframe candle stick. You can have a timer running on an hourly timeframe and look a the 4h timeframe candle stick for the candle which hasn't yet closed and do your calculations there.\nOne drawdown from making calculations before the candle stick is close is that the trend may change and produce a different outcome by the time the candle is closed.\nIt may give you early signals but it may also give false signals. Pick your poison.","Q_Score":0,"Tags":"python,python-3.x,pine-script,algorithmic-trading,pine-script-v5","A_Id":73140676,"CreationDate":"2022-06-09T14:35:00.000","Title":"Convert security function in pine script to python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"When preforming image co-registration of multiple subjects, how should we select the reference image?\n\nCan a randomly selected image form one dataset could be the reference image for an image from the other dataset?\nIf we do that, should all the images belonging to the reference image dataset be co-registered with the reference image as well?\n\nI couldn't find any material in this area. Could someone please advice?","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":92,"Q_Id":72566603,"Users Score":1,"Answer":"I'm not sure exactly what you mean by the term \"dataset\", but I will assume you are asking about co-registering multiple images from different patients (i.e. multiple 3D images per subject).\nTo answer your questions:\n\nIf there are no obvious choices about which image is best, then a random choice is fine. If you have e.g. a CT and an MRI for each subject, then co-registration using the CT images is likely going to give you better results because of intrinsic image characteristics (e.g. less distortion, image value linked to physical quantity).\nI suppose that depends on what you want to do, but if it is important to have all imaging data in the same co-registered reference space then yes.\n\nAnother option is to try and generate an average image, and then use that as a reference to register other images to. Without more information about what you are trying to achieve it's hard to give any more specific advice.","Q_Score":1,"Tags":"python-3.x,registration,medical-imaging,simpleitk","A_Id":72654397,"CreationDate":"2022-06-09T21:02:00.000","Title":"3D Image co-registration between multiple subjects","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":1,"ERRORS":0,"REVIEW":0},{"Question":"I recently came across the Google Coral dev board mini in search of a ML microcontroller platform for a robotics and speech recognition project. I realized that there are minimal tutorials on creating projects from scratch for the dev board mini but a ton of example projects. The problem with these example projects is that it gets imported through a git clone through the Mendel linux terminal, which doesn't really tell me how to create my own project and where to compile and code it. To make things more clear I will use the ESP32 dev board as an example:\nTo write a program (C++) on a ESP32 dev board that controls the I\/O pins, I used PlatfromIO to compile and flash the microcontroller. What IDE can be used to perform the same functionality on the Google-Coral dev board mini? Does there exist an article about this?\nSorry if my question seems obvious, but I feel that I spent too much time searching for the solution. Thanks in advance! :)","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":89,"Q_Id":72573384,"Users Score":0,"Answer":"The Google Coral dev board mini is a single board computer running a full Linux operating system, whereas the ESP32 is a microcontroller which does not run an OS, it is only flashed with a single C++ program. The difference is the same as a Raspberry Pi and an Arduino. Since the Coral dev board has a full OS, you can plug a monitor, mouse, and keyboard into it and develop code directly on it. Or you can use your PC to ssh into the coral board to copy files over and remotely run commands. Through these ways you can use any IDE you want.","Q_Score":0,"Tags":"python,google-coral","A_Id":73831913,"CreationDate":"2022-06-10T11:14:00.000","Title":"How does one run a blink LED program on Google-Coral dev board mini and what IDE is recommended?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":1},{"Question":"im trying to learn how to fetch API using python-flask with heroku as the cloud service\nin the app, there's a key to communicate with the source server and i set the config variable (config vars) like\nX_App_APIKeys = {key strings} \nhow can i use the variable as an object in my code?\ni.e : myapikeys = X_App_APIKeys","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":112,"Q_Id":72582586,"Users Score":0,"Answer":"Simply import os\nThen myapikeys = os.environ['X_App_APIKeys']\nNotice that this only works on the live app deployed on Heroku when the config has been set up. To run your local instance, replace it with your real key instead.","Q_Score":0,"Tags":"python,heroku","A_Id":72596197,"CreationDate":"2022-06-11T07:46:00.000","Title":"How to set heroku config vars as an object in python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have a Python file on a Unix server, that will run 18 hours a day. The file will be run with Cron each day. The file has A while True loop with sleep. Assuming there is no uncaught exception, can this file run for this long? or how long can it run?\nI have a background in PHP, and know there is a maximum execution time, is there a such thing in Python?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":155,"Q_Id":72586647,"Users Score":0,"Answer":"Yeah, no problem. Python files are interpreted without such configuration in mind, so the process will run as long as you need it to.","Q_Score":0,"Tags":"python,infinite-loop","A_Id":72586668,"CreationDate":"2022-06-11T17:47:00.000","Title":"How long can a Python file run without crashing","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"I'm writing a simple mod manager which uses the nexus website to download the mod. When on the website, there is an option to download a given mod as a file or via a mod manager, the latter being an \"nxm\" link. I figured out how to associate a program with the nxm link through registry editor, but now I don't know how to get any information from that link within the python program. Is there a module that will do it? Essentially, I want to know how to open a python program via a link and have the link as an object which I can use in the program.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":16,"Q_Id":72590966,"Users Score":0,"Answer":"Try using py-script and javascript alongside.","Q_Score":0,"Tags":"python","A_Id":72590999,"CreationDate":"2022-06-12T09:31:00.000","Title":"How to associate a python program to a download link within a browser and get information from it","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":1,"ERRORS":0,"REVIEW":0},{"Question":"I'm using django to create an webapp. I have been asked if I can look at creating a sort of double log in system.\nFor example: A nurse on the ward will open up my webapp and will be met with a login page for their ward. So all nurses on that ward will have that generic log in.\nOnce they've logged in they will be met with a second login page where they can enter their normal user credentials that only they know.\nI'm quite stuck at how to achieve this currently - or if someone could suggest an alternative method I'd be grateful!","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":27,"Q_Id":72605530,"Users Score":0,"Answer":"I would recommend authenticating the user normally, then use some property of that user (maybe a permissions group etc.) to represent the ward they belong too.  Then it follows to restrict that user to information\/pages relevant to their ward","Q_Score":0,"Tags":"python,django,django-login","A_Id":72605594,"CreationDate":"2022-06-13T15:40:00.000","Title":"Creating a double log in system for department and user","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":1},{"Question":"I have been looking for a while at large number generation through seeds and I\u2019ve struggled to find what I am looking for due to how specific it is. I think the main thing that is causing the problems is the size of numbers I want to generate, for example... I want to have it so that I can generate every single number that is 5000 digits long through some form of seed or selective input process. The other problem being that I would like to be able to reverse the process to know how I got there. If I have this number I want to know what inputs or what seed would generate this. Hope this makes sense and I understand this is a extremely specific question.","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":71,"Q_Id":72614356,"Users Score":1,"Answer":"For a problem like this I would use an encryption. Since encryption is a one-to-one process provided you use unique inputs, and keep the same key, then the outputs are guaranteed unique. for unique inputs, encrypt the numbers 0, 1, 2, 3, ... You will need to extend the inputs by adding leading zeros so they are the size you need, enough for the binary equivalent of 5,000 decimal digits.\nThe output from the encryption will be the same size. Just convert the binary output back into the equivalent decimal number. There may be a few boundary cases just over the limit where the decimal and binary boundaries; in those cases just re-encrypt until the result is within the set limit. This is the cycle walking technique from Format Preserving encryption.","Q_Score":1,"Tags":"python,random,input","A_Id":72628073,"CreationDate":"2022-06-14T09:10:00.000","Title":"How can I generate every possible integer in a range without repeats from a seeds that is also reversible","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":1},{"Question":"I am training a CNN model to classify simple images (squares and crosses) and everything works just fine when I use the cpu but when I use the gpu everything works until the training starts and i get this error:\n2022-06-15 04:25:49.158944: I tensorflow\/stream_executor\/cuda\/cuda_dnn.cc:384] Loaded cuDNN version 8401\nAnd then the program just stops.\nDoes anyone have an idea how to fix this?","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":135,"Q_Id":72625342,"Users Score":2,"Answer":"if you use pycharm, you can select the \"Emulate terminal in output console\" option to print detailed error information.\nRun->Edit Configration->Execution ->Emulate terminal in output console\nOn windows, maybe CUDA is missing zlibwapi.dll file, and you can download it and  move it to bin of cuda.","Q_Score":1,"Tags":"python,tensorflow,keras","A_Id":73670094,"CreationDate":"2022-06-15T02:35:00.000","Title":"Training CNN model using keras works with CPU but not with GPU","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"I want to save my codes and i want to restrict it that no one can change it even myself.\nI don't know how to do it. is it possible?\nI know how to share without edit permission. but how to do it for myself","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":168,"Q_Id":72626960,"Users Score":0,"Answer":"There's a Playground Mode in Colab (check File menu), it still allows you to run and change everything but nothing will be saved, that applies to output too. You can also create links to Playground mode Colab Notebooks yourself by appending #forceEdit=true&sandboxMode=true to the URL, i.e colab.research.google.com\/drive\/1R4O...?hl=en#forceEdit=true&sandboxMode=true  and perhaps collect those links into single Notebook and access those files from there.\nBut even if you accidentally do mess up your Notebook, in most cases you can still roll back to pervious revision through Revision history , you can name revisions and manually save & pin your Notebook.\nColab also integrates with Github and you can conveniently save the copy there as well for proper version control - File >> Save a Copy in Github\nWorks with private repositories and Github Gists too. And by default the \"Open In Colab\"  button is added to those files, so no need to manually re-import anything to Colab or GDrive.","Q_Score":0,"Tags":"python,python-3.x,google-drive-api,google-colaboratory,restriction","A_Id":72628455,"CreationDate":"2022-06-15T06:44:00.000","Title":"how can i save the codes in colab and it's permissions","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am having issues with running yolov5 on colab. I was able to run the code fine when I had  I had more classes, and a slightly smaller dataset, but now I have decreased the amount of classes and 70 instances when the overall one has 3400 instances. Now I am getting this error.\nterminate called after throwing an instance of 'c10::CUDAError'\nOther times I will get\n cuda assertion index >= -sizes[i] && index < sizes[i] && index out of bounds\nany idea what could be causing this and how to fix it?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1296,"Q_Id":72645027,"Users Score":0,"Answer":"The issue was that I was not outputting any labels that I said existed. So for example if I claimed that there would be labels \"0\",\"1\",\"2\" in the training dataset. There was no instances of label \"2\".","Q_Score":0,"Tags":"python,pytorch,google-colaboratory,yolov5","A_Id":72645265,"CreationDate":"2022-06-16T11:22:00.000","Title":"issue terminate called after throwing an instance of 'c10::CUDAError'","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"I am using Pandas ExcelWriter to create an excel file from a dataframe. I have also applied formatting on the excel file like Font size, font colour etc\nNow I am trying to convert the excel to CSV using to_csv method.\nAfter conversion, the CSV file is not retaining any formatting done previously.\nMy question is how do I retain formatting in CSV ?","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":196,"Q_Id":72656844,"Users Score":2,"Answer":"CSV cannot store formatting. If you want that, save as an excel file. (Or of course other outputs that save formatting - including HTML - but have other feature drawbacks - it depends on what you need.)","Q_Score":1,"Tags":"python-3.x,pandas,dataframe,export-to-csv,pandas.excelwriter","A_Id":72656926,"CreationDate":"2022-06-17T09:01:00.000","Title":"Pandas to_csv not retaining formatting","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have a column in a dataset that has string and digits, (Column 2),\nI need to extract digits with 10 or more. as (Column 3) \/ output.\nany idea how to do this?\n\n\n\n\nColumn1\nColumn2\n\n\n\n\nA\nghjy 123456677777 rttt 123.987 rtdggd\n\n\nABC\n90999888877 asrteg 12.98 tggff 12300004\n\n\nB\nthdhdjdj  123 jsjsjjsjl  tehshshs  126666555533333\n\n\nDLT\n1.2897 thhhsskkkk 456633388899000022\n\n\nXYZ\ntteerr 12.34\n\n\n\n\nExpected output:\n|Column3|\n|-------|\n|123456677777|\n|90999888877|\n|126666555533333|\n|456633388899000000|\n| |\nI tried a few codes, regex, lambda function, apply, map, but is taking the entire column as one string. didnt want to split it because real dataset has so many words and digits on it.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":40,"Q_Id":72659513,"Users Score":0,"Answer":"Maybe this works:\n\nTake the value of the Column 2\nSplit the values\nfor loop the values\nCheck if the value is numeric and if the length is equal or greater than 10\nGet the value if the previous validation is true\nSet the value to the Column 3","Q_Score":0,"Tags":"python,python-3.x","A_Id":72659618,"CreationDate":"2022-06-17T12:37:00.000","Title":"extract digits >10 from a column with several data types in python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm trying to get the input from a tkinter text widget, but it is coming up with the error:\n_tkinter.TclError: invalid command name \".!text\"\nHere is where I define the textbox: textbox = tkinter.Text(main_root)\nAnd this is how I call the get() function: textbox.get(\"1.0\", \"end-1c\")\nAnyone got any ideas what is going on? Usually this works fine.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":62,"Q_Id":72662220,"Users Score":0,"Answer":"I was calling textbox.destroy() before calling the get() function. This is what caused the error to be raised.","Q_Score":0,"Tags":"python,tkinter,tkinter-text","A_Id":72663264,"CreationDate":"2022-06-17T16:22:00.000","Title":"Why am I receiving a tkinter.TclError when trying to get the content of a text widget?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm trying to change the positions of spellers to a simple format. By changing RW to forward or CM to midfielder. Only there are several values \u200b\u200bin a cell. How do I combine or drop the other values \u200b\u200bin the cell?\n\n\n\n\nplayer\nplayer_positions\n\n\n\n\nmessi\nRW, ST, CF\n\n\nRonaldo\nST,LW\n\n\n\n\nhow do i change RW, ST, CF just simple to Forward?\nAm trying:\ndf.replace(to_replace=r'^RW', value='Forward', regex=True)\nbut then i get:\n\n\n\n\nplayer\nplayer_positions\n\n\n\n\nmessi\nForward, ST, CF\n\n\nRonaldo\nST,LW","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":42,"Q_Id":72683983,"Users Score":1,"Answer":"You can add everything in the replace statement.\ndf = df.replace(to_replace=r'^RW, ST, CF', value='Forward', regex=True)\nor\ndf = df.replace(to_replace=r'^RW\\D*', value='Forward', regex=True)","Q_Score":0,"Tags":"python,pandas,dataframe,jupyter-notebook","A_Id":72684141,"CreationDate":"2022-06-20T08:07:00.000","Title":"combine multiple variables in cell to one variable","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have been encountering this message after trying to import numpy, pandas, matplotlib, and seaborn all by themselves. I am not sure how to fix this. Any suggestions?\nI am using Python 3.8.8, matplotlib 3.3.4, pandas 1.2.4, numpy 1.20.1, seaborn 0.11.1.\nI have recently updated my Anaconda navigator to 2.1.0. Would this possibly have caused any issues?\nIn the shell command, after trying to import each of those packages individually, I see this message:\nIntel MKL FATAL ERROR: Cannot load libmkl_intel_thread.1.dylib.","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":634,"Q_Id":72703299,"Users Score":1,"Answer":"Solution: I reinstalled Anaconda Navigator.","Q_Score":0,"Tags":"python,pandas,numpy,anaconda,conda","A_Id":72704362,"CreationDate":"2022-06-21T15:16:00.000","Title":"How to fix error: \"The kernel appears to have died. It will restart automatically.\" message?","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"I have a streamlit app that is set to run by doubleclicking a *.bat file that contains the command to start the app: streamlit run myApp.py. Does anyone know how to force that app to run in specific python version? My base python is 3.9, I created an environment (conda env create ...) based on python 3.6 where I installed streamlit and created the app and I want it to run there. I open sypder using that environment, double-checked that the env is active (!python --version in the spyder console) but when I run the app using the *bat file, it shows that is running in python 3.8!","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":487,"Q_Id":72705042,"Users Score":0,"Answer":"Although Streamlit is a Python library (and used to be a stand-alone company), streamlit run myApp.py in that context is a reference to an executable streamlit. In cases where there are multiple, you can specify the exact one you want to use:\n\/path\/to\/conda\/env\/streamlit run myApp.py","Q_Score":0,"Tags":"python,environment,python-venv,streamlit","A_Id":72705134,"CreationDate":"2022-06-21T17:42:00.000","Title":"Force streamlit to run in specific python version (or under specific environment)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have a streamlit app that is set to run by doubleclicking a *.bat file that contains the command to start the app: streamlit run myApp.py. Does anyone know how to force that app to run in specific python version? My base python is 3.9, I created an environment (conda env create ...) based on python 3.6 where I installed streamlit and created the app and I want it to run there. I open sypder using that environment, double-checked that the env is active (!python --version in the spyder console) but when I run the app using the *bat file, it shows that is running in python 3.8!","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":487,"Q_Id":72705042,"Users Score":0,"Answer":"\/path\/to\/your\/python -m streamlit run","Q_Score":0,"Tags":"python,environment,python-venv,streamlit","A_Id":74220421,"CreationDate":"2022-06-21T17:42:00.000","Title":"Force streamlit to run in specific python version (or under specific environment)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am developing a program to be constantly listening for data on ignition, and when they send the information, I would add the value to a tag or some property. And the serial data may be sent multiple times. So I have to wait till the window is closed, to stop that process.\nI thought of trying to have a background asynchronous thread to loop or waiting for interrupts in the background constantly, but that doesn't seem to be feasible with the way ignition is structured (to my understanding, I learned ignition 2 weeks ago).\nI tried taking a look at system.serial. But I don't see any way to constantly listen for data.\nIf anyone has any idea on how I would implement this?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":115,"Q_Id":72718688,"Users Score":0,"Answer":"Look into adding a TCP device in the OPC server.  You will be able put the IP and port of the device.\nWith this device, you can add an OPC tag into your tags.  You can then put in a change script to do an action every time the tag changes, which will change with data is detected on that device.","Q_Score":1,"Tags":"python,ignition","A_Id":75213764,"CreationDate":"2022-06-22T16:03:00.000","Title":"How to constantly listen for data from serial port in Ignition","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I know how to add leading zeros for all values in pandas column. But my pandas column 'id' involves both numeric character like '83948', '848439' and Alphanumeric character like 'dy348dn', '494rd7f'. What I want is only add zeros for the numeric character until it reaches to 10, how can we do that?","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":34,"Q_Id":72736848,"Users Score":1,"Answer":"I understand that you want to apply padding only on ids that are completely numeric. In this case, you can use isnumeric() on a string (for example, mystring.isnumeric()) in order to check if the string contains only numbers. If the condition is satisfied, you can apply your padding rule.","Q_Score":0,"Tags":"python,pandas,leading-zero","A_Id":72736895,"CreationDate":"2022-06-23T21:37:00.000","Title":"Adding leading zeros for only numeric character id","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"PS C:\\Users\\gwill\\OneDrive\\Documents\\new luno\\Luno10> pip install dotenv\nFatal error in launcher: Unable to create process using '\"C:\\Users\\gwill\\AppData\\Local\\Programs\\Python\\Python310\\python.exe\"  \"C:\\Users\\gwill\\AppData\\Local\\Programs\\Python\\Python310\\Scripts\\pip.exe\" install dotenv': The system cannot find the file specified.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":76,"Q_Id":72754116,"Users Score":0,"Answer":"It should be pip install python-dotenv.","Q_Score":1,"Tags":"python,visual-studio","A_Id":72754132,"CreationDate":"2022-06-25T13:10:00.000","Title":"I cant get studio code to install dotenv with pip install. Error cant find module, how do I fix it please?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"Have a few questions regarding SnowPark with Python.\n\nWhy do we need Snowpark when we already have Snowflake python connector(freely) that can use to connect to Python jupyter with Snowflake DW?\n\nIf we use snowpark and connect with Local jupyter file to run ML model. Is it use our local machine computing power or Snowflake computing power?If its our local machine computing power how can we use Snowflake computing power to run the ml model?","AnswerCount":5,"Available Count":1,"Score":0.0798297691,"is_accepted":false,"ViewCount":915,"Q_Id":72755915,"Users Score":2,"Answer":"Using the existing Snowflake Python Connector you bring the Snowflake data to the system that is executing the Python program, limiting you to the compute and memory of that system. With Snowpark for Python, you are bringing your Python code to Snowflake to leverage the compute and memory of the cloud platform.","Q_Score":1,"Tags":"python-3.x,snowflake-cloud-data-platform,snowpark","A_Id":72773066,"CreationDate":"2022-06-25T17:23:00.000","Title":"Snowflake SnowPark Python -Clarifications","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have to develop a android application which will capable of doing predictions on device meaning I have to perform every action on the device itself\nThe application has to extract features from audio and feed them to tensorflow lite model for prediction\nFor training the model, I extracted the features from audio using Librosa, but I am not able to find a suitable framework which can help me extract features from audio like librosa and make prediction using tflite model\nI found out that I can do something using Ironpython or python.net in unity but I am still confused about how to achieve it.\nSo my question is whether there is way to run the python script written on android device with unity.\nAlso if there are other frameworks, that can help me achieve my goal of on-device prediction, ,I will welcome those suggestions","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":68,"Q_Id":72761172,"Users Score":1,"Answer":"It was not feasible to accomplish the task using unity effectively.\nI solved the problem using chaquopy plugin for android studio, this enables you to use python with java or you can code the whole android application in python using chaquopy.","Q_Score":1,"Tags":"python,android,unity3d,audio","A_Id":72775590,"CreationDate":"2022-06-26T11:29:00.000","Title":"Using python for obtaining features from audio in unity","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm using a basic Ubuntu 18.04 VPS and I've been using gunicorn3 for a while. I've decided to upgrade to python3.8, however, it's unclear how to make gunicorn3 run python3.8 applications. Is there any way to do so?\nThanks!","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":54,"Q_Id":72776428,"Users Score":0,"Answer":"It seems that there's a package for this called gunicorn3 (this was tested on ubuntu)\nsudo apt-get install gunicorn3\nthen running the following command should work and run gunicorn with python3:\ngunicorn3 --log-level debug --bind 0.0.0.0:30443 server:app","Q_Score":0,"Tags":"python-3.x,gunicorn,ubuntu-18.04","A_Id":72776464,"CreationDate":"2022-06-27T17:52:00.000","Title":"How do I upgrade gunicorn3 to use python3.8 instead of python3.6?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I tried installing Rasterio library using command- pip install rasterio and also used conda commands in anaconda cmd, both are didn't worked and it's taking too long to install so I aborted the process. Let me know in detail how to install raserio library for python?\nI tried with installing GDAL and raterio whl file by using pip commands. It got installed, but when I tried to import module- it's giving me an error saying No module found. Please help to fix this.\nThanks in advance","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":202,"Q_Id":72824231,"Users Score":0,"Answer":"I just had the similar problem, and tl:dr the issue for me was multiple environments, like Ameya said. Here's a longer version of Ameya's spot-on answer with steps to diagnose and fix.\nWithout realizing it, I had two environments going on: my jupyter notebook was running python 3.10 and my global python was running 3.9, and each was looking for site-packages in different locations (\/opt\/homebrew\/Cellar\/jupyterlab\/3.4.7\/libexec\/lib\/python3.10\/site-packages vs \/Users\/\/Library\/Python\/3.9\/lib\/site-packages).\nThis happened because I had trouble with getting python and specifically jupyterlab running on Monterey and the only fix for me was using homebrew to manage the packages. Anything I installed with brew from the command line, went into \/opt\/homebrew\/Cellar... etc and could be seen by my jupyter notebook. Anything I used pip install to get from within an open notebook also went onto this path that my notebook could see. But anything I used pip install from the command line to get, went to the path of the global environment's site packages. Then, my jupyter notebook couldn't see them.\nYou don't mention that you are using jupyter notebook but perhaps something analogous could happen between multiple environments for you.\nYou can check if this is the case for you by doing the following:\n\nstart python from the command line\nimport sys\nrun sys.path\nstart jupyter notebook, or start python from your other environment\nsame thing, import sys, run sys.path\n\nAre they the same? If not, probably pip is putting your rasterio in other python env site-packages.\nTo fix, you can either pip install from within your preferred environment, or copy and paste the site packages corresponding to rasterio from one site-packages location to the other.","Q_Score":0,"Tags":"python,anaconda,geospatial,rasterio","A_Id":73857679,"CreationDate":"2022-07-01T03:58:00.000","Title":"Installing Rasterio","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"So, I am trying to build an automation web app where I can upload pdf files, and then a python code will run which extracts certain data from the uploaded pdf files.\nI know how to make a python code that takes a pdf from my local system and extracts the required data, but how do I make the code use the uploaded pdf files on the web app?\nI plan to deploy this website where the python code can be run on any system using the website, so how exactly do I pass the uploaded file as input to the python code?\nAlso, will using Flask make it easier to approach this?","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":117,"Q_Id":72826337,"Users Score":1,"Answer":"sounds like you want to deploy one website, then the end user can access the web page and upload pdf file, web service accept the request and run python script to parse data from uploaded pdf, right?\nif above is correct, seems you can save the pdf on the serverside, and deploy another cronjob to monitor the path, if new pdf file reached, can trigger python script running.","Q_Score":0,"Tags":"python,flask,pdf,web,automation","A_Id":72865786,"CreationDate":"2022-07-01T08:18:00.000","Title":"How to pass drag and dropped file in web app as input to python code?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm in my script using the os.startfile(\"program_path\") command and it opens the program without any problem in visual studio.\nHowever as soon as I close visual studio, the program I started also closes.\nIs there a way to keep the program running even though I've closed visual studio?","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":40,"Q_Id":72841840,"Users Score":1,"Answer":"you could start the script in cmd (or terminal if you are on linux) instead of visual studio using python <filename.py> or python3 <filename.py if you have python 2 and python 3 installed","Q_Score":0,"Tags":"python","A_Id":72841999,"CreationDate":"2022-07-02T19:14:00.000","Title":"how do i keep a started program open after closing the script","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I've been trying to find a way to convert POST data from a request\nwhen i print the data this is what i get b'message=sdfa&arent=gfsdgd&btn3=pressed'\nI've tried different ways to get it ive used replace but i realized that wasnt gonna work i saw that flask does something like this but id have to rewrite all my code using it\ni am using http.server and i was wondering if i could have the output formatted like json so were i could use something like value[\"message\"] and it would give me what is inside the message\nthis is my first time using stack overflow so im sorry if i dont make sense or look stupid","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":13,"Q_Id":72851410,"Users Score":0,"Answer":"question was answered by a comment\nThere is a library that formats a link into practically a json file\nthe library is called urllib\nbig thanks to metatoaster","Q_Score":0,"Tags":"python,webserver","A_Id":72851507,"CreationDate":"2022-07-04T03:09:00.000","Title":"how to converate post data into variables that i can use in python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have plotted a 3D radiation plot using Python, with theta on the x-axis and phi on the y-axis and magnitudes along z.  I initially used numpy.meshgrid to create the 2d array for thetas and phis. Now how can I find the peak points( main lobe and side lobes) from this graph?\nfind_peak function of the scipy.signal library seems to deal with 1d array only.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":98,"Q_Id":72855208,"Users Score":0,"Answer":"Try to use maximum_filter from scipy.ndimage.filters, or even just a simple thresholding could do the trick, provided prior smoothing\/transformations like erosion\/dilation.","Q_Score":0,"Tags":"python","A_Id":72856738,"CreationDate":"2022-07-04T10:21:00.000","Title":"How to find peaks in python for a 3D plot?","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Looking on tips how to get the data of the latest row of a sheet. I've seen solution to get all the data and then taking the length of that.\nBut this is of course a waste of all that fetching. Wondering if there is a smart way to do it, since you can already append data to the last row+1 with worksheet.append_rows([some_data])","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":524,"Q_Id":72861299,"Users Score":0,"Answer":"I used the solution @buran metnion. If you init the worksheet with\nadd_worksheet(title=\"title\", rows=1, cols=10)\nand only append new data via\nworksheet.append_rows([some_array])\nThen @buran's suggestion is brilliant to simply use\nworksheet.row_count","Q_Score":0,"Tags":"python,google-sheets,gspread","A_Id":72872482,"CreationDate":"2022-07-04T19:33:00.000","Title":"Python gspread - get the last row without fetching all the data?","Data Science and Machine Learning":0,"Database and SQL":1,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"When I use Spyder, I have fairly frequently accidentally closed the wrong consoles. Usually by a cmd+W. Most applications ask if I want to save before close\/confirm I definitely want to close. Spyder just closes, so I may lose training that's been occurring for an hour, say, by a single click or keyboard typo, and I cannot find a way to get it to ask before it does close a console.\nAnyone know how to fix this?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":134,"Q_Id":72862794,"Users Score":0,"Answer":"You could use hist -g in the console to get your history back.\nAnd you could do this:\nTools > Preferences > General > Advanced Settings\ncheck Prompt when exiting","Q_Score":1,"Tags":"python,spyder","A_Id":72862879,"CreationDate":"2022-07-04T23:36:00.000","Title":"Spyder - stop consoles accidentally closing","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am working with a dataset. As a precautionary measure, I created a back-up copy using the following command.\nOrig. Dataframe = df\ndf_copy = df.copy(deep = True)\nNow, I dropped few columns from original dataframe (df) by mistake using inplace = True.\nI tried to undo the operation, but no use.\nSo, the question is how to get my original dataframe (df) from copied dataframe (df_copy) ?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":109,"Q_Id":72871156,"Users Score":0,"Answer":"Yoy cannot restore it. Code like below dosen't work.\ndf = df_copy.copy(deep = True)\nEvery variables which reference original df keep reference after operation above.","Q_Score":0,"Tags":"python,pandas,dataframe,copy,drop","A_Id":72871423,"CreationDate":"2022-07-05T14:30:00.000","Title":"How to undo the changes made in original DataFrame?","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I wonder how I can install a python 3.7 virtual environment on a Linux machine that currently has python 2.7? I also do not have sudo privilege.","AnswerCount":2,"Available Count":1,"Score":-0.0996679946,"is_accepted":false,"ViewCount":337,"Q_Id":72875860,"Users Score":-1,"Answer":"If you want to install python without sudo privileges, then just download a compressed version of python 3, decompress it, run.","Q_Score":0,"Tags":"python,linux,virtual-machine,virtualenv","A_Id":72876523,"CreationDate":"2022-07-05T21:41:00.000","Title":"Installing a python 3.7 virtual environment on a Linux machine with python 2.7","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Most people seem to use Jupyter Notebook to display nglview and py3dmol models because nglview is a IPython\/Jupyter widget.\nI am wondering how to go about viewing these biomolecules within my Pycharm IDE, in the same way matplotlib will allow for plotting windows in both applications.\nIs this a feature of Pycharm Pro?","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":327,"Q_Id":72892633,"Users Score":1,"Answer":"Yes but I think it's only available in PyCharm Professional Edition.\nIt supports integration with Jupyter Notebook and JupyterLab, also enables you to visualize widgets like nglview and py3dmol  within the IDE. But you will also need to have a compatible web browser installed to display the widgets.\nIf you are using PyCharm Community Edition you can still use nglview and py3dmol, but you just won't be able to display the widgets within the IDE.\nUpdate:\nI misunderstood the question. Unfortunately, as I know it is not currently possible to display nglview or py3dmol widgets directly within the PyCharm IDE window. Because the widgets are rely on JavaScript to render the 3D molecule, and PyCharm  does not provide a built-in JavaScript runtime.","Q_Score":4,"Tags":"python,pycharm","A_Id":76050579,"CreationDate":"2022-07-07T05:21:00.000","Title":"Is it possible to view py3Dmol or nglview in Pycharm?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"As far as I understand, Gitpod creates a pod which runs a Linux server container that includes my pre-configured IDE.\nI am not too familiar with pods and containers, so please correct me if I'm wrong.\nTo my understanding, a container is essentially a VM, or are there any differences between the two?\nNow, moving on to Python, which I am also just getting to know.\nSo a common practice is to set up a virtual environment, so that packages will be installed in there, and not globally, on the computer running the project.\n\nNote - I will be abbreviating with \"venv\", but I will not be specifically referring to venv\/virtualenv\/etc.\n\nComparing it to NodeJS with which I am more familiar, that would be the same as using project\/.node_modules vs usr\/local\/lib\/.node_modules\nBy default npm i installs on the repository, and only installs on the machine when using the -g option.\nIs that correct so far?*\n\nSo, with that information in mind, since Gitpod is running a container specifically built to serve as a single project IDE - Do I even need to run a venv?\n\nI can see a use case in which I may be testing how my code runs against Python3 and Python2.8, thus using two different venvs\n(I now wonder how that would look code-wise, how would the scripts import the correct libraries, but that question is way off-topic \ud83d\ude05)\n\nAnyway, my question assumes:\n\nIf I were to use it on a local machine, I'd only need one venv\nIn terms of Python version and package collisions:\n\nEither the default Gitpod image satisfies my needs\nOr, well, I can edit the image myself anyway\n\n\n\n\n* Footnote - I apologise for asking many questions beside the main one.\nI hope it is not against the rules, I simply want to know if I understand correctly","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":67,"Q_Id":72899883,"Users Score":1,"Answer":"In an attempt to answer this objectively, I think the shortest argument for using both boils down to:\n\nThe Gitpod provides your development environment: editors, IDEs, Python installations that a virtual environment can use, etc.\n\nThe virtual environment provides your application's execution environment: the exact Python version and packages it needs to run.\n\n\nYour preferred tooling and workflow, however, might make this distinction moot.","Q_Score":0,"Tags":"python,virtual-environment,gitpod","A_Id":72900085,"CreationDate":"2022-07-07T14:45:00.000","Title":"Since Gitpod is running a VM, is a Python venv unneeded?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am writing an experimental code that generates random tokens using os.urandom, I was wondering how do I generate a 66 bit random token.? 66 bit is 8.25 bytes and it does not take floating numbers. I specifically need 66 bit how do i do it?","AnswerCount":4,"Available Count":2,"Score":0.049958375,"is_accepted":false,"ViewCount":57,"Q_Id":72908474,"Users Score":1,"Answer":"You can generate 9 bytes and take the first 66 bits using a bitmask operation. on the last byte.\nHere's a beautiful one liner:\n\"\".join([bin(c).replace(\"0b\", \"\").zfill(8) for c in us.urandom(9)])[:-6]\nThis will generate 9 bytes of random as a byte string, them iterate the 9 bytes in the byte string, convert each one into a binary string notation (i.e. 0b110001, remove the 0b from the front, zero pad where needed, join into a single string and strip the excess 6 bits from the end.\nconvert ever","Q_Score":0,"Tags":"python,python-3.x","A_Id":72908502,"CreationDate":"2022-07-08T08:10:00.000","Title":"how do i use bits insted of bytes in (os.urandom(32)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am writing an experimental code that generates random tokens using os.urandom, I was wondering how do I generate a 66 bit random token.? 66 bit is 8.25 bytes and it does not take floating numbers. I specifically need 66 bit how do i do it?","AnswerCount":4,"Available Count":2,"Score":0.049958375,"is_accepted":false,"ViewCount":57,"Q_Id":72908474,"Users Score":1,"Answer":"simple solution: you get three 32-bit random values (os.urandom(96)), and simply ignore 30 bits of the last 32 bits you get\nbetter solution: you get a 33 random 32-bit values, put them in a buffer, take the lowest 66 bit (using bitwise operations, &), and then shift your index into the buffer. For the next random value, you take the next 66 bit from your buffer through bitwise operations.\n\nAlso make sure you actually need all your randomness to come from the operating system. This is usually not the case. In most practical applications, you seed your pseudo-random number generator once with random values from your OS, and then have a very cheap way of generating sufficiently random\/secure random numbers. It depends on what you build!\nBut especially for things like session tokens, you don't need incredibly cryptographically secure values - take a (properly) seeded PRNG, get sufficiently many bits, append a secret salt to the end, run a SHA-256 hash on it, get a session token that cannot be guessed, and knowledge of one would not allow you to infer any other valid tokens.","Q_Score":0,"Tags":"python,python-3.x","A_Id":72908523,"CreationDate":"2022-07-08T08:10:00.000","Title":"how do i use bits insted of bytes in (os.urandom(32)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Today I come with this question probably to someone who has large experience in this.\nBasically what the title indicates. We have that app and we have to migrate it to microservices.\nWe didn't find any solid approach (or we felt it like that) about this. What we ended up doing is creating 1 project per microservice (a single functionality related to a module app, in general) but then we had some problems because we already had a database to work with since this is already a functioning app.\nWe had problems communicating with the existing models, so basically what we did was to point in every settings.py of the projects to the existing DB, and with python3 manage.py inspectdb, we grabbed the existing models. This approach ended up working, but we feel that is not the best approach. We had a lot of problems with circular imports and more.\nIs out there good practices about microservices with Django, and how to properly do it, like in most of the cases that we want to create something with the framework?\nIf someone knows or has something we would really appreciate it!","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":263,"Q_Id":72914225,"Users Score":0,"Answer":"you can use Django for Microservices. in this case you have only one few apps, and you start every service on own port:\nfirst Django project\npdf generator + views generate small pdf\nsecond Django project.\npdf generator + views generate big pdf (code can inherit other project)\norchestra:\nthird Django project: Autorization + call big or small pdf generator service\nsettings\nsettings.py for first and second is very easy and allows only call from internal ip's. here we don't need middleaware, template, cache, admin and other settings.\nsettings.py for orchestra is also very easy and used only auth and made call by internal ip ant send response to user. Here we don't need much middlaware, and don't need many other settings.\ngains:\n\nAll is independent. if one server fall, other can work.\nUpdates are easy. One small server update is always easy than monolith update.\ndevelopment is easy: three small teams works on own small projects.\nUnits testing is easy and fast\nFor complex business goals the whole system is faster.\n\npains:\n\nafter 100 micro-services it is completely complex to work with that all.\ncode style from many teams is always different. Don't matter how strict you define styleguide or settings for black-linter.\nintegrate Testing is difficult - If something not work, it is hard to find where.\nEcosystem Auth\/services\/messaging is really complex\nFor easy business goals the whole system is overcomplicated.\n\nsummary\nDon't matter how much DB you want to use. it can be monolith or many services.\ni don't see any problem to import in one Microservice something from other project: it can be model \/ admin or other staff. it works. probably you need to smart split monolith, but it also easy, for that we have a many experience (my own and in internet or books)","Q_Score":2,"Tags":"python,django,microservices,django-migrations,monolithic","A_Id":72914977,"CreationDate":"2022-07-08T16:14:00.000","Title":"How to properly migrate a monolith architecture app to a microservice app in Django","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":1},{"Question":"I want to use name from for an argument of a function. But from is a reserved keyword, so python will throw an exception if I decide to use this name for a variable.\nHow programmers in python deal with it? I think from is a common name for variables, in python as well. Is there any standards in python for how to rename the argument\/variable in this case? Do they use prefixes\/suffixes like from_?","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":45,"Q_Id":72915175,"Users Score":0,"Answer":"Many languages have these challenges. Some ideas:\n\nAs mentioned in the comments, tack an underscore on the end: from_\nAdd context or type (also mentioned in comments): from => from_list\nMangle the spelling (from => frm, e.g. class => klass or cls)\nUse a synonym: from => source\n\nEach approach has its advantages and disadvantages.","Q_Score":0,"Tags":"python","A_Id":72915618,"CreationDate":"2022-07-08T17:49:00.000","Title":"How do python programmers deal with inability to use reserved keywords as names for variables in python (like`from`)?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"I have an AES encrypted file in python. Lets call it encrypted.exe.\nI have the key for the encryption. I can then use python to decrypt my file (Cipher module in python) and obtain decrypted.exe. I then save the file (using write). Later I can run the file by clicking on it or through a cmd or powershell.\nWhat I want to do is be able to run the decrypted.exe without saving it. For instance I thought about, decrypting with my AES key then loading it in the RAM and run it from there.\nI don't know how to do it nor if it is possible with python.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":50,"Q_Id":72928096,"Users Score":0,"Answer":"I would say you can, but it\u2019s more than overhead. It\u2019s really complex task, so I would recommend to save file to hard drive, than use subprocess or os library to execute it, then delete it.","Q_Score":1,"Tags":"python,memory","A_Id":72928156,"CreationDate":"2022-07-10T11:20:00.000","Title":"Run an encrypted program without saving it with python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I would like to simply access the number of enveloppes (per user and per period) for billing purposes. Any idea how to do it in a fast way?\nThank you!","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":26,"Q_Id":72962889,"Users Score":0,"Answer":"Probably best is to set up an account-level webhook via the Connect feature.\nYour software can then be notified anytime a user in your account sends an envelope. You can add the information to your own BI (Business Intelligence) system and create derivative reports such as envelopes per user per week, etc.","Q_Score":0,"Tags":"python,docusignapi","A_Id":72966545,"CreationDate":"2022-07-13T08:07:00.000","Title":"How to access to the number of enveloppes per user per time period on Docusign?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have a dataset that looks like this:\n\n\n\n\nDate\nValue\n\n\n\n\n1871-01\n4.5\n\n\n1871-02\n10.7\n\n\n1871-03\n8.9\n\n\n1871-04\n1.3\n\n\n\n\nall the way to 2021-12.\nhow do I get the average value for each year in Python? For example, the 1871 average would be the average of all of the values from 1871-01 to 1871-1 and I would like it for all years from 1871-2021.\n...            ...","AnswerCount":4,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":127,"Q_Id":72970982,"Users Score":0,"Answer":"Depends on the what format the data is being given to you.  Is it json? csv? If you already know how to import and read the data with python.. you just need to assign the years to variables and average them.  (x1 + x2 + x3) \/ (number of averaged variables)","Q_Score":0,"Tags":"python,jupyter-notebook","A_Id":72971053,"CreationDate":"2022-07-13T18:25:00.000","Title":"How do I average monthly data to get yearly values in Python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm working on a python-django project.\nIf a have a class where one of its attributes have\n\nmax_length=100\n\nhow can I change to\n\nmax_length=5000\n\n? for instance...\nThank you!","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":96,"Q_Id":72971938,"Users Score":0,"Answer":"Basically when you edit a field on a Model you need to makemigrations and migrate for changes to take effect in database.  \npython manage.py makemigrations <optional_appname(If not provided it affects all apps.)> \npython manage.py migrate <optional_appname>","Q_Score":0,"Tags":"python,django,model","A_Id":72972788,"CreationDate":"2022-07-13T19:56:00.000","Title":"modify max_length models python django","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Can somebody explain me why Why print(5 ** 2 ** 0 ** 1) = 5 in Python?\nI am trying to learn the language and somehow I am not quite sure how this math is done.\nThank you in advance.","AnswerCount":4,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":190,"Q_Id":72973033,"Users Score":2,"Answer":"** is exponentiation.\n0 raised to the power of 1 is 0. So, we could re-write the statement as print(5**2**0) without changing the result.\n2 raised to the power of 0 is 1. So, we can re-write the statement as print(5**1) without changing the result.\n5 raised to the power of 1 is 5. So, we can rewrite the statement as print(5) without changing the result.","Q_Score":2,"Tags":"python","A_Id":72973060,"CreationDate":"2022-07-13T21:54:00.000","Title":"Why print(5 ** 2 ** 0 ** 1) = 5 in Python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am new to python and trying to figure out a problem that gui doesn't launch when clicking on the .pyw file.\nOn my windows 10 machine, I have installed python 3.5, and environment path is set.\nI was given a set of python files (.py) and some looks like shortcut file (.pyw). And I was told to double click the file then a gui will launch.\nSome .pyw works well, gui launch.\nHowever there are some failed. After double click, there was a quick cmd terminal open and closed automatically. Then no gui pop out.\nI want to know what is the cause and how do I debug it.\nFrom the properties of .pyw file, is is pointing to one of the .py file.\nLet me know if posting the .py file helps. I will then post here.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":78,"Q_Id":72982425,"Users Score":0,"Answer":"Managed to resolve it by selecting the correct pylauncher to open the file.","Q_Score":0,"Tags":"python,python-3.x,pytest","A_Id":72989877,"CreationDate":"2022-07-14T14:45:00.000","Title":"Pythonw gui does not run - how to debug","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have virtualenvwrapper-win installed from the command line. When I try to do virtualenv env (env is the name of my virtual environment I'd like to set up) I get this:\n\n'virtualenv' is not recognized as an internal or external command, operable program or batch file\n\nI'm not sure what's wrong. Anyone know how to fix?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":141,"Q_Id":72983949,"Users Score":0,"Answer":"Try these commands :\nTo create virtual env - mkvirtualenv venv_name\nTo view all virtual env - lsvirtualenv\nTo activate any virtual env -  workon venv_name","Q_Score":0,"Tags":"python,django,shell,virtualenv","A_Id":72984159,"CreationDate":"2022-07-14T16:40:00.000","Title":"Cannot make virtual environment","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"My problem is as follows. I have a 2d image of some tissue and a 3d stack of the same region of the tissue and plus more tissue that does not go into my 2d image. Now, the 3d stack is slightly rotated with respect to the 2d image, but also has some local deformation, so I can't simply apply a rigid rotation transformation. I can scroll through the 3d stack and find individual features that are common to the 2d image. I want to apply a nonlinear transformation such that in the end I can find my source 2d image as a flat plane in the 2d stack.\nMy intuition is that I should use thin plate spline for this, may the scipy RBF interpolator, but my brain stops working when I try to implement it. I would use as input arguments let's say 3 points (x1, y1, 0), (x2, y2, 0) and (x3, y3, 0) with some landmarks on the 2d image and then (x1', y1', z1'), (x2', y2', z2') and (x3', y3', z3') for the corresponding points into the 3d stack. And then I get a transformation but how do I actually apply this to an image? The bit that confuses me is that I'm working with a 3D matrix of intensities, not a meshgrid.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":123,"Q_Id":72985698,"Users Score":0,"Answer":"scipy RBF is designed to interpolate scattered data, it's just a spline interpolator. To warp a domain, however, you need to find another library or write TPS (thin plate spline) yourself; scipy doesn't do it. I recommend you check VTK, for example. You feed your landmark information of the reference image and the target image to a vtkThinPlateSplineTransform object. Then you can get the transformation matrix and feed it to a vtkImageReslice object, which warps your image accordingly.","Q_Score":1,"Tags":"python,scipy,interpolation,spline","A_Id":74988616,"CreationDate":"2022-07-14T19:25:00.000","Title":"Thin plate spline interpolation of 3D stack python","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Is it possible to run python script, which I will upload on Heroku or DG Ocean droplet (depending on which of them is most comfortable for what I am trying to do), from external website button?\nMy scenario: I have scrapper and I want to run it when user clicks on button on my webpage, so scrapper will scrape current data and will show it to user. Is it possible to do? or if we have any other way?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":28,"Q_Id":72989547,"Users Score":0,"Answer":"For others, who will have same things in the feature:  So, i am going to make FLASK app to use DG Droplet or Heroku, after i will import Flask app using Iframe in my Web project and use only BUTTON, like this i will use my scraper on my Webpage.\nThanks","Q_Score":0,"Tags":"python,php,selenium,heroku,digital-ocean","A_Id":72993335,"CreationDate":"2022-07-15T05:49:00.000","Title":"Run Python script On Heroku or DG Ocean when click button on web","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have strings in the database that are the names of countries and cities for example like this:\nItaly-Milan OR France-Paris.\nHow can i select only the city part, like select what comes only after the '-' using python?","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":43,"Q_Id":73003090,"Users Score":0,"Answer":"If data is the variable having you city value and other info than to get only the city name\ndata.split(\"-\")[1]","Q_Score":0,"Tags":"python,django","A_Id":73004031,"CreationDate":"2022-07-16T09:32:00.000","Title":"how to select a specific part of a string Django?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I first downloaded python x64. Now, I have both python x64 and python x32. How can I create a python file for just the x32, and not the x64?\nEdit:\nI thought this was a duplicate, but it was not, the other answer does not have a response that works.","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":53,"Q_Id":73009334,"Users Score":1,"Answer":"Python is an interpreted language, so Python files can always run in both 32-bit and 64-bit environments, with the same behaviour and output (in most cases).\nIf you want to control which Python instance your code runs with, you should start the program by giving the direct path to the version of Python which you intend to run.","Q_Score":0,"Tags":"python,pip,compatibility,32bit-64bit","A_Id":73009371,"CreationDate":"2022-07-17T04:52:00.000","Title":"If I have x32 and x64 python, how can I make a .py file specifically in x32 and not in x64?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"There is an excel file named test.xlsx, which has 3 sheets: ['Sheet1', 'Sheet2', 'Sheet3'], how do I use Python to reorder the sheets as: ['Sheet3', 'Sheet1', 'Sheet2']","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":108,"Q_Id":73023305,"Users Score":0,"Answer":"Workbooks have the move_sheet() method.","Q_Score":0,"Tags":"python-3.x,excel,openpyxl,xlwt","A_Id":73023731,"CreationDate":"2022-07-18T13:41:00.000","Title":"How do I move (reorder) sheets in Excel file with Python","Data Science and Machine Learning":0,"Database and SQL":1,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"using pydiffmap, I could find a nice low dimension Manifold in my data, and extract what seems to be meaningful low dimension components.\nI would like now to reverse the operator, and project my data back to my original high dimensional space keeping only these few important dimensions I could identify.\nFirst, is this mathematically possible? And if so how to do it?\nThanks a lot!","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":78,"Q_Id":73025089,"Users Score":0,"Answer":"I just went into the Diffusion algorithm behind the package, and realized that there is no guarantee that you can go from a vector in the diffusion space back into the data space.\nThis is because the diffusion space represent the distances to the original data points. So if at least two points are different, the null vector in the diffusion space (at distance 0 of all original data points in the data space) will have no equivalent in the data space.\nHope this can help someone else!","Q_Score":0,"Tags":"python,reverse,dimensionality-reduction","A_Id":73101038,"CreationDate":"2022-07-18T15:45:00.000","Title":"pydiffmap: How to reverse Diffusion Map Embedding and reconstruct original variables from several principal components?","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I used Forge API to post projects in BI360, now I am trying to add few users using the data frame of the projects created. According to the Forge Documentation you can post users to one project, looking for  an advise how to post users to several projects\nTIA","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":37,"Q_Id":73026486,"Users Score":0,"Answer":"I checked, and all endpoints take only one project id, so you have to loop through multiple projects and add the user(s) to all projects, currently not possible in one call.","Q_Score":0,"Tags":"python,forge,autodesk-bim360","A_Id":73206529,"CreationDate":"2022-07-18T17:44:00.000","Title":"Batch add users to BIM360","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I want to train my custom license plate using Yolov5, but I have a problem.\nMy problem is that my dataset is separated for each character and I have no idea how to make  annotation file suitable for Yolo which is as follows.\nBecause what I've seen so far, for triainig, you definitely need the entire license plate, which can be used to label each of the characters.\nAnd my question is, if I train these images, can I achieve a license plate recognition system?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":163,"Q_Id":73034619,"Users Score":0,"Answer":"With Yolov5, you can achieve a good licence plate detection system, Yolov5 wont be reach the succes to recognite the licence plates itself. After the detection(with Yolov5) you can extract the information from bounding boxes and use it for recognition.","Q_Score":0,"Tags":"python,yolo,yolov5,lpr","A_Id":73080455,"CreationDate":"2022-07-19T09:38:00.000","Title":"train custom plate recognition using yolo","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm using SQL transform of apache_beam python and deploy to Dataflow by Flex Template. The pipeline show the error: Java must be installed on this system to use. I know the SQL transform of beam python using Java, I researched the way to add Java to pipeline but all failed.\nCan you give any advice on how to fix this error? Thank a lot.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":137,"Q_Id":73034979,"Users Score":0,"Answer":"You need to have either Java8 or Java11 installed locally to start a Java expansion service to expand your SqlTransforms into Java SDK transforms. This is pipeline construction different from later pipeline execution and could be where your issue occurred.","Q_Score":1,"Tags":"python,java,sql,apache-beam","A_Id":73040886,"CreationDate":"2022-07-19T10:06:00.000","Title":"Java must be installed on this system to use this when using dataflow flex template python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"I am currently building a tool in Django for managing the design information within an engineering department. The idea is to have a common catalogue of items accessible to all projects. However, the projects would be restricted based on user groups.\nFor each project, you can import items from the catalogue and change them within the project. There is a requirement that each project must be linked to a different database.\nI am not entirely sure how to approach this problem. From what I read, the solution I came up with is to have multiple django apps. One represents the common catalogue of items (linked to its own database) and then an app for each project(which can write and read from its own database but it can additionally read also from the common items catalogue database). In this way, I can restrict what user can access what database\/project. However, the problem with this solution is that it is not DRY. All projects look the same: same models, same forms, same templates. They are just linked to different database and I do not know how to do this in a smart way (without copy-pasting entire files cause I think managing this would be a pain).\nI was thinking that this could be avoided by changing the database label when doing queries (employing the using attribute) depending on the group of the authenticated user. The problem with this is that an user can have access to multiple projects. So, I am again at a loss.","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":46,"Q_Id":73066581,"Users Score":0,"Answer":"Django apps don't segregate objects, they are a way of structuring your code base. The idea is that an app can be re-used in other projects. Having a separate app for your catalogue of items and your projects is a good idea, but having them together in one is not a problem if you have a small codebase.\nIf I have understood your post correctly, what you want is for the databases of different departments to be separate. This is essentially a multi-tenancy question which is a big topic in itself, there are a few options:\n\nCode separation - all of your projects\/departments exist in a single database and schema but are separate by code that filters departments depending on who the end user is (literally by using Django .filters()). This is easy to do but there is a risk that data could be leaked to the wrong user if you get your code wrong. I would recommend this one for your use-case.\n\nSchema separation - you are still using a single database but each department has its own schema. You would need to use Postgresql for this but once a schema has been set, there is far less chance that data is going to be visible to the wrong user. There are some Django libraries such as django-tenants that can do a lot of the heavy lifting.\n\nDatabase separation - each department has their own database. There is even less of a chance that data will be leaked but you have to manage multi-databases and it is more difficult to scale. You can manage this through django as there is support for multi-databases.\n\nApplication separation - each department not only has their own database but their own application instance. The separation is absolute but again you need to manage multiple applications on a host like Heroku, which is even less scalable.","Q_Score":0,"Tags":"python,django,database,reusability","A_Id":73067030,"CreationDate":"2022-07-21T12:52:00.000","Title":"Handling repetitive content within django apps","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am currently building a tool in Django for managing the design information within an engineering department. The idea is to have a common catalogue of items accessible to all projects. However, the projects would be restricted based on user groups.\nFor each project, you can import items from the catalogue and change them within the project. There is a requirement that each project must be linked to a different database.\nI am not entirely sure how to approach this problem. From what I read, the solution I came up with is to have multiple django apps. One represents the common catalogue of items (linked to its own database) and then an app for each project(which can write and read from its own database but it can additionally read also from the common items catalogue database). In this way, I can restrict what user can access what database\/project. However, the problem with this solution is that it is not DRY. All projects look the same: same models, same forms, same templates. They are just linked to different database and I do not know how to do this in a smart way (without copy-pasting entire files cause I think managing this would be a pain).\nI was thinking that this could be avoided by changing the database label when doing queries (employing the using attribute) depending on the group of the authenticated user. The problem with this is that an user can have access to multiple projects. So, I am again at a loss.","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":46,"Q_Id":73066581,"Users Score":0,"Answer":"It looks for me that all you need is a single application that will manage its access properly.\nIf the requirement is to have separate DBs then I will not argue that, but ... there is always small chance that separate tables in 1 DB is what they will accept","Q_Score":0,"Tags":"python,django,database,reusability","A_Id":73066967,"CreationDate":"2022-07-21T12:52:00.000","Title":"Handling repetitive content within django apps","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"As the title suggests, I need a way to get the resolution of the media running in the Gstreamer pipeline. I know it has something to do with the caps in the pipeline. But how do I access it?\nAlso, let's say I somehow got it and it is of the type Gst.caps, how do I get the actual width and height from this?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":45,"Q_Id":73071640,"Users Score":0,"Answer":"If running your pipeline by gst-launch-1.0, you can actually see the caps negotiation by putting GST_DEBUG=7 before gst-launch-1.0.  However, GST_DEBUG=5 may get you the information you need without the huge amount of trace information given by GST_DEBUG=7.","Q_Score":0,"Tags":"python,gstreamer","A_Id":73296919,"CreationDate":"2022-07-21T19:23:00.000","Title":"Python: Getting the resolution of the media in a gstreamer pipeline","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"My hello message is not visible...\nI'm writing a 3D video game using Python (3.10) language with Panda3d (1.10) as 3D game engine.\nSome graphical parts of the game are not 3D, there are just 2D elements:\n\nspell bar,\nplayer resume\nquest panel\nskill tree\netc\nspells\/attacks book\nand others\n\nI see on the web that pictures are used to styling Panda3D Direct* components.\nHowever, in my opinion, I think use statics pictures (.png for exemple) is not efficient when game design must be evolved. That's why I prefer use HTML\/CSS to render 2D elements, especially since CSS is very powerful if you know how to use it. I prefere to use SVG into the scene but I don't understand how create SVG file.\nSo, my question is:\nCan I use HTML\/CSS inside a Panda3d application?\nThank to all!\nHave a nice day!","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":59,"Q_Id":73078086,"Users Score":0,"Answer":"I think I've found a workaround (temporary).\n\nI create HTML\/CSS file that styling my 2D component that must be injected inside the Panda3D scene\nI create a Python script that convert an HTML part as PNG picture using RGBA for transparency\nI use the generated PNG picture inside my Panda3D scene on the target component.\n\nIt's not pure HTML\/CSS, but it can works.","Q_Score":0,"Tags":"python,html,css,panda3d","A_Id":73078393,"CreationDate":"2022-07-22T09:26:00.000","Title":"Python - Panda3D - Display HTML\/CSS elements into Panda3D scene","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"when I enter the youtube URL in my browser I want the URL to automatically change and visit a different website (invidio.us). Can someone provide any pointers as to how to achieve this with Python?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":40,"Q_Id":73080355,"Users Score":0,"Answer":"I don't think you can solve this in python. You will need a browser plugin for this one, and the add-ons aren't written in python.\nTry JavaScript.","Q_Score":0,"Tags":"python,url,browser","A_Id":73080874,"CreationDate":"2022-07-22T12:27:00.000","Title":"replacing an url in a browser automatically with python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm running vscode-server to develop on a remote machine via ssh. This machine has no connection to the internet and runs Python 3.6.5.\nI would like to use pylint in vscode for the linting. Problem is that I cannot install it the normal way, since I don't have an internet connection.\nWhat I tried so far:\n\nUse pip download pylint, tar the resulting folder, move it via scp and install it on the remote machine. This didn't work since my local mchine has a different python version from the remote (local: 3.10.x and remote: 3.6.5).\nUse the Install on remote: ssh button in the vscode marketplace. This succeeds but when I write code, a message pops up that says: Linter pylint is not installed. When I click on install, it just tries to execute pip install pylint on the remote, which will obviously fail...\n\nAny suggestions on how to proceed here?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":165,"Q_Id":73082891,"Users Score":0,"Answer":"This didn't work since my local machine has a different python version from the remote (local: 3.10.x and remote: 3.6.5).\n\nI don't know if it's ultimately going to work, but you can download the latest pylint compatible with python 3.6.5 explicitly, it's pylint 2.13.9 afaik so pip download \"pylint==2.13.9\".","Q_Score":2,"Tags":"python,visual-studio-code,pylint","A_Id":73096966,"CreationDate":"2022-07-22T15:41:00.000","Title":"Getting Pylint to work with VSCode-Server","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":1,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am creating a web-app w\/ Flask + Flask-WTF that has CRM-like features as a project. My current database (MongoDB) structure is I have:\n\nUsers who can login,\nPeople who are assigned to users, and\nRecords who are assigned to people.\n\nPeople have various fields to be filled out (Name, Phone Number, Email, etc).\nI want Users to be able to create custom fields for people. I am trying to plan out how to implement this from a database design perspective. My initial thoughts are to:\n\nFor each field created, add a new field without a value for each People assigned to the user.\nUse a for-loop to dynamically create the form class by looping through each field-value in my database and excluding non-required ones.\nUse a for-loop to dynamically output the web form by looping through each field-value in my database and excluding non-required ones.\n\nAnother idea I have is:\n\nFor each field created, add the custom field, with a parentRecord equal to the User ID to a new MongoDB collection.\nUse a for-loop to create the form class & web form dynamically, but I wouldn't need to exclude non-required ones as the only fields in the collection would be the custom ones, and wouldn't include any special data points that don't get displayed.\n\nSo my questions are:\n\nWill my ideas above work?\nWhich one is better?\nIs there a better way?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":39,"Q_Id":73086934,"Users Score":0,"Answer":"I decided to create a customfields MongoDB collection that has a parentRecord as the User.\nI faced a few challenges:\n\nI had to dynamically create a form via flask WTF. I ended up using wtforms_dynamic_fields to accomplish this. I then used a for-loop to dynamically generate each form in Jinja. I simply queried the customfields DB where the parentRecord matched the logged in User, and then created custom fields based upon the values saved in customfields.\n\nThe second issue I faced was getting the data from the submitted form and then building a MongoDB-friendly list to insert a new record with when creating new record. This was accomplished by using request.form.items() and iterating through them and using list.update() to add all of my required fields to a list.","Q_Score":0,"Tags":"python,database,mongodb","A_Id":73098355,"CreationDate":"2022-07-22T23:23:00.000","Title":"User-created Record Fields","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I made a blackjack game and a calculator following an online tutorial, however the only tutorial used replit module (from replit import clear -> clear() ) (replit being the website\/online interpreter). I am now trying the same program in vscode:\n\nis there a way to import replit to vscode?\nis there a similar module to get the same result?\nI have seen some people make suggestions to clear console but they all seem to depend on which OS I am running, since my desktop is windows and laptop is mac I want something that can work on both.","AnswerCount":1,"Available Count":1,"Score":-0.1973753202,"is_accepted":false,"ViewCount":151,"Q_Id":73091900,"Users Score":-1,"Answer":"Did you try \"import os\" at the beginning of code and using \"os.system('clear')\"?\nThis should work on any OS or code editor\/IDE.","Q_Score":0,"Tags":"python,python-3.x,repl.it,replit","A_Id":73116297,"CreationDate":"2022-07-23T15:19:00.000","Title":"how do I import replit module to python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"When I run poetry show - most of my packages are blue but a few are red? What do these two colors mean?\nI think red means the package is not @latest ?","AnswerCount":2,"Available Count":2,"Score":-0.0996679946,"is_accepted":false,"ViewCount":986,"Q_Id":73095192,"Users Score":-1,"Answer":"Yes, red indicates that you have an outdated package and blue is up to date","Q_Score":2,"Tags":"python,python-poetry","A_Id":73095242,"CreationDate":"2022-07-24T01:22:00.000","Title":"poetry show command - what do the red listed packages mean?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"When I run poetry show - most of my packages are blue but a few are red? What do these two colors mean?\nI think red means the package is not @latest ?","AnswerCount":2,"Available Count":2,"Score":0.1973753202,"is_accepted":false,"ViewCount":986,"Q_Id":73095192,"Users Score":2,"Answer":"Black: Not required package\nRed: Not installed \/ It needs an immediate semver-compliant upgrade\nYellow: It needs an upgrade but has potential BC breaks so is not urgent\nGreen: Already latest","Q_Score":2,"Tags":"python,python-poetry","A_Id":74919152,"CreationDate":"2022-07-24T01:22:00.000","Title":"poetry show command - what do the red listed packages mean?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I was trying to automate the process off adding things to a list by clicking the add button and cant figure out how to get selenium to click on every button that has the text \"add\" on it but not the other buttons.\nMy end goal is to click add on every anime on the page from my anime list and after every click click the submit button, then once a page is finished go to the next then next letter.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":90,"Q_Id":73115840,"Users Score":0,"Answer":"findElements in Selenium returns you the list of web elements that match the locator value, unlike findElement, which returns only a single web element. If there are no matching elements within the web page, findElements returns an empty list. After that, you can iterate through your list and do the actions.","Q_Score":0,"Tags":"python,selenium","A_Id":73115929,"CreationDate":"2022-07-25T22:10:00.000","Title":"Clicking all buttons that have the same text with selenium","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"So, I would like to know if there is a way to delete an line already plotted using matplotlib. But here is the thing:\nI'm plotting within a for loop, and I would like to check before plotting if the line that I'm about to draw is already on the figure, and if so, I would like to delete it.\nI was told an idea about plotting it anyways but with the same color of the background, but again, to do this I would have to check if the line already exists. Any idea how to do this?","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":64,"Q_Id":73117106,"Users Score":0,"Answer":"Any idea how to do this?\n\n\nDuring iteration, before making a new line\n\ncheck if x and y coordinates of the new line are the same as any of the lines already contained in the plot's Axes..","Q_Score":0,"Tags":"python,matplotlib","A_Id":73117510,"CreationDate":"2022-07-26T02:21:00.000","Title":"Checking if a line was already drawn in matplotlib and deleting it","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm working on some modules that email all data that should save in the database\nwith the attached file. I don't know how to save them as drafts in Django, Help me to solve this problem. I am new to Django.\nThanks in advance.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":83,"Q_Id":73133365,"Users Score":0,"Answer":"I think you need to just create a normal save and then create a function to prevent everyone except yourself from viewing the post.","Q_Score":2,"Tags":"python,django","A_Id":73133758,"CreationDate":"2022-07-27T06:47:00.000","Title":"How to make a save as draft module in django","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have been developing in django for sometime now, and have developed a neat website having functionality such as writing blogs, posting questions, sharing content etc. However there is still one thing that is missing and i.e. creating notification for users.\nWhat I want to do is to inform users in their profiles, whenever somebody comments on their posts, or if they are following a particular post and there is an update on it, then inform the user of that update. I have looked around many applications but I am still very confused about how to do it.\nIn case of using django-notification I seem to have an impression(which can be wrong) that I can use this only to inform the user via email, i.e. I cannot show these notifications in the user profile, just like we have on facebook.\nFirstly I would like to know if I am wrong, and then I really need some proper tutorial or guidance on how to go about doing it. I know how to register a notification and send it on proper signal but there is no documentation on how to show these notices in a template, if this can be done.\nAny guidance\/tutorial\/getting started doc will be deeply appreciated.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":37,"Q_Id":73136236,"Users Score":0,"Answer":"Websockets are simple and very useful in terms of bi-directional communication between clients and servers. If your app's features list grows it will be possible that you will need additional events in your app. WS will help you to scale.","Q_Score":0,"Tags":"python,django","A_Id":73136252,"CreationDate":"2022-07-27T10:23:00.000","Title":"Notification in django?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"My idea is to create a function that takes an input of a number and outputs a string of that length, which consists of \"keyboard-like\" spam.\nI know how to generate a completely random string of characters, however, I'm trying to make it look as if it's real \"spam\" from someone typing on a keyboard.\nFor example:\n\na key closer in proximity to one previously pressed is more likely to be pressed next\nkeys on the home row may have a higher chance to be pressed\nareas where the fingers rest are more likely to be pressed\n\nI'm new to StackOverflow and newish to python so forgive me if there's any errors with how I'm asking this.\nI don't have any code yet because I have 0 idea how I would go about doing this.\nThe best idea I have would be to randomly assign values to each key, and somehow tell the program where each key is physically located in proximity to each other, but this seems inefficient.\nI'm not looking for a way to input this into a textbox or on a website somewhere, I only want to generate the random text in a string through a function.\nYou don't have to write the whole thing but I would greatly appreciate any help or ideas how to do this, thank you.","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":43,"Q_Id":73142027,"Users Score":0,"Answer":"I would just open a file and spam your keyboard for 10 minutes or so. This will likely generate a huge data set that perfectly matches what you want.\nNext to generate random like strings you can select random short(ish) chunks from the file and concatenate them together to achieve the desired spam strings.\nThat might look something like\n\"\".join([example_string[i:i+random.randrange(3,5)] for i in [random.randrange(0,n) for _ in range(10)]])","Q_Score":0,"Tags":"python,random","A_Id":73142710,"CreationDate":"2022-07-27T17:08:00.000","Title":"How could I make a function that generates realistic \"keyboard-like\" spam? (In python)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"My idea is to create a function that takes an input of a number and outputs a string of that length, which consists of \"keyboard-like\" spam.\nI know how to generate a completely random string of characters, however, I'm trying to make it look as if it's real \"spam\" from someone typing on a keyboard.\nFor example:\n\na key closer in proximity to one previously pressed is more likely to be pressed next\nkeys on the home row may have a higher chance to be pressed\nareas where the fingers rest are more likely to be pressed\n\nI'm new to StackOverflow and newish to python so forgive me if there's any errors with how I'm asking this.\nI don't have any code yet because I have 0 idea how I would go about doing this.\nThe best idea I have would be to randomly assign values to each key, and somehow tell the program where each key is physically located in proximity to each other, but this seems inefficient.\nI'm not looking for a way to input this into a textbox or on a website somewhere, I only want to generate the random text in a string through a function.\nYou don't have to write the whole thing but I would greatly appreciate any help or ideas how to do this, thank you.","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":43,"Q_Id":73142027,"Users Score":0,"Answer":"It sounds like you want some sort of implicit or explicit Markov chain.  For each key, you assign a set of probabilities for what the next key is.  Start with a random key, and then move to the next key according to the assigned probabilities.","Q_Score":0,"Tags":"python,random","A_Id":73143474,"CreationDate":"2022-07-27T17:08:00.000","Title":"How could I make a function that generates realistic \"keyboard-like\" spam? (In python)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"I installed Anaconda, but it did not include the GUI app, Anaconda-Navigator app in the Applications folder. What do I need to do to get the GUI app?\nDetails:\nComputer: 2021 14-inch MacBook Pro, M1 Max\nOS: macOS Monterey 12.5\nA month ago, I had the full Intel version of Anaconda, including Anaconda-Navigator, running fine.\nI decided I wanted the M1 version, so I uninstalled it using the method detailed on the Anaconda website (anaconda-clean), rm -rf ~\/opt\/anaconda3, and remove conda section of .zshrc. I also deleted Anaconda-Navigator from the Applications folder and removed all ~\/Library\/Receipts, and restarted the laptop.\nI the used the GUI installer for the M1 version, which set up conda and seemingly the complete ~\/anaconda3 folder, but it didn't install the Anaconda-Navigator app.\nI repeated the full uninstall and used the shell installer, getting the same result - no Anaconda-Navigator.\nAny suggestions on how I can get Anaconda-Navigator GUI?\nThanks!!\nMike","AnswerCount":4,"Available Count":2,"Score":0.049958375,"is_accepted":false,"ViewCount":3768,"Q_Id":73188906,"Users Score":1,"Answer":"I had the same issue. After installing with conda install anaconda-navigator run it from terminal with anaconda-navigator and lock it to the  Dock (right click -> options -> keep in dock)","Q_Score":0,"Tags":"python,anaconda3","A_Id":74452739,"CreationDate":"2022-08-01T04:40:00.000","Title":"Anaconda-Navigator.app missing after installation on M1 macOS Monterey","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I installed Anaconda, but it did not include the GUI app, Anaconda-Navigator app in the Applications folder. What do I need to do to get the GUI app?\nDetails:\nComputer: 2021 14-inch MacBook Pro, M1 Max\nOS: macOS Monterey 12.5\nA month ago, I had the full Intel version of Anaconda, including Anaconda-Navigator, running fine.\nI decided I wanted the M1 version, so I uninstalled it using the method detailed on the Anaconda website (anaconda-clean), rm -rf ~\/opt\/anaconda3, and remove conda section of .zshrc. I also deleted Anaconda-Navigator from the Applications folder and removed all ~\/Library\/Receipts, and restarted the laptop.\nI the used the GUI installer for the M1 version, which set up conda and seemingly the complete ~\/anaconda3 folder, but it didn't install the Anaconda-Navigator app.\nI repeated the full uninstall and used the shell installer, getting the same result - no Anaconda-Navigator.\nAny suggestions on how I can get Anaconda-Navigator GUI?\nThanks!!\nMike","AnswerCount":4,"Available Count":2,"Score":0.1488850336,"is_accepted":false,"ViewCount":3768,"Q_Id":73188906,"Users Score":3,"Answer":"run -> conda install anaconda-navigator\nWorked for my on my Mac mini M1. Was looking for ages to find this. Hope this helps someone looking for it as well.","Q_Score":0,"Tags":"python,anaconda3","A_Id":73827377,"CreationDate":"2022-08-01T04:40:00.000","Title":"Anaconda-Navigator.app missing after installation on M1 macOS Monterey","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am currently working on a multi-layer 1d-CNN. Recently I shifted my work over to an HPC server to train on both CPU and GPU (NVIDIA).\nMy code runs beautifully (albeit slowly) on my own laptop with TensorFlow 2.7.3. The HPC server I am using has a newer version of python (3.9.0) and TensorFlow installed.\nOnto my problem: The Keras callback function \"Earlystopping\" no longer works as it should on the server. If I set the patience to 5, it will only run for 5 epochs despite specifying epochs = 50 in model.fit(). It seems as if the function is assuming that the val_loss of the first epoch is the lowest value and then runs from there.\nI don't know how to fix this. The function would reach lowest val_loss at 15 epochs and run to 20 epochs on my own laptop. On the server, training time and epochs is not sufficient, with very low accuracy (~40%) on test dataset.\nPlease help.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":150,"Q_Id":73201539,"Users Score":0,"Answer":"For some reason, reducing my batch_size from 16 to 8 in model.fit() allowed the EarlyStopping callback to work properly. I don't know why this is though. But it works now.","Q_Score":0,"Tags":"python,tensorflow,keras,hpc,early-stopping","A_Id":73251022,"CreationDate":"2022-08-02T03:02:00.000","Title":"Keras Earlystopping not working, too few epochs","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"While trying to activate a virtual environment called \"dat1triviabot_env\" on Windows, I get this error:\ndat1triviabot-env\\Scripts\\activate.bat: The module 'dat1triviabot-env' could not be loaded. For more information, run 'Import-Module dat1triviabot-env'.\nI have the virtualenv package installed, version 20.16.2, and I used the command python3 -m venv dat1triviabot-env to create the virtual environment.\nDoes anyone know how to fix this?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":214,"Q_Id":73226607,"Users Score":0,"Answer":"If you are in PowerShell, try just running dat1triviabot-env\/Scripts\/activate.","Q_Score":1,"Tags":"python","A_Id":73254397,"CreationDate":"2022-08-03T19:09:00.000","Title":"Python - \"Module could not be loaded\" error while trying to activate a virtual environment","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"MOST OF US PROBABLY KNOW BUT MOBIZEN IS AN MOBILE SCREEN RECORDING APP\nThe part that i want to know is how,\nmobizen logo stays on screen and,\ntoolbar appears whenever you click\nthe logo stays on screen even while phone is on another app,\nwhere i should research to make something like this.\n\n(I'm using 'kivy' library in PYTHON)\n\n-PurpleLime\nREGARDS","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":28,"Q_Id":73227143,"Users Score":0,"Answer":"i've found, its named \"Floating Application\" guys check documentation of it","Q_Score":0,"Tags":"python,android","A_Id":73327238,"CreationDate":"2022-08-03T19:59:00.000","Title":"How do i make something like mobizen logo pop ups on screen in kivi python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"For type datetime.datetime, how do we check whether the timestamp points to the beginning of the day?\nThe beginning of the day means the time 00:00:00.000000 of the day, while the date part can be anyone.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":49,"Q_Id":73256060,"Users Score":0,"Answer":"Something like this will take care of it. In this example I am comparing with the current time. datetime.time() with no arguments is initialised to (0,0).\ndatetime.time() == datetime.datetime.now().time()","Q_Score":0,"Tags":"python,python-3.x","A_Id":73256108,"CreationDate":"2022-08-05T23:17:00.000","Title":"Python check whether `datetime` is the beginning of the day?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"matplotlib.pyplot.gcf()\nGets the current figure.\nBut if you have multiple figures, how do you know which one is the current one?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":46,"Q_Id":73265590,"Users Score":1,"Answer":"According to the documentations, gcf() will get the current figure from pyplot figure stack. As stack works in LIFO(Last in first out) manner. The current figure will be that figure which you have made most recently.","Q_Score":0,"Tags":"python,matplotlib","A_Id":73266071,"CreationDate":"2022-08-07T07:16:00.000","Title":"The \"Current Figure\" is often mentioned in matplotlib, but what actually IS the current figure?","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have a hex string as follows:\n\\x00\\x00\\x00\\xa5v\\xe6A\\x0033\\x0033\\x00\\x00\\x00\\x00\\x00\\x00\nSo I know \\x means to use hexadecimal, so for characters like \\x00 I know that means a null character. However for \\xa5v how do I go about converting that? Is it a different format to hex?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":40,"Q_Id":73279891,"Users Score":0,"Answer":"You can convert characters that are not hexadecimal, like \"v\" letter with the python function ord(). It returns an integer of that unicode character. So make something like this: hex(ord(\"v\")) it returns the hex value of letter \"v\" in unicode format.","Q_Score":0,"Tags":"python,hex","A_Id":73280014,"CreationDate":"2022-08-08T14:54:00.000","Title":"Converting hex string with letters outside A-F","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Example i have 4 column in my dataframe,\ni want to use jaro similarity for col: A,B  vs col: C,D containing strings\nCurrently i am using it between 2 columns using\ndf.apply(lambda x: textdistance.jaro(x[A], x[C]),axis = 1))\nCurrently i was comparing with names\n|A|C |result|\n|--| --- | --- |\n|Kevin| kenny |0.67|\n|Danny |Danny|1|\n|Aiofa |Avril|0.75|\nI have records over 100K in my dataframe\nCOLUMN A -contains strings of person name\nCOLUMN B -contains strings of city\nCOLUMN C -contains strings of person name (to compare with)\nCOLUMN D -contains strings of city (to compare with)\nExpected Output\n|A|B|C|D |result|\n|--|--|---| --- | --- |\n|Kevin|London| kenny|Leeds |0.4|\n|Danny |Dublin|Danny|dublin|1|\n|Aiofa|Madrid |Avril|Male|0.65|","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":83,"Q_Id":73313174,"Users Score":0,"Answer":"df.apply(lambda x: textdistance.jaro(x['A']  + x['B'], x['C'] + x['D']),axis = 1))\nthank you DarrylG","Q_Score":0,"Tags":"python,pandas,jaro-winkler","A_Id":73359930,"CreationDate":"2022-08-10T22:00:00.000","Title":"I am working on Jaro wrinkler similarity, and I am able to use between 2 columns, but how do I use it with 2 pairs of columns","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have already installed a package on my Linux machine via conda install, but I found an error when running it on Jupyter Notebook. I'm able to make a simple modification to the package's python script, but the modified code isn't recognized when I called the package again. Do I need to update the package so that the changes would be recognized, and if so, how do I do that?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":54,"Q_Id":73314517,"Users Score":1,"Answer":"The library's code does not get imported directly. Instead, it is compiled the first time you import it and put into a pycache folder in the corresponding site-packages directory. In this folder, locate the .pyc file corresponding to the one that you modified and delete it.\nNow, when you import, the source code is compiled anew and your changes will have taken effect.\nIf the package has a GitHub page, it might be worthwhile to make a pull request and ask that they also update the conda package","Q_Score":0,"Tags":"python,jupyter-notebook,anaconda","A_Id":73318241,"CreationDate":"2022-08-11T02:04:00.000","Title":"How to use\/update a modified conda package offline","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"I understand that to drop a column you use df.drop('column name', axis=1, inplace  =True)\nThe file format is in .csv file\nI want to use above syntax for large data sets and more in robust way\nsuppose I have 500 columns and I want to keep column no 100 to 140 using column name not by indices and rest want to drop , how would I write  above syntax so that I can achieve my goal and also in 100 to 140 column , I want to drop column no 105, 108,110 by column name","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":304,"Q_Id":73317209,"Users Score":0,"Answer":"Instead of using a string parameter for the column name, use a list of strings refering to the column names you want to delete.","Q_Score":0,"Tags":"python,pandas,dataframe","A_Id":73317252,"CreationDate":"2022-08-11T07:58:00.000","Title":"python dataframe pandas drop multiple column using column name","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Orient, please, on a following question.\nI created an ML model in Jupiter notebook (python) based on the internal data of the company where I work. The management suggests \"wrapping\" this model, making something like a finished boxed product for use outside the company.\nCan you tell me how this can be technically implemented?\nAnd is it possible to make a ready-made boxed product out of Jupiter at all?\nI have no ideas besides sharing the file on GitHub.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":19,"Q_Id":73326507,"Users Score":0,"Answer":"You can export your model using joblib.\nNow, something I like to use for easy deployment is pipedream. So you can upload the file generated from joblib anywhere, call it using pipedream and then you can use webhooks to trigger the workflow.\nAlso there is other many options, heroku, pythonanywhere, Azure, GC, AWS, where you can store this file and make it run with new data.\nThere are libraries where you can deploy easier like gradio or plotly if you are in a hurry.","Q_Score":0,"Tags":"python,machine-learning,jupyter-notebook,model","A_Id":73326558,"CreationDate":"2022-08-11T20:22:00.000","Title":"ML model as a boxed solution for sale outside","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I was starting my coding journey but hit a wall before even starting.\nWhen I am trying to run a guizero code from pycharm I am getting this error\n\"ModuleNotFoundError: No module named 'guizero' \"\nBut it works fine If i run it via python command prompt. So with my little knowladge I feel pycharm is not able to see guizero libraries and I have no idea how to make it happen.\nSo tldr is HALP! Thanks in advance for any response ^^","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":85,"Q_Id":73329969,"Users Score":0,"Answer":"Well opening an account here made me fluffier eneough to solve my own issue.\nFor those who experience same just download zip version of guizero. Copy the guizero folder in guizero-master and paste it to  blabla\/PyCharm\/Blabla\/Lib so pycharm can see it as external library ^^","Q_Score":0,"Tags":"python,pycharm,guizero","A_Id":73330109,"CreationDate":"2022-08-12T06:20:00.000","Title":"Guizero on Pycharm will not start","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"I create an env of meep.\n'$ conda create -n mp -c conda-forge pymeep pymeep-extras'\nthen\n'$ conda activate mp'\nI can import meep module in python.\nHowever, I want to use run it in spyder5. But in the env. mp, I have no spyder. I am confused how to use spyder in mp env.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":59,"Q_Id":73337884,"Users Score":0,"Answer":"I also had the problem and solved it. The solution is quite simple, that is installing meep and spyder at the same time with this command:\nconda create -n meep -c conda-forge pymeep pymeep-extras spyder","Q_Score":0,"Tags":"python,module,conda,spyder,environment","A_Id":73771153,"CreationDate":"2022-08-12T17:34:00.000","Title":"meep module in spyder5 modulenotfounderror","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"I have created a game bot with SIKULIX, is it possible to create a web panel or dashboard that controls the bot I created from SIKULIX? if yes, how to do that","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":37,"Q_Id":73341198,"Users Score":0,"Answer":"Yes, that is possible you could make a page in your webpanel '\/bot' and the only output that page has is the action you want your bot to do and control that with a web panel. your bot could get that action through a http request","Q_Score":0,"Tags":"python,virtual-machine,panel,jython,sikuli","A_Id":73623616,"CreationDate":"2022-08-13T02:30:00.000","Title":"Web Panel for Sikulix Bot","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"My issue requires some backstory.\nI was having some troubles with pip, so I reinstalled Python.  After the reinstall pip began to work, but Pycharm, my IDE, could no longer find Python.  When I reinstalled Python it created a new folder for itself (Python310), but Pycharm kept looking in the old folder (Python39).  I couldn't figure out how to get Pycharm to look in the new folder.  Even deleting and reinstalling it did nothing.\nSo, I renamed Python310 to Python39 and changed the PATH.  Now Pycharm can find Python.  But pip has developed a new and exciting error.  When I try to use it I get the following message:\nFatal error in launcher: Unable to create process using '\"C:\\Users\\user\\AppData\\Local\\Programs\\Python\\Python310\\python.exe\"  \"C:\\Users\\user\\AppData\\Local\\Programs\\Python\\Python39\\Scripts\\pip.exe\" install numpy': The system cannot find the file specified.\nIf I read this correctly pip is still trying to look in Python310.  Would you please tell me what I need to do to get pip to looking in the right place?","AnswerCount":3,"Available Count":2,"Score":-0.0665680765,"is_accepted":false,"ViewCount":221,"Q_Id":73355838,"Users Score":-1,"Answer":"Option 1:\ndelete and reinstall again. and then when creating a project it should prompt you to pick a basic interpreter, choose python310 or whatever version you're using.\nOption 2:\nuse a different IDE.","Q_Score":1,"Tags":"python,pip","A_Id":73356118,"CreationDate":"2022-08-14T23:50:00.000","Title":"pip looking in wrong folder","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"My issue requires some backstory.\nI was having some troubles with pip, so I reinstalled Python.  After the reinstall pip began to work, but Pycharm, my IDE, could no longer find Python.  When I reinstalled Python it created a new folder for itself (Python310), but Pycharm kept looking in the old folder (Python39).  I couldn't figure out how to get Pycharm to look in the new folder.  Even deleting and reinstalling it did nothing.\nSo, I renamed Python310 to Python39 and changed the PATH.  Now Pycharm can find Python.  But pip has developed a new and exciting error.  When I try to use it I get the following message:\nFatal error in launcher: Unable to create process using '\"C:\\Users\\user\\AppData\\Local\\Programs\\Python\\Python310\\python.exe\"  \"C:\\Users\\user\\AppData\\Local\\Programs\\Python\\Python39\\Scripts\\pip.exe\" install numpy': The system cannot find the file specified.\nIf I read this correctly pip is still trying to look in Python310.  Would you please tell me what I need to do to get pip to looking in the right place?","AnswerCount":3,"Available Count":2,"Score":-0.0665680765,"is_accepted":false,"ViewCount":221,"Q_Id":73355838,"Users Score":-1,"Answer":"try to uninstall all of the existing python versions. and install it again. using any of application allow you to delete most of files, so to prevent error when re-install .","Q_Score":1,"Tags":"python,pip","A_Id":73356059,"CreationDate":"2022-08-14T23:50:00.000","Title":"pip looking in wrong folder","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"I tried duplicating a the same window but it just went. I made this server.py file that needs to be run twice if we need 2 players. Anyone know how to duplicate windows in vscode?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":28,"Q_Id":73362175,"Users Score":0,"Answer":"You could open up a new terminal window with cntrl + shift + backtick, and run your python server there (probably on a different port).","Q_Score":0,"Tags":"python,visual-studio-code,ursina","A_Id":73362382,"CreationDate":"2022-08-15T14:09:00.000","Title":"How do I duplicate the same window in VSCODE","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"on my hosting provider, I try to make a cron job running a .py-file.\nThe cron-job starts but I always get this error message \"ImportError: No module named mysql.connector\".\nWhen I run exactly the same script via CLI, it runs smoothly. It connects to my db, it updates, inserts, ...  So, there is no issue with having this module (yes I installed).\nSo, how can I get this cron job to work?\nThis is how I start that job: python \/home2\/******\/public_html\/Test\/cron_job_test.py\n(when I run this via CLI it works)\nMany thanks,\nPeter","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":30,"Q_Id":73364352,"Users Score":0,"Answer":"After hours of trying, I still wasn't able to get it working.\nSo time for an ugly bypass solution. Instead of a python script, I made a php script to do the work>\nAnd run this cron job 'php \/home2\/******\/public_html\/Test\/cron.php' and it works.\nBut I still want to know how to get the mysql.connector to work via crontab ;-)","Q_Score":0,"Tags":"python,cron","A_Id":73367689,"CreationDate":"2022-08-15T17:18:00.000","Title":"ImportError: No module named mysql.connector when using cron-jb","Data Science and Machine Learning":0,"Database and SQL":1,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"I have a function which send images to the email\nThe requirements is, i have only two images the first one i need to send as a attachments and another one in the body .\nUsing alternative in the MIMEmultipart it sending the both images as a documents and i have tried using two multipart that is also not helping. let me know how to approach the issue and also let me know whether it is possible or not\nAny idea would be appreciated","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":360,"Q_Id":73397859,"Users Score":0,"Answer":"You can use HTML to embed the wanted image in the body.\nSome e-mail clients interpret this still as an attachment. Maybe check, how other clients interpret your solution.","Q_Score":2,"Tags":"python,mimemultipart","A_Id":73399120,"CreationDate":"2022-08-18T05:29:00.000","Title":"Sending images through email","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I was trying to do semantic segmentation using Detectron2, but some tricky errors occurred when I ran my program. It seems there might be some problems in my environment.\nDoes anyone know how to fix it?\n\nImportError: cannot import name 'is_fx_tracing' from 'torch.fx._symbolic_trace' (\/home\/eric\/anaconda3\/envs\/detectron_env\/lib\/python3.9\/site-packages\/torch\/fx\/_symbolic_trace.py)","AnswerCount":2,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":2115,"Q_Id":73408083,"Users Score":2,"Answer":"@Mohan Ponduri's solution worked for me. Thanks. Seems to be the problem with new Detectron2 installation. Also I was able to use detectron2 on conda environment, just in case any one wants to know","Q_Score":4,"Tags":"python,pytorch,torch","A_Id":73438638,"CreationDate":"2022-08-18T18:48:00.000","Title":"ImportError about Detectron2","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have data that looks like this for IP addresses: for security reasons I am writing made up numbers here.\n\n\n\n\nSubnet 1\nSubnet 2\nSite\n\n\n\n\n5.22.128.0\n17\nTexas\n\n\n5.22.0.0\n17\nBoston\n\n\netc\netc\netc\n\n\n\n\nQuestion: Can I write a VBA or python code to do the below:\nto take each Subnet 1 and:  if the third octet is 128 then add 127 rows below it and fill them as such:\n\n\n\n\nSubnet 1\nSubnet 2\nSite\n\n\n\n\n5.22.128.0\n17\nTexas\n\n\n5.22.129.0\n17\nTexas\n\n\n5.22.130.0\n17\nTexas\n\n\n\n\n.... all the way to:\n\n\n\n\nSubnet 1\nSubnet 2\nSite\n\n\n\n\n5.22.255.0\n17\nTexas\n\n\n\n\nAnd if the third octet is 0 then do the same thing but from 0 to 127. while keeping the other data intact (Site and Subnet 2) the same.\nI didn't really know where to begin so I don't have code but my thinking was:\neither:\nA. Change the decimals to commas to represent figures in millions then add a summation calc until it reaches certain numbers.\nB.Create two lists one from 0-127 and one from 128-255 and then append them to the values on the columns but I still don't know how to get multiple rows for it.\nI am fairly new but if there is anything wrong with the way the question is presented please let me know. - don't care if it is done through VBA or python as I can write both - Just need a direction as to how to start.","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":103,"Q_Id":73409469,"Users Score":0,"Answer":"Question: Can I write a VBA or python code to do the below\n\nAnswer Well, I don\u00b4t know if you can write it, but it's writeable :)\nIf you want to have the address in one column and work only with that column you will have to do some string manipulation in your code, having as reference the dots in the strings.\nOr you can have a column with each one of the octect and then concatenate them with the dots in another column. This way you won't have to do string manipulation or even code at all, maybe you can solve it only formulas.","Q_Score":0,"Tags":"python,excel,duplicates,ip,autofill","A_Id":73409649,"CreationDate":"2022-08-18T21:09:00.000","Title":"Is there a way in python or Excel to duplicate rows and add a value to a certain column - explanation below","Data Science and Machine Learning":0,"Database and SQL":1,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have a Python script that should have slightly different behaviour if it's running inside a Kubernetes pod.\nBut how can I find out that whether I'm running inside Kubernetes -- or not?","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":188,"Q_Id":73475423,"Users Score":1,"Answer":"An easy way I use (and it's not Python specific), is to check whether kubernetes.default.svc.cluster.local resolves to an IP (you don't need to try to access, just see if it resolves successfully)\nIf it does, the script\/program is running inside a cluster. If it doesn't, proceed on the assumption it's not running inside a cluster.","Q_Score":0,"Tags":"python,kubernetes","A_Id":73476045,"CreationDate":"2022-08-24T14:58:00.000","Title":"How can a Python app find out that it's running inside a Kubernetes pod?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I want to install third-party Python modules from the Python interactive shell rather than the Terminal or Command Prompt. What Python instructions do I run to do this so I can then import the installed module and begin using it?\n(For those asking why I want to do this: I need reliable instructions for installing third-party modules for users who don't know how to navigate the command-line, don't know how to set their PATH environment variable, may or may not have multiple versions of Python installed, and can also be on Windows, Mac, or Linux and therefore the instructions would be completely different. This is a unique setup, and \"just use the terminal window\" isn't a viable option in this particular case.)","AnswerCount":1,"Available Count":1,"Score":0.6640367703,"is_accepted":false,"ViewCount":361,"Q_Id":73494513,"Users Score":4,"Answer":"From the interactive shell (which has the >>> prompt) run the following, replacing MODULE_NAME with the name of the module you want to install:\nimport sys, subprocess; subprocess.run([sys.executable, '-m', 'pip', 'install', '--user', 'MODULE_NAME'])\nYou'll see the output from pip. You can verify that the module installed successfully by trying to import it:\nimport MODULE_NAME\nIf no error shows up when you import it, the module was successfully installed.","Q_Score":2,"Tags":"python,pip","A_Id":73494514,"CreationDate":"2022-08-25T23:13:00.000","Title":"How do I run pip from the Python interactive shell?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have a star power-up in my game, and when it collides with the player I want an 'invincibility timer' that starts up. This timer would basically turn off all collisions for 5 seconds, and after the 5 seconds are over, they would turn on again. Is there a better way to accomplish this, and if not, how can I write this in pygame?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":43,"Q_Id":73502860,"Users Score":0,"Answer":"Use a boolean => invisibility = false\nSet the boolean to true once the player collides with the star power-up.\nThen in your if-else statements or loops, state that if invisibility == true, no collisions will take place.","Q_Score":3,"Tags":"python,pygame","A_Id":73502923,"CreationDate":"2022-08-26T14:49:00.000","Title":"How can I make a invincibility timer in pygame?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have installed numpy using\npip install numpy\nIn the current directory.\nBut when I try to import it in my jupyter notebook, it gives an error.\nModuleNotFoundError                       Traceback (most recent call last)\n~\\AppData\\Local\\Temp\/ipykernel_17100\/2172125874.py in \n----> 1 import numpy\nModuleNotFoundError: No module named 'numpy'\nPlease help me resolve this problem. I have tried uninstalling numpy and re-installing, yet it does not work at all. I am using a Windows 10 system.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":39,"Q_Id":73508449,"Users Score":1,"Answer":"First, pip install numpy will install NumPy package in python\/site-package, not the current directory. You can type pip show numpy in the terminal to check its information(path, version...).\nSecondly, Maybe the interpreter you choose in Jupyter notebook is not the same as the one you installed numpy on. You might need to check that.\nTo check Whether it has numpy. You might use pip list to check that, in case pip corresponds to the interpreter you wanna check.\nHope this will help you.","Q_Score":3,"Tags":"python,numpy,jupyter-notebook","A_Id":73509246,"CreationDate":"2022-08-27T04:50:00.000","Title":"I have installed numpy, yet it somehow does not get imported in my jupyter notebook","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"how to fix 404 error in github.io in new repositories? I tried the new, public, changed mode, nothing helps. there is a python script in the repositories to collect information, maybe there are some restrictions on github for python scripts?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":75,"Q_Id":73510640,"Users Score":0,"Answer":"There is one possible reason for it, GitHub pages isn't enabled. To solve this, Repo Settings -> Github Pages section -> Select the main branch. If it is already there, then wait for some time and refresh your site again.","Q_Score":0,"Tags":"python,github,http-status-code-404,github-pages","A_Id":73511153,"CreationDate":"2022-08-27T11:34:00.000","Title":"how to fix 404 error in github.io in new repositories?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"I have two different dataframes and I need to add informatio of one dataframe into another basede on a column where they share the same values.\nSomething like this:\nDF1:\n\n\n\n\nInvoices\nClient\nProduct\nProduct type\n\n\n\n\n00000001\nAAAAAA\nA1a1\n\n\n\n\n\nDF2:\n\n\n\n\nProduct\nProduct type\nProduct description\n\n\n\n\nA1a1\nType A1\ndescription of the product\n\n\n\n\nThe first Dataframe is a list of all invoices over the last year, which has one row for each product in that invoice, I need to add the \"Product type\" from DF2 on DF1 for each product.\nI've tried to use the merge function but it adds the column and that's not what I need to do.\nI need to compare the \"Product\" columns on both DFs and when the value is the same populate DF1 \"Product\" with DF2 \"Product\" value.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":26,"Q_Id":73560521,"Users Score":0,"Answer":"df3 = pd.merge(df1, df2, how =\"left\", on \"Product\")","Q_Score":0,"Tags":"python-3.x,pandas","A_Id":73560540,"CreationDate":"2022-08-31T18:41:00.000","Title":"How can I populate a column of a dataframe with information of another dataframe?","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'am trying to make a web bot with Python in IntelliJ, i found a plugin called selenium that makes life a lot better. the only thing is that you can only download the selenium plugin with the IntelliJ Ultimate version. Does anybody know how to use the selenium plugin with the IntelliJ community edition.","AnswerCount":2,"Available Count":2,"Score":0.0996679946,"is_accepted":false,"ViewCount":77,"Q_Id":73583192,"Users Score":1,"Answer":"For coding with Python they have PyCharm. IntelliJ is designed for other languages like Java","Q_Score":1,"Tags":"python,selenium,selenium-webdriver,intellij-idea,intellij-plugin","A_Id":73583288,"CreationDate":"2022-09-02T13:17:00.000","Title":"Is selenium only available in IntelliJ on the Ultimate version","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'am trying to make a web bot with Python in IntelliJ, i found a plugin called selenium that makes life a lot better. the only thing is that you can only download the selenium plugin with the IntelliJ Ultimate version. Does anybody know how to use the selenium plugin with the IntelliJ community edition.","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":77,"Q_Id":73583192,"Users Score":0,"Answer":"Currently i installed Selenium and its working. First i installed Pycharm and installed selenium in the terminal of pycharm by typing \"pip install selenium\", and after that i installed PyPI source archive by typing \"python3 setup.py install\". Then i needed the right webdriver voor my Google Chrome.\nIts running perfectly.","Q_Score":1,"Tags":"python,selenium,selenium-webdriver,intellij-idea,intellij-plugin","A_Id":73744132,"CreationDate":"2022-09-02T13:17:00.000","Title":"Is selenium only available in IntelliJ on the Ultimate version","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I've created a widget and I've applied several form layouts to tabs within the widget. I would like to make some tabs available based on some boolean flags.\nI've tried tab_my_tab.setEnabled(False) which disables the content of the tab, but it doesn't hide the tab. I'd like it if the tab is completely hidden.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":34,"Q_Id":73625426,"Users Score":0,"Answer":"I've found the solution to my question. I was able to hide one or more tabs by using the setTabVisible(index, bool) method on the QTabWidget().\nTo hide multiple tabs you have to start hiding the highest index number tab first before hiding the lower index number tabs.","Q_Score":1,"Tags":"python,python-3.x,pyqt,pyqt5","A_Id":73625755,"CreationDate":"2022-09-06T16:52:00.000","Title":"In pyQT5 how do you conditionally hide a tab in a widget?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am currently using the subprocess module to play .mp3 files. It works just fine getting them to play, but once I do subprocess.call([\"afplay\", \"..\/music\/songname.mp3\"]), that's all the code will do until the entire duration of the song has finished playing. I want to make things happen while the song is playing. I don't know how easy this is but I've struggled to find people online asking about the same thing. Is it possible to use a different command with the same subprocess module and achieve this result? Is there a completely separate way to achieve this? I'm open to anything, but keep in mind I'm very new to this.\nI have created a loop track so that, after a certain time in the song has been reached, it will instead play an identical track which has set beginning and end times that, when played back-to-back, create a perfect music loop. Once that first problem is solved, how can I rig this track to repeat infinitely in the background?\nI'm very new to this.","AnswerCount":3,"Available Count":1,"Score":-0.0665680765,"is_accepted":false,"ViewCount":118,"Q_Id":73629675,"Users Score":-1,"Answer":"subprocess forks then execs a process, but it waits for the process to finish before returning.  you will need to do this in a separate thread, use an asyncio suprocess interface or do an initial a fork yourself.  it is a bit tricky.  what is also complicated, is that you will likely not get a perfect gapless playback by looping subprocess commands, as python will likely take a millisecond or two to re-execute the command.","Q_Score":0,"Tags":"python,subprocess","A_Id":73629744,"CreationDate":"2022-09-07T03:09:00.000","Title":"How can I play looping music in the background as other functions are being performed?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am using PyCaret for comparison of regression models on my data.\nAfter blending of the top 3 models, how can I get the final regression equation(model) of the blender?\nPlease help!!","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":49,"Q_Id":73644297,"Users Score":0,"Answer":"lets say lr is the classifier and equation you want is mx+b, you can get:\nm=lr.Coef_\nb=lr.Intercept_","Q_Score":0,"Tags":"python,regression,linear-regression,linear-equation,pycaret","A_Id":73748305,"CreationDate":"2022-09-08T05:57:00.000","Title":"How to get regression equation?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am working on a sentiment analysis project, where the backbone is ofc a model. This was developed using sklearn's off the shelf solutions (MLP) trained with my data. I would like to \"save\" this model and use it again in JavaScript.\nAdam\nI have looked at pickle for python but I'm not sure how i could use this for JS. This is a chrome extension I am developing so I would rather not set up and server. I should add this is course work, so spending money is a no!","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":68,"Q_Id":73663673,"Users Score":0,"Answer":"After some research I pretty much determined its not possible using sklearn  in JS. My solution was to use keras and use tensorflow JS.\nAlternatively, I have learnt the maths behind the network and \"raw\" code it using no libraries. This took a lot longer than just converting everything to keras although.","Q_Score":1,"Tags":"javascript,python,scikit-learn,sentiment-analysis","A_Id":74995572,"CreationDate":"2022-09-09T14:27:00.000","Title":"Sklearn Model to JS","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am defining a python project using a pyproject.toml file. No setup.py, no setup.cfg.\nThe project has dependencies on an alternate repository: https:\/\/artifactory.mypypy.com, how do I specify it ?","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":626,"Q_Id":73664464,"Users Score":2,"Answer":"The dependency is independent on where it is hosted, the dependency is on the package not the repository.\nThe correct way to remediate the problem is to change your pip configuration to look in multiple repositories using the extra-index-url setting. This can be done either in your pip.conf or by specifying --extra-index-url on the pip command line.","Q_Score":1,"Tags":"python,setuptools,pyproject.toml","A_Id":73664862,"CreationDate":"2022-09-09T15:33:00.000","Title":"Setuptools and Pyproject.toml: specify source?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I developped an application using youtube api and python. This application launchs live streams on my channel.\nTo do so I went to google console , and created \"consent screen\", \"credentials\"  downloaded \"json auth file\"....etc then developped my code in python , run it, everything works fine in my machine and on my channel\nNow I want that this application to be used by some users (friends), so they can launch lives in their channels\nShall they create also consent screen ... because this too heavy , as consent screen asks for many details about developper profile. But the final users are not developpers\nSo please any exlanation on how to be able to use a youtube api app elsewhere","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":17,"Q_Id":73717710,"Users Score":1,"Answer":"When you give your script to others they will need to create their own project up on google cloud console. You can not share your client id and client secrete with others. Unless you can compile your python into an executable.  I believe that is possible.\nIf they don't want to create their own projects then you should host your script some place like a web page where they can then click on it authorize the app and create their live streams.  this will mean to switching to web application credentials, i am assuming you created a desktop app \/ native app currently.\nIf you go with option one the users are going to have to verify their apps themselves.  If you go with option two your going to have to verify the application run by others.","Q_Score":1,"Tags":"python-3.x,deployment,package,youtube-api,youtube-data-api","A_Id":73720202,"CreationDate":"2022-09-14T13:28:00.000","Title":"How to package and deploy a Youtbe API app to be used by other users","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"i have a MILP with ~3000 binaries, 300000 continuous variables and ~1MM constraints. I am trying to solve this on the VM how long could it potentially take on a 16 core 128 gig machine? also what are the general limits of creating problems using  pulp that cplex solver can handle on such a machine? any insights would be appreciated","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":41,"Q_Id":73738378,"Users Score":0,"Answer":"It is impossible to answer either question sensibly. There are some problems with only a few thousand variables that are still unsolved 'hard' problems and others with millions of variables that can be solved quite easily. Solution time depends hugely on the structure and numerical details of your problem and many other non-trivial factors.","Q_Score":0,"Tags":"python,cplex,pulp","A_Id":73741039,"CreationDate":"2022-09-15T23:33:00.000","Title":"scaling MILP using pulp and cplex","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"i have a MILP with ~3000 binaries, 300000 continuous variables and ~1MM constraints. I am trying to solve this on the VM how long could it potentially take on a 16 core 128 gig machine? also what are the general limits of creating problems using  pulp that cplex solver can handle on such a machine? any insights would be appreciated","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":41,"Q_Id":73738378,"Users Score":0,"Answer":"The solution time is not just a function of the number of variables and equations. Basically, you just have to try it out. No one can predict how much time is needed to solve your problem.","Q_Score":0,"Tags":"python,cplex,pulp","A_Id":73738627,"CreationDate":"2022-09-15T23:33:00.000","Title":"scaling MILP using pulp and cplex","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have to convert the object to DateTime. However, it shows a year, month, and day at the front. So how can I display only time?\nf1['Time'] = pd.to_datetime(f1['Time'], format = '%H:%M:%S.%f')\nf1['Time']\nIt shows:\n0    1900-01-01 01:32:03.897\n1    1900-01-01 02:02:34.598\n2    1900-01-01 01:34:31.421\nWhat I want is time only, like this:\n0    01:32:03.897\n1    02:02:34.598\n2    01:34:31.421","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":64,"Q_Id":73787992,"Users Score":0,"Answer":"It seems that you're successfully converting the data to datetime objects. What is being shown in the output is the string representation of the date.\nThe format string you passed to pd.to_datetime is just for parsing the dates. It does not affect their internal data. If you only need strings, you should call .strftime(\"%H:%M:%S.%f\") for each date object in your collection.","Q_Score":0,"Tags":"python","A_Id":73788206,"CreationDate":"2022-09-20T14:02:00.000","Title":"How do I delete year month and date, display only time on python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"[GAUSS-51400] : Failed to execute the command: python3 '\/soft\/openGauss\/script\/local\/PreInstallUtility.py' -t create_cluster_paths -u omm -g dbgrp -X '\/soft\/openGauss\/clusterconfig.xml' -l '\/gaussdb\/log\/omm\/om\/gs_local.log'.Error:\n[GAUSS-50202] : The \/gaussdb must be empty. Or user [omm] has write permission to directory \/gaussdb. Because it will create symbolic link [\/gaussdb\/app] to install path [\/gaussdb\/app_78689da9] in gs_install process with this user.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":17,"Q_Id":73788453,"Users Score":0,"Answer":"Under the OMM user, execute vi~\/. bashrc, clear the environment variables, and re execute the initialization script.","Q_Score":0,"Tags":"python-3.x,database","A_Id":73995873,"CreationDate":"2022-09-20T14:34:00.000","Title":"openGauss pre-installation environment error, error information see details, how to answer?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"In my webapp, I'd like to allow users who want to deploy an instance to write their own templates. Specifically, I would like to include a template for a data protection declaration using the include tag and have this point to a location which users can define in their settings.\nHowever, this would not be translatable, as all translated strings have to be in django.po and that file is in version control.\nIs there a way to extend django.po, e.g. use an include statement to point it to a second, user generated translations file, similar to how I can include templates within other templates?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":33,"Q_Id":73831490,"Users Score":0,"Answer":"Not entirely sure if this is possible, but you best bet is probably to use some other mechanism for translation. For example, you could create a template-tag user_translation and make it fetch the translation from the database or settings.","Q_Score":0,"Tags":"python,django,django-templates,translation","A_Id":74464419,"CreationDate":"2022-09-23T18:09:00.000","Title":"Are user provided translations for user provided templates possible with the django template engine?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"We currently have a working application that is ready to post and get data from an API which displays results of predicted disease (purpose of the ML model). Right now we don't have an exact idea on how to make the .ipynb communicate with the application provided we have large data for training the model.\nWe have 2 .ipynb files Model.py and Predict.py. One performing the required pre-processing, split (for train, test and validation), train and save the model. Predict uses the saved model and classifies the user input.\nThe main concern is how do we send the data from User's end-point(Flutter Application) to Predict.py and get the result data back to the user on the application.\nWe have considered the idea of hosting the model with prediction somewhere, but do not know on how to proceed further.\nThis is my first encounter with handling Deep Learning with Flutter Application. Any kind of information on proceeding forward will be very helpful.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":300,"Q_Id":73869152,"Users Score":0,"Answer":"First, .ipynb files are Jupyter Notebooks.\nSecond, do you have your API ready ? Is there a server dedicated to it or is there only the flutter app, that is ony the front of your application.\nIf you do not have an API, you have to create one (using whatever framework you want).\nTo facilitate things, create it in Python, and you can directly import your model as a Python module and use it.","Q_Score":1,"Tags":"python,flutter,rest,tensorflow,hosting","A_Id":73869441,"CreationDate":"2022-09-27T14:18:00.000","Title":"How do I integrate a Flutter application with ipynb\/colab notebook?","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have a python script that is using\nwhile:\ntry:\nexcept:\nI am wondering how to stop it running (not exit script) and then return to the beginning.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":32,"Q_Id":73875497,"Users Score":0,"Answer":"I think I have this now. when using except, just call the main function again.","Q_Score":1,"Tags":"python,exception","A_Id":73889312,"CreationDate":"2022-09-28T02:12:00.000","Title":"Stop script and return to beginning","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Q1:\nWhen I have a GRPC connection with one server(S) and several clients(C1 and C2)(Using Response-streaming RPC).\nI wonder how frames S sends to C1 and C2?\nFor example, there's 10 frames that server needs to response. What will C1 and C2 receive separately and Why?\n\nC1 gets 5 frames and C2 gets another 5(I tried my program and seems it acts like this way)\nC1 gets all 10 frames C2 gets the same all 10 copies.\n\nAnd is there a way to choose from 1 or 2?\nQ2:\na GRPC connection with only one server(S) and only one client(C) this time(Using Response-streaming RPC still).\nI forcely stop C(i.e. ctrl+c) and restart the program(C_second).But this time C_second still only gets parts of frames that S sends.\nSeems the connection between S and C(forcely stopped) still be alive?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":183,"Q_Id":73877598,"Users Score":2,"Answer":"gRPC is point-to-point. The connection C1 -> S and C2 -> S are separate. Any message that S sends will be directed at either C1 or C2. If duplication is required between clients, the server application logic will need to manage this itself.\n\nGreat question. This is a point that people often miss in designing their protocol. gRPC itself is stateless. If a channel dies, the client will not attempt to download previously sent messages. Instead, the RPC needs to be made idempotent or stateful. That is, if checkpointing needs to happen in a streaming API, the application needs to manage that itself.","Q_Score":0,"Tags":"python,c++,grpc","A_Id":73954016,"CreationDate":"2022-09-28T07:17:00.000","Title":"GRPC with one server and several clients","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm not used to the TextVectorization Encoder Layer. I created my vocabulary manually before. I was wondering how one can save a Keras Model which uses the TextVectorization layer. When I tried to do it with simply model.save() and later models.load_model() I was prompted with this error:\nAssertionError: Found 1 Python objects that were not bound to checkpointed values, likely due to changes in the Python program. Showing 1 of 1 unmatched objects: [<tensorflow.python.ops.lookup_ops.MutableHashTable object at 0x7fb9602df7c0>]","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":76,"Q_Id":73887948,"Users Score":0,"Answer":"I've solved my problem by using another version of Keras. If someone faces a similar issue I can recommend to use a different (most of the time newer) version of Keras.\nAs I already said in my comment. I can't really recommend Keras and or Tensorflow right now. I've started a big NLP project some time ago (half a year). And since then Keras had multiple updates. Their documents changed like 2 times. And the old examples are not there anymore. The new way to create Text Tokens is quite nice but their example uses Masking_zero=True. Which basically means that It will pad the sequences for you and following layers will ignore the zero. That sounds nice but masking is not compatible with Cuda which makes training larger models a time consuming job because it's not hardware accelerated with the GPU. And most NLP models are quite large.","Q_Score":1,"Tags":"python,tensorflow,keras,text-classification","A_Id":74070916,"CreationDate":"2022-09-28T21:25:00.000","Title":"Save TextVectorization Model to load it later","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"There is exactly one module in the \"pinax\" contributed library \u2013\u00a0which is essential to my project \u2013 that I wish to override.  And that one module is site-packages\/pinax\/templatetags\/templatetags\/shorttimesince_tag.py, which references the django.utils.tzinfo module which no longer exists in current Django.  (Having been replaced by django.utils.timezone.\nI would like to \"override\" this particular module by arranging things so that Python will encounter it first.  Well, I tried unsuccessfully to put this into the wsgi file of the application:\n\nsys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), \"overrides\")))\n\nI then created an overrides\/pinax\/templatetags\/templatetags directory tree with an __init__.py file in each.\nI don't think that Django gets this far, before it dies with an import error.  (Because a \"print()\" statement didn't produce any output.)\nBut, I feel that something along these lines ought to work.  Because I really don't want to have to absorb this entire contributed library into my application, literally just to change one line of source.\nAny ideas?  Am I just barking up the wrong tree? *(P.S.: I am also using another library, the \"machina\" forum, which does include a very nice built-in \"override\" mechanism. But I don't know exactly how it works, and I haven't yet \"dumpster-dived\" to find out ...)","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":131,"Q_Id":73929927,"Users Score":1,"Answer":"Tested it with local files, and it seems, when you override a package by creating a package in override with same name and __init__.py inside, it overrides the whole original package, not just the files you've created. So you have to copy all the files from that package.\nAnd if you don't specify __init__.py, python doesn't recognize your package and imports the original.\nI think, the best way here is to fork the original package's repo, change it, and use the fork in your project. Also consider creating a PR to the original repo if you think your changes might be useful to others.","Q_Score":0,"Tags":"python,django,wsgi","A_Id":73931899,"CreationDate":"2022-10-02T23:04:00.000","Title":"Django: I want to override exactly one module in a contributed library to patch one tiny thing","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"My code was working 2 days ago and then chrome updated. I have no idea how to address the below issue, though the specific problem is very clear.\n\nselenium.common.exceptions.SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 104\nCurrent browser version is 106.0.5249.91 with binary path C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe\n\nCan you help?","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":3833,"Q_Id":73952807,"Users Score":1,"Answer":"I solved this by two steps\n\nchecked the verison of chrome by going to settings > about chrome > updating version\nCheck the chrome driver download version  matching to chrome version\n\nunzip the downloaded file and read to go","Q_Score":0,"Tags":"python,selenium,selenium-chromedriver","A_Id":74050295,"CreationDate":"2022-10-04T19:31:00.000","Title":"Chrome Updated To Version 106 - Selenium No longer works","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm a bit new to MicroPython, Scripting languages, etc. So currently, I'm working on a project in which I'm using NUCLEO-G431RB(128kb flash and 32kb ram). STM32G43RB is a low-memory microcontroller. Hence, officially, no MicroPython file firmware file is available for this board.\nAs Micropython is an open-source platform, the code files are available on the website. Therefore, I wanted to know how I could compile Micropython source code with only selected modules (basic hardware peripheral modules) and eliminate all unnecessary modules (Bluetooth, network, etc.).\nMy overall goal is to have a bare minimum stack (which I can upload on the low-memory controller as well) of Micropython so that I can run a basic code dealing with hardware peripherals and like that. Any lead, hint or link would be helpful and much appreciated.","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":68,"Q_Id":73962515,"Users Score":1,"Answer":"The key to the answer is py\/mpconfig.h. That file lists all PP symbols which can conditionally enable the core code. In your own port's config file, normally named mpconfigport.h, you then #define MICROPY_SOME_FEATURE 0 to disable the feature.","Q_Score":0,"Tags":"python,stm32,micropython","A_Id":74013352,"CreationDate":"2022-10-05T15:09:00.000","Title":"how to rebuild micropython with selected module?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am creating a bot for a VIP channel, and I have a question. How can I implement a kick through time?\nThe bot has subscriptions for 1, 3, 12 months, how can I make the user get kicked from the group in a month?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":27,"Q_Id":74018644,"Users Score":0,"Answer":"Make a database with users, their subscription plans, when they subscribed.\nThen loop trough the database every day and if (current_date > (when_they_subsribed + their_subscription_plan)): kick(user).\nIf you need any help in coding that then write to me on discord. RobertK#6151","Q_Score":0,"Tags":"python,telegram,telegram-bot","A_Id":74018855,"CreationDate":"2022-10-10T17:29:00.000","Title":"How to kick through time? Telegram Bot","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am working on a project, in which we have requirement that we have to start our primary key by 1001. The framework used is Django here.\nSo, we have to create a migration having id as alter field. But I don't know how to alter sequence of primary key. From some articles, I use auto_increment but it gives error of undefined.\nThanks","AnswerCount":2,"Available Count":1,"Score":-0.0996679946,"is_accepted":false,"ViewCount":26,"Q_Id":74024239,"Users Score":-1,"Answer":"One thing you could do is in you migrations file create a RunPython script, and in there create 1000 records of whatever you need to start at pk 1001, and after that you delete all of these objects. Then the next object you will create for that model will have pk 1001. Not really pretty, but it would work.","Q_Score":0,"Tags":"python,django,django-models","A_Id":74024527,"CreationDate":"2022-10-11T07:07:00.000","Title":"Alter primart key in django model, must start with 1001","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"I am using mailgun to send an email to notify users that their requested download for the data has been completed, with a link to download the file, the file is stored on AWS.\nYour data is ready for download <a href=\"aws-link\" download>here<\/a>\nSomething like this.\nIs there a way to tell the browser to download the file, instead of opening it in a new tab? I guess it's the problem with MIME type, but how do I set it up","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":22,"Q_Id":74024364,"Users Score":0,"Answer":"Okay, so the file is automatically downloaded if I set the Content-Type to binary\/octet-stream when uploading the file in AWS Bucket.\nI was looking into the opposite side of the puzzle.","Q_Score":0,"Tags":"python,mailgun","A_Id":74039655,"CreationDate":"2022-10-11T07:20:00.000","Title":"How do I Set MIME Type for a download link from Mailgun","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I need to install Python and Selenium webdriver on a PC that does not have access to the internet, and don't how to accomplished that.\nSofar, I managed to download Python onto a thumb drive and was able to install it on the PC. But when it comes to Selenium webdriver, I don't know what to do.\nPlease help.\nRegards,\nKiet","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":27,"Q_Id":74034917,"Users Score":0,"Answer":"You can create a virtual environment with all dependencies that you need and transfer the venv folder.","Q_Score":0,"Tags":"python,selenium-webdriver","A_Id":74035006,"CreationDate":"2022-10-11T23:10:00.000","Title":"How to install Python and Selenium wed driver without having access to the internet","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am writing a LoadTestShape Class. I want to be able to set number of transaction per minute. If I try to set it by specifying user_count it doesn't work because the RPS will vary cpu to cpu .\nIf say I want to set 1000 transaction per minute, how can we achieve that in locust?","AnswerCount":3,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":142,"Q_Id":74039932,"Users Score":0,"Answer":"I ended up using constant_throughput to control the number of requests per second.\nFor different time of the day I'd use a different throughput value.\nSimply set the wait_time = constant_throughput(0.1). Based on RPS you want you can either set the value low for less number of requests and more for more RPS.","Q_Score":0,"Tags":"python-3.x,load-testing,locust","A_Id":74111361,"CreationDate":"2022-10-12T09:59:00.000","Title":"How to set transactions per minute in Locust","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am new in programming in Python 3. When I was installing Anaconda, after choosing the folder I got the following warning: \"Warning: 'Destination Folder' contains 1 space. This can cause problems with several Conda packages. Please consider removing the space.\" I am running on Windows 10 64 bit. Can anyone tell me what is that space and how could I remove it? Any suggestions please? Thanks","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":153,"Q_Id":74069147,"Users Score":1,"Answer":"Typically in programming you want to avoid directories which contain spaces. Windows environments are prone to a lot of 'spacy' directories. I suggest you input cd in your windows shell (or pwd for unix) to get your current directory path. If there's any spaces in there, you should rename them to remove empty spaces.","Q_Score":1,"Tags":"python,anaconda,anaconda3","A_Id":74071835,"CreationDate":"2022-10-14T12:21:00.000","Title":"Warning message while installing Anaconda3","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have deployed a service in cloud run that takes about 40\/45 minutes to run.\nIt should run everyday but I don't know how to cron it.\nI have tried with cloud scheduler but I received a status DEADLINE_EXCEEDED message.\nCan you recommend another service?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":63,"Q_Id":74073637,"Users Score":0,"Answer":"Sadly, there is no serverless service with a timeout above 30 minutes for now (Cloud Workflows, Cloud Task, Scheduler are limited to 30 minutes max, 10 minutes for PubSub).\nHowever, even if your Cloud Scheduler log in error the invocation (because no answer has been received in the 30 minutes), your process continue to run. You simply doesn't have the retry features (retries on error, timeout, ....)\nIf you want to implement retries, you have complex architecture to build based on Cloud Logging, sinks, PubSub and Cloud Functions\/Cloud Run to be able to re invoke your long running service (in mode \"fire and forget\")","Q_Score":0,"Tags":"python,google-cloud-platform,google-cloud-run,google-cloud-scheduler","A_Id":74074699,"CreationDate":"2022-10-14T18:50:00.000","Title":"How to execute Google Cloud Run service every day?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Given a numpy array 'a', a[0,0] and a[0][0] return the same result, so how do I choose them and what is the difference between them?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":29,"Q_Id":74079014,"Users Score":0,"Answer":"Assuming that a is 2D, a[0] will return the first row. You can then index into that by column, which is what you're doing with a[0][0]. Both options return the upper left element. The single indexer call (aka, [0,0]) is likely more performant, if that's all you're doing, but it can be convenient to iterate through the rows and work with them individually.","Q_Score":0,"Tags":"python,numpy","A_Id":74079129,"CreationDate":"2022-10-15T11:27:00.000","Title":"Difference between a[0,0] and a[0][0] in numpy array?","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have a problem which works to a degree in Excel using solver. However, I do not know how it can be done within Power BI*\nWhat I essentially want to do is distribute\/reallocate volume across several categories.\nExample:\nI have 5 warehouses all working at different productivity efficiencies.\n\nWarehouse A = 90 throughput rate per hour - Max Capacity 1,200,000\nWarehouse B = 85 throughput rate per hour - Max Capacity 800,000\nWarehouse C = 100 throughput rate per hour - Max Capacity 2,200,00\nWarehouse D = 75 throughput rate per hour - Max Capacity 1,000,000\nWarehouse E = 95 throughput rate per hour - Max Capacity 1,100,000\n\nI have 5,000,000 units of volume that I need to distribute to these 5 warehouses. The idea is to reduce cost so the most efficient warehouse should get as much of this volume until it hits its maximum capacity after which it moves to the warehouse with the second best throughput rate.\nSo in this example Warehouse C will get allocated as much volume as it can take before they hit their max capacity. Then it will move to warehouse E, then Warehouse A. The algorithm should stop as soon as the 5,000,000 units are used up.\n(Cost is calculated using the cost per labor hour \u00a315. i.e Volume (units) \/ Throughput rate = Hours ; Hours * \u00a315 = \u00a3 Cost)\nIs there a way to do this?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":43,"Q_Id":74108766,"Users Score":0,"Answer":"You can run R scripts from Power BI. There are R packages to model and solve problems like this. I would start by developing a mathematical model for this problem. That makes it easier to select a suitable package.","Q_Score":0,"Tags":"python,excel,algorithm,powerbi,solver","A_Id":74114934,"CreationDate":"2022-10-18T09:34:00.000","Title":"Power Bi - Solver Function","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":1,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have not been able to come up with a better title, it's a really simple issue though, I just don't know what to call it exactly.\nI have a database of horses simplified here:\n\n\n\n\nhorse_name\nstable_name\n\n\n\n\nHorse1\nStable1\n\n\n\n\nI am only interested in further analyzing records which feature stables that own many horses so I wanted to filter out the small stables (ones with less than 10 horses).\nWhat I've tried:\nAttempt 1:\nStep 1: df['Stable'].value_counts() > 10  -> gives me boolean values, I inteded to use this to only query the part of the database that satisfied this condition.\nStep 2: df[df['Stable'].value_counts() > 10] -> I wrap this in another df, hoping I get the result that I want, but I don't, I get a key error.\nAttempt 2:\nStep 1: df['Stable'].value_counts().sort_values(ascending=False).head(21)  -> a little clunky, but by trial and error, I figured out there are 21 stables with more than 10 horses, and this query returned just those stables. All I needed now is to filter the database out using this result.\nStep 2: df[df['Stable'].value_counts().sort_values(ascending=False).head(21)] -> same issue, returns a key error.\nI also tried: df[df['Stable'] in df['Stable'].value_counts() > 10] again, that didn't work, and I don't think I'll sleep today.\nCan anyone explain why this is happening in a way that I can understand? And how should this be done instead?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":35,"Q_Id":74118560,"Users Score":0,"Answer":".value_counts() returns a series where it counts the unique values of the values in the column.\nTry this:\ndf[df['Stable'] > 10]","Q_Score":0,"Tags":"python,pandas","A_Id":74118586,"CreationDate":"2022-10-18T23:56:00.000","Title":"Selecting rows based on a '>' condition of the iteration of one of the columns","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"I'm using XGBoost model to predict attacks, But I get 100% accuracy, I tried Random Forest as well, and same, I get 100%. How can I handle this ovrefitting problem ?\nThe steps I followed are:\nData cleaning\nData splitting\nFeature scaling\nFeature selection\nI even tried to change this order, but still get the same thing.\nDo you have any idea how to handle this? Thanks","AnswerCount":2,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":45,"Q_Id":74131790,"Users Score":2,"Answer":"Overfitting occurs when your model becomes too complex for its task. Simply said instead of learning patterns in your data, the model will be able to learn every case it is presented in the training set by heart.\nTo avoid this, you will have to choose a model that is less complex, in your case reduce the depth of your trees. Split your data in separate train, validation and test sets, then train different models of different complexities. When you evaluate these models, you will notice that its predictive capabilities on the training set will increase with complexity. Initially its capabilities on the validation set will follow until a point is reached where no more increase on the validation set can be achieved. On the contrary, it will likely decrease beyond this point, because you are starting to overfit.\nUse this data to find a suitable model, then finally evaluate the model you decided to use by using the test set you have kept aside until now.","Q_Score":0,"Tags":"python,security,classification,random-forest,xgboost","A_Id":74132053,"CreationDate":"2022-10-19T20:54:00.000","Title":"How can I handle overfitting of a model?","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"My final project in CS50 is a salary slip generator in pdf format. I got these functions with me but I don't know to test them.\n\ncreate_pdf() - function that opens my data file (.xlsx), iterates over its data, puts them into variables which will then be called by fpdf to put them into the pdf file. This function will generate as much pdf's depending on the number of data inside the data file.\n\nmerge_pdf() - function that merges all the previously generated pdf's into one pdf. This function I might try to check if it outputs the merged pdf or not but still not quite clear to me how to implement it.\n\nget_print_date() - this function only I created just for the sake of adding extra functions to my project hoping that I can test it. It takes datetime.now() and returns the string value of the current date and time. But how can I assert also the return value if the return value changes over time?","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":43,"Q_Id":74136789,"Users Score":2,"Answer":"Mine is a generic answer regardless of the language used.\nGenerally, when I have to test some method or function that has side effects or does not return any data, I check for some basic functions called within this function, and I mock them.\nThese core features are features that I assume are working and do not need to be further tested, such as:\n\nFiles management;\nAccess to the database;\netc..\n\nI therefore suggest you find some libraries to allow you to make mocks of the services used within your functions and change the architecture of your software accordingly.\nI hope I was clear.","Q_Score":0,"Tags":"python,unit-testing,pyfpdf","A_Id":74136971,"CreationDate":"2022-10-20T08:37:00.000","Title":"Unit Testing Functions without Return Value in Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"I have a coded an AI Python program and now I want to implement it in a mobile application. How can I add the python program in the mobile application, and which programming language should I use for the application to implement the python program?","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":23,"Q_Id":74137889,"Users Score":1,"Answer":"since python has no built-in mobile app development capability. But you can use other packages to create some sort of mobile application for this you can use packages like Kivy, PyQt, or even Beeware's Toga library.","Q_Score":1,"Tags":"python,mobile,artificial-intelligence","A_Id":74867763,"CreationDate":"2022-10-20T09:53:00.000","Title":"how can we add a python program to a mobile application?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am trying to delete the contents of a column but would like to keep the column.\nFor instance I have a table like.\n\n\n\n\nNumbers1\nNumbers2\nNumbers3\nNumbers4\nNumbers5\n\n\n\n\nfive\nfour\nthree\ntwo\ntwo\n\n\nsix\nseven\neight\nnine\nten\n\n\nnine\nseven\nfour\ntwo\ntwo\n\n\nseven\nsix\nfive\nthree\none\n\n\n\n\nI would like to remove all the contents of column b but I want to keep column Numbers2\nthe desired output be like\n\n\n\n\nNumbers1\nNumbers2\nNumbers3\nNumbers4\nNumbers5\n\n\n\n\nfive\n\nthree\ntwo\ntwo\n\n\nsix\n\neight\nnine\nten\n\n\nnine\n\nfour\ntwo\ntwo\n\n\nseven\n\nfive\nthree\none\n\n\n\n\nkindly help\nThankyou","AnswerCount":4,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":33,"Q_Id":74141926,"Users Score":0,"Answer":"First, you could delete the column with df = df.drop('Numbers2', axis=1)\nSecond, replace the column with df['Numbers2'] = \"\"","Q_Score":1,"Tags":"python,pandas","A_Id":74142015,"CreationDate":"2022-10-20T14:50:00.000","Title":"how to remove the contents of a column without deleting the column in pandas","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"For the past few days, i've been trying to set up a FastAPI & Uvicorn server on my Windows machine (although the main idea is to set it up on an old Android device that i dont use anymore.)\nThe server (in both my android and my pc) can be reached by any machine in my local network. The problem comes when I try to access it through my public IP. So far I have done everything i can think of to try solv it:\n\nPort forwarding TCP port 8000 (and others) to my PC's and Android's IP.\nAllow incoming and outgoing connections in Windows's Firewall (not sure how to do this in Android though)\n\nSome things to have in mind:\n\nI don't want to host the server in the cloud as it needs to interact with local devices. For example, to send WOL packages to my laptop.\nI have tried to use reverse proxy services like Ngrok, but the link changes every X amount of time, so it's not reliable enough.\nMy android device,which is a Sony E2053, currently runs rooted 4.4.4 kitkat, without the possibility to install a custom ROM (locked bootloader).\n\nI barely have knowledge about networking so I'm really messed up with this. Any help is aprecciated.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":161,"Q_Id":74148281,"Users Score":0,"Answer":"This question is way to broad for StackOverflow, and is highly dependent on the specifics of your situation. However, to get you going here is a highlevel overview of how it would normally work.\nSituation: you have a house, in which there is a internet connection to which your computer is connected. There are two networks at play: your internal network (LAN) and your internet (WAN). Your modem\/router connects these two networks together. Your computer has a internal IP (10.x.x.x or 192.x.x.x typically), so has your modem\/router. Your modem\/router also has a public IP address. You can find that public IP when going to websites as whatismyip.com.\nIn order for your local computer to be reachable via the internet, you need to forward the traffic meant for you computer to your computer on your modemrouter. Typically this is done by portforwarding on the modemrouter. On your modemrouter there would be a setting that let you forward all incoming traffic on port 8000 to :8000.\nThen, when you ar eon the internet and browse to :8000, the request is forwarded to your computer and returned to you over the internet.\nHowever, since you are very novice at this stuff, I would HIGHLY advise against such setup. The internet is a scary place and opening yourself up to attack is never a good idea.","Q_Score":0,"Tags":"python,android,windows,fastapi,uvicorn","A_Id":74150816,"CreationDate":"2022-10-21T02:52:00.000","Title":"FastAPI Server is not accessible from the internet","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have overridden django_tenants.utils.tenant_context to activate a timezone specific to the tenant.\nclass NewTenantContext(tenant_context): ...\nI can use the new context like this\nwith ALSTenantContext(tenant): ...\nAll this works fine for a specific process to start for a tenant.\nBut how do I make sure NewTenantContext is used when tenant is set from Admin or API?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":45,"Q_Id":74154851,"Users Score":0,"Answer":"I am able to resolve this by overriding middleware  django_tenants.middleware.TenantMainMiddleware","Q_Score":0,"Tags":"python,multi-tenant,django-tenants","A_Id":74190739,"CreationDate":"2022-10-21T14:03:00.000","Title":"Django: Multi Tenancy : Override Tenant Context","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am doing notification window and I want to do when massage pop up is shows for some time and then it clears it self.\nI know how to do that it waits with time.sleep() but I dont know how to clear screen.blip().","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":6,"Q_Id":74163750,"Users Score":0,"Answer":"I think the best thing for you to do is to draw the whole window again, removing the pop up. So when the condition to send the message is met, redraw the window with the message, and then after a few seconds, redraw it again without that pop up. The window is redrawn all the time when your screen refreshes anyway, so you're not doing anything drastic.","Q_Score":0,"Tags":"python,python-3.x,notifications,screen,blit","A_Id":74163799,"CreationDate":"2022-10-22T12:56:00.000","Title":"How to clear screan.blit()","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"value = 12343211122321\nprint(value.count(1))\nThe count() function does not tell me how many time the number 1 is in the value variable.\nWhat do I have to do?","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":47,"Q_Id":74171267,"Users Score":2,"Answer":"Try something like print(str(value).count('1')) as count() is a method of str or list objects (and not int)","Q_Score":0,"Tags":"python,count","A_Id":74171304,"CreationDate":"2022-10-23T12:48:00.000","Title":"How to count how many times a number occurs in a very large number","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have a large dataframe which combines data from multiple excel (xlsx) files. The problem is every column with decimal values is seperated with a dot.I need to replace every dot with a comma. I have already tried using the replace function, but the issue some columns also contains string values. So my question is, how do I replace dot with comma on each column in my dataframe and also keep the string values?\nExample:\nColumn a: \n14.01 -> 14,01 \nNo data (keep)","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":42,"Q_Id":74181374,"Users Score":0,"Answer":"This is probably your default language setting for Office tool is US or UK where . is used a decimal denoter where as in languages like German it is a ,. If  you are using Libre Office, you can go to Tools -> Language -> For all text -> More and change the default decimal separator key. If you are using Microsoft excel, there should be something similar. Afterwards save the excel and then open it back in pandas. Voila.","Q_Score":0,"Tags":"python,pandas","A_Id":74181711,"CreationDate":"2022-10-24T12:52:00.000","Title":"Replace dot with comma using pandas on dataframe","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I need to find the minimum distance from a point (X,Y) to a curve defined by four coefficients C0, C1, C2, C3 like y = C0 + C1X + C2X^2 + C3X^3\nI have used a numerical approach using np.linspace and np.polyval to generate discrete (X,Y)  for the curve and then the shapely 's Point, MultiPoint and nearest_points to find the nearest points, and finally np.linalg.norm to find the distance.\nThis is a numerical approach by discretizing the curve.\nMy question is how can I find the distance by analytical methods and code it?","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":130,"Q_Id":74207528,"Users Score":1,"Answer":"You need to differentiate (x - X)\u00b2 + (C0 + C1 x + C2 x\u00b2 + C3 x\u00b3 - Y)\u00b2 and find the roots. But this is a quintic polynomial (fifth degree) with general coefficients so the Abel-Ruffini theorem fully applies, meaning that there is no solution in radicals.\nThere is a known solution anyway, by reducing the equation (via a lengthy substitution process) to the form x^5 - x + t = 0 known as the Bring\u2013Jerrard normal form, and getting the solutions (called ultraradicals) by means of the elliptic functions of Hermite or evaluation of the roots by Taylor.\n\nPersonal note:\nThis approach is virtually foolish, as there exist ready-made numerical polynomial root-finders, and the ultraradical function is uneasy to evaluate.\nAnyway, looking at the plot of x^5 - x, one can see that it is intersected once or three times by and horizontal, and finding an interval with a change of sign is easy. With that, you can obtain an accurate root by dichotomy (and far from the extrema, Newton will easily converge).\nAfter having found this root, you can deflate the polynomial to a quartic, for which explicit formulas by radicals are known.","Q_Score":0,"Tags":"python,geometry,shapely","A_Id":74209808,"CreationDate":"2022-10-26T12:10:00.000","Title":"Finding the minimum distance from a point to a curve","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I've got a database with production data in multiple tables. I want to analyze the history of the units produced and create a timeline. I am doing this in Python (jupyter lab notebook) and using a cloud based MySQL 8.0 database. Neither of the IDs (both strings and integers) is the primary ID in the database and the IDs cannot be assumed to be sequential. My current strategy is to\n\nFirst get the IDs from the first event.\nDo a new query with a WHERE IN [previous IDs] cluase.\nExtract  ID's from 2.\nRepeat 2-4 until the final stage.\n\nThe IDs are not primary keys in any table. This strategy isn't working as in one stage I have over 800 000 IDs that goes into WHERE IN clause and I can't execute it. Bonus question: Should it work, or is there a limitation in how the query can be formed (such as number of characters or length etc.)?\nWhat I wonder is how to execute this? Is there a way to perform this in a better SQL query or should I split this into multiple queries? Can I use some Python tricks to kind of stream the data in multiple parts?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":57,"Q_Id":74235148,"Users Score":4,"Answer":"I have over 800 000 IDs that goes into WHERE IN clause\n\nThat's way, way too many for IN .\nThe best way to handle this kind of volume is to use a temporary table with CREATE TEMPORARY TABLE and join the tables instead of using IN.  A temporary table can have an index so that can help speed things up for the join.\nThis may seem like a very heavy operation but actually it's not; mysql is very good at this kind of thing.","Q_Score":0,"Tags":"python,mysql,sql,where-clause","A_Id":74235230,"CreationDate":"2022-10-28T12:04:00.000","Title":"How to efficiently query with a long \"WHERE IN [list]\" clause?","Data Science and Machine Learning":0,"Database and SQL":1,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm using Django on Ubuntu 18.04.\nI've got everything set up. And I type python manage.py run_huey in the server (through an SSH connection) to start huey, and it works.\nHowever this is done through the command line through SSH and it will shut off when I close the SSH connection.\nHow do I keep run_huey running so that it will stay active at all times? Furthermore, after a system reboot, how do I get run_huey to automatically start?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":33,"Q_Id":74243241,"Users Score":0,"Answer":"You may explore supervisorctl utility for ubuntu, it keeps process running and can log into file and any other features. Google it.","Q_Score":0,"Tags":"python-huey","A_Id":74613571,"CreationDate":"2022-10-29T06:24:00.000","Title":"Using Huey with Django: How to keep run_huey command running?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"how to use pretrained model on 512x512 images on real images with different sizes like Yolo object detection on real image ?\nCNNs require fixed image sizes, so how do you manage to use the models on real images larger than the inputs?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":38,"Q_Id":74245656,"Users Score":0,"Answer":"If it is just about the image size, you could resize your image to have same size as model input. When you receive the output, assuming that you have bounding boxes or locations etc, you can always rescale them back to original image size. Many ML\/DL frameworks provide this functionality","Q_Score":0,"Tags":"python,pytorch,conv-neural-network","A_Id":74245680,"CreationDate":"2022-10-29T13:22:00.000","Title":"how to use pretrained model CNN with real images various size?","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Ok, no code here, more trying to get some directions.\nI'm working on my home automation using tuya objects. Till now I was able to create a websocket (using python websockets and asyncio) that gets a message and turn on my devices. I created a flask website to configure passwords, keys etc. Now what I'm trying to achieve is using a NFC tag(scanned by my phone) call the websocket sending a message. I bought some NFC tags, got a an android app called NFC Tools to record data into the NFC tag.\nProblem is NFC tools doesnt give me too many options I can add text, and URLs but I dont know how to call my websocket from there. Can I call it using its URL like ws:\/\/something.go? Can I make the phone not open a browser when I scam the tag? Should I create a page on flask for that and put the page address?\nAnyway, I'm kind of lost. Can you guys point me in the right direction?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":47,"Q_Id":74275501,"Users Score":0,"Answer":"End up creating a get route on flask and using NFC Tools Pro with http get to access it. The route just send a message to my websocket and turn on or off my devices. Thx Andrew for the tip I will have that in mind if this goes anywhere far from a personal project.","Q_Score":0,"Tags":"python,flask,mobile,websocket,nfc","A_Id":74282375,"CreationDate":"2022-11-01T11:52:00.000","Title":"How Call a Python Websocket from a NFC Scanned on the phone(straight from the phone like with a URL)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am want to connect\/know if there are ways to get Bloomberg data to Python. I see we can connect through blpapi\/pdblp package.\nSo wanted to check what is the pricing for this. Appreciate if anyone can help me here?\nGetting ways to connect to Python to get Bloomberg data","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":162,"Q_Id":74284145,"Users Score":1,"Answer":"Bloomberg has a number of products, which support the real-time API known as the BLP API. This API is a microservice based API. They have microservices for streaming marketdata (\/\/blp\/mktdata), requesting static reference (\/\/blp\/refdata), contributing OTC pricing (\/\/firm\/c-gdco), submitting orders (\/\/blp\/emsx), etc etc. The API supports a number of languages including Python, Perl, C++, .NET, etc. The API pattern requires setting up a session where you 'target'\/connect to a delivery point. There are several flavours of delivery points depending on what Bloomberg products you buy. For the Bloomberg (Professional) Terminal, you have something called Desktop API (DAPI), they have something called the Server (SAPI), they have something called B-PIPE, another is EMSX. They all present delivery points. They all support the same BLP API.\nThe Bloomberg Terminal's delivery point is localhost:8194. No Bloomberg Terminal, no localhost delivery point. However, maybe your organisation has bought an Enterprise B-PIPE product, in which case you don't need a Bloomberg Terminal, and the delivery point will sit on at least two servers (IPs), again on port 8194.\nSo, bottom line, the API library is available and you can develop against it. Problem is, the first few lines of creating a session object and connecting to the end point will fail unless you have a Bloomberg product. There's no sandbox, sadly.\nPricing depends on product, and unfortunately you'll also need to consider your application use-case. As an example, if you're writing a systematic trading application, then the licensing of the Bloomberg (Professional) Terminal will not permit that, however, a B-PIPE will include a licence that will permit that (plus hefty exchange fees if not OTC).\nGood luck.","Q_Score":0,"Tags":"python,bloomberg,blpapi","A_Id":74503768,"CreationDate":"2022-11-02T03:46:00.000","Title":"Subscription fees to use blpapi package","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am relatively new to web development and very new to using Web2py. The application I am currently working on is intended to take in a CSV upload from a user, then generate a PDF file based on the contents of the CSV, then allow the user to download that PDF. As part of this process I need to generate and access several intermediate files that are specific to each individual user (these files would be images, other pdfs, and some text files). I don't need to store these files in a database since they can be deleted after the session ends, but I am not sure the best way or place to store these files and keep them separate based on each session. I thought that maybe the subfolders in the sessions folder would make sense, but I do not know how to dynamically get the path to the correct folder for the current session. Any suggestions pointing me in the right direction are appreciated!","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":28,"Q_Id":74292386,"Users Score":0,"Answer":"I was having this error \"TypeError: expected string or Unicode object, NoneType found\" and I had to store just a  link in the session to the uploaded document in the db or maybe the upload folder in your case. I would store it to upload to proceed normally, and then clear out the values and the file if not 'approved'?","Q_Score":0,"Tags":"python,web2py","A_Id":74293312,"CreationDate":"2022-11-02T16:12:00.000","Title":"Using temporary files and folders in Web2py app","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am relatively new to web development and very new to using Web2py. The application I am currently working on is intended to take in a CSV upload from a user, then generate a PDF file based on the contents of the CSV, then allow the user to download that PDF. As part of this process I need to generate and access several intermediate files that are specific to each individual user (these files would be images, other pdfs, and some text files). I don't need to store these files in a database since they can be deleted after the session ends, but I am not sure the best way or place to store these files and keep them separate based on each session. I thought that maybe the subfolders in the sessions folder would make sense, but I do not know how to dynamically get the path to the correct folder for the current session. Any suggestions pointing me in the right direction are appreciated!","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":28,"Q_Id":74292386,"Users Score":0,"Answer":"If the information is not confidential in similar circumstances, I directly write the temporary files under \/tmp.","Q_Score":0,"Tags":"python,web2py","A_Id":74326905,"CreationDate":"2022-11-02T16:12:00.000","Title":"Using temporary files and folders in Web2py app","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Can anyone please tell me how to stop my server? I did like the first few things you need to do in order to commence a django webpage, url pattern, request, HttpResponce etc. and I ran my server but that rocket is still showing on my screen despite trying to kill, pkill, ctrl+pause, ctrl+C.\nI'm so done with this...\nI looked up on The Internet how to stop my django server. Nothing worked. On top of that when I ran it I got a \"ModuleNotFoundError\" but the rocket is still showing when I type in the numbers...","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":17,"Q_Id":74306261,"Users Score":0,"Answer":"Without a screenshot, we can only guess the issue.\nI see you've tried some of the basic keybinds, have you tried CTRL+F4?\nYou could also kill the process.\nps auxw | grep runserver\nThis will return a process and the associated PID\nde        7956  1.8  0.6 540204 55212 ?        Sl   13:27   0:09 \/home\/de\/Development\/sampleproject\/bin\/python .\/manage.py runserver\nthen kill it with\nkill 7956\nPlease make sure there are no &'s in your command as it may send it to the background.","Q_Score":0,"Tags":"python,django","A_Id":74306561,"CreationDate":"2022-11-03T16:12:00.000","Title":"I launched a django server and now I can't stop the process","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I've trawled through stack overflow, several youtube videos and can't for the life of me work this out.\nI've unpackaged and pulled from git, all files are where they need to be as far as the installation for Stable Diffusion goes - but when I go to run I get two errors, one being the pip version. I upgraded via 'pip install --upgrade pip' and though the version updated, I'm still getting the below error.\nThe other issue is that pytorch doesn't seem to have installed. I've added it to the requirements.txt and run 'pip install -r requirements.txt' which doesn't seem to work either. I also downloaded 1.12.1+cu113 and ran pip install \"path\/\" and received the error \"ERROR: torch-1.12.1+cu113-cp39-cp39-win_amd64.whl is not a supported wheel on this platform.\"\nError received below:\nstderr: ERROR: Could not find a version that satisfies the requirement torch==1.12.1+cu113 (from versions: none)\nERROR: No matching distribution found for torch==1.12.1+cu113\nWARNING: You are using pip version 20.1.1; however, version 22.3 is available.\nYou should consider upgrading via the 'C:\\Users\\XXX\\Downloads\\STABLE\\stable-diffusion-webui\\venv\\Scripts\\python.exe -m pip install --upgrade pip' command.\nAny help would be greatly appreciated, I've tried my best to be self-sufficient so I'm putting it to the people who may know how to help.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":762,"Q_Id":74313444,"Users Score":0,"Answer":"Same problem with python 3.8. I install python3.10 and fixed.\nFor mac:\nbrew install python@3.10","Q_Score":0,"Tags":"python,pip,stable-diffusion","A_Id":75530853,"CreationDate":"2022-11-04T07:19:00.000","Title":"Attempting to install Stable Diffusion via Python","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":1,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"i want to know how to set default page when installing new module.\nLike example, My main module is about restaurant ERP, by it's default when i open my module the default page is Restaurant Overview and then i installed reporting sub module with Report Dashboard on it. How to set default page from Restaurant Overview to Report Dashboard when i open restaurant module ?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":27,"Q_Id":74329894,"Users Score":0,"Answer":"Odoo permits to set an initial action for every user.\nFrom Settings -> Users and Companies -> Users pick one user.\nMove to Preferences tab, and pick desired action in Initial page action field.\nRepeat this for every user.","Q_Score":0,"Tags":"python,xml,odoo,odoo-14","A_Id":74408614,"CreationDate":"2022-11-05T17:16:00.000","Title":"Set default page when installed new module","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am having a trouble with connecting MSSQL to python using Configparser, and one of DB's password has included a character '#'.\nSince we don't use escape character \" in INI file, then how should I use a character #? (byw, I can't change the password :( )","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":22,"Q_Id":74355867,"Users Score":0,"Answer":"The # character is used to start a comment in an INI file. Anything after the # on the same line is ignored by the INI parser.","Q_Score":2,"Tags":"python,sql-server,ini,configparser,pymssql","A_Id":74355887,"CreationDate":"2022-11-08T05:01:00.000","Title":"How to use '#' character in INI file?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"If I have a function that is quadratic complexity, i.e. the runtime is directly proportional to the square of the input size.  How would I identify its best or worse case runtime, specifically how do I determine if the best and worst case are the same?","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":54,"Q_Id":74356911,"Users Score":2,"Answer":"This really depends on your algorithm and your input data. For example\na search algorithm can have a typically runtime of O(x^2) but in certain situations this differs:\n\nTypically runtime is for statistically random data (normal case)\n\nIf the input data is already sorted (best case), then it depends on the algorithm if it still has normal runtime or is faster e.g. O(1)\n\nIf the input data is shaped explicitly in the worst order that there is possible for this specific algorithm (but not very likely), then it may have a bigger worst-case O-notation\n\n\nWhich algorithm you choose then depends on your use case:\n\nIf the data is most likely already sorted or partially sorted: You may go with an algorithm that has better best case runtime\nIf you want fastest results in most cases (with unsorted data): You go for best normal case\nIf your algorithm may kill someone if it takes to long (e.g. dealing with malicious user input): You will choose one which as equal normal\/worst case runtime","Q_Score":0,"Tags":"python,big-o,computer-science","A_Id":74357211,"CreationDate":"2022-11-08T07:14:00.000","Title":"Calculating best-case, worse-case Complexity","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Create a row that sums the rows that do not have a data in all the columns.\nI'm working on a project that keeps throwing dataframes like this:\n\n\n\n\n1\n2\n3\n4\n5\n\n\n\n\n\n108.864\n\nINTERCAMBIADORES DE\n1123.60      210.08     166.71     1333.68\n\n\n\n\n\nCALOR 8419500300\n\n\n\n\n147.420       5.000\nPZ\n1A0181810000\n81039.25       15149.52    19237.754880        96188.77\n\n\n\n147.420\n\nINTERCAMBIADORES DE\n3882.25      725.75     921.60     4608.00\n\n\n\n\n\nCALOR 8419500300\n\n\n\n\n566.093      12.000\nPZ\n1A0183660000\n66187.40       12374.29     6546.806709        78561.68\n\n\n\n566.093\n\nINTERCAMBIADORES DE\n3170.76      592.80     313.63     3763.56\n\n\n\n\n\nCALOR 8419500300\n\n\n\n\n3.645       1.000\nPZ\n1A0185890000\n836.64          159.69      996.330339          996.33\n\n\n\n3.645\n\nINTERCAMBIADORES DE\n40.08        7.65      47.73       47.73\n\n\n\n\n\nCALOR 8419500300\n\n\n\n\n131.998       3.000\nPZ\n1A0190390000\n32819.41        6135.17    12984.858315        38954.57\n\n\n\n131.998\n\nINTERCAMBIADORES DE\n1572.24      293.91     622.05     1866.15\n\n\n\n\n\nCALOR 8419500300\n\n\n\n\n123.833       3.000\nPZ\n1A0190790000\n54769.36       10238.84    21669.402087        65008.21\n\n\n\n123.833\n\nINTERCAMBIADORES DE\n2623.77      490.50    1038.09     3114.27\n\n\n\n\n\nCALOR 8419500300\n\n\n\n\n115.214       2.000\nPZ\n1A0195920000\n54642.66       10215.05    32428.851279        64857.70\n\n\n\n115.214\n\nINTERCAMBIADORES DE\n2617.70      489.36    1553.53     3107.06\n\n\n\n\nThis is going to insert a sql database, I don't know how to add the empty rows with the row that has all the information.\nNOTE: Spacing Empty cells is variable","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":19,"Q_Id":74367617,"Users Score":0,"Answer":"Question is unclear: please provide code you've tried, the error message you're getting, and expected output.","Q_Score":0,"Tags":"python,pandas,dataframe,data-science","A_Id":74370323,"CreationDate":"2022-11-08T21:58:00.000","Title":"Create a row that sums the rows that do not have a data in all the columns pandas","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"The case is really simple. I am using Anaconda and have registered it as the default Python. As it seems, Anaconda has some issues with confluent_kafka library, therefore I need to install and use Python alone for a specific case.\nI ran the installation (Python 3.10), added Python to path as well (so both Python are added to the path) but I don't have any clue on how to \"point\" and use the standalone Python explicitly in the desired case and Anaconda otherwise.\nI have searched for the answer but came up with proposed solution on for Linux.","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":46,"Q_Id":74374558,"Users Score":1,"Answer":"Since I cannot comment on other answers, here is how you could install packages for different python versions\nc:\/python3.10\/python.exe -m pip install package_name","Q_Score":0,"Tags":"python,anaconda","A_Id":74374882,"CreationDate":"2022-11-09T12:01:00.000","Title":"Choose between Anaconda Python and other Python installation when Anaconda is set as the default Python - Windows 10","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"The case is really simple. I am using Anaconda and have registered it as the default Python. As it seems, Anaconda has some issues with confluent_kafka library, therefore I need to install and use Python alone for a specific case.\nI ran the installation (Python 3.10), added Python to path as well (so both Python are added to the path) but I don't have any clue on how to \"point\" and use the standalone Python explicitly in the desired case and Anaconda otherwise.\nI have searched for the answer but came up with proposed solution on for Linux.","AnswerCount":2,"Available Count":2,"Score":0.0996679946,"is_accepted":false,"ViewCount":46,"Q_Id":74374558,"Users Score":1,"Answer":"Use the full path of the executable, like c:\/python3.10\/python script.py\nEDIT:\nIt can be located in another directory, check that with where python and adapt the first command","Q_Score":0,"Tags":"python,anaconda","A_Id":74374581,"CreationDate":"2022-11-09T12:01:00.000","Title":"Choose between Anaconda Python and other Python installation when Anaconda is set as the default Python - Windows 10","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I was learning how to make graphs with python pandas. But I couldn't understand how this code works.\nfig , ax = plt.subplots( ) ax = tips[['total_bill','tip']].plot.hist(alpha=0.5, bins=20, ax=ax)\nI couldn't understand why the code words only when there is fig infront of ax.\nAlso I have no idea what 'ax=ax' means.\nI found everywhere but I couldn't find the answer...","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":12,"Q_Id":74381751,"Users Score":0,"Answer":"Pandas is using the library matplotlib to do the plotting. Try to read up a bit about how matploltib works, it will help you understand this code a bit.\nGenerally, plotting with matplotlib involves a figure and one or more axes. A figure can be thought of as a frame where multiple plots can be created inside. Each plot consists of an axes object which contains your x- and y-axis and so on.\nWith the command plt.subplots(), you create in a single function a figure object and one or more axes objects. If you pass no parameters to the function, just a single axes object will get created that is placed on the figure object. The figure and axes are returned as a tuple by the function in the form of (figure, axes). You are unpacking that tuple with the first line into the variable fig and ax.\nThen, when you call the plotting function on your pandas data, you tell the function on which axes object to do the plotting. This is what the parameter ax means in that function. So you are telling the function to use your axes object that your variable ax is assigned to by setting the parameter ax to ax (ax = ax).\nDoing ax = tips[['total_bill','tip']].plot... is redundant. The plotting function returns the axes object on which the plotting was performed by pandas. However, you are just overwriting your already existing axes with the returned axes, which in this case are the same object. This would only be needed if you don't pass the ax parameter to the plotting function, in which case pandas would create a brandnew figure and axes object for you and return the axes object in case you want to do any further tweaks to it.","Q_Score":0,"Tags":"python,pandas,dataframe,graph,series","A_Id":74381853,"CreationDate":"2022-11-09T21:47:00.000","Title":"Why does python pandas need fix infront of ax to draw a graph?","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Take the first four characters of your surname - this is your dog name. Now, using the mapping suggested in Lecture 8 (slides 18 and 19), work out your collar number.\nFor example\n\"My dog name is LEVI and my collar number is 214873\"\nI want to know the method how it find.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":12,"Q_Id":74417677,"Users Score":0,"Answer":"There is not enough information to answer this. What is \"Lecture 8 slide 18 and 19\"? If you ask a question at least provide the full context. As is, nobody will be able to answer this for you.","Q_Score":0,"Tags":"python,azure-pipeline-python-script-task","A_Id":74417769,"CreationDate":"2022-11-13T00:53:00.000","Title":"How to find collar number in python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Thanks to everyone reading this.\nI'm a beginner to pytorch. I now have a .pt file and I wanna print the parameter's shape of this module. As I can see, it's a MLP model and the size of input layer is 168, hidden layer is 32 and output layer is 12.\nI tried torch.load() but it returned a dict and I don't know how to deal with it. Also, I wanna print the weight of input layer to hidden layer(that maybe a 168*32 matrix) but I don't know how to do that. Thanks for helping me!","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":20,"Q_Id":74442412,"Users Score":0,"Answer":"The state dictionary of does not contain any information about the structure of forward logic of its corresponding nn.Module. Without prior knowledge about it's content, you can't get which key of the dict contains the first layer of the module... it's possibly the first one but this method is rather limited if you want to beyond just the first layer. You can inspect the content of the nn.Module but you won't be able to extract much more from it, without having the actual nn.Module class at your disposal.","Q_Score":0,"Tags":"python,pytorch","A_Id":74442695,"CreationDate":"2022-11-15T08:14:00.000","Title":"How to print the model's parameters'shape and print the parameters while loading a .pt file?","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am trying to trigger an Azure Function from Logic Apps. Running the Azure function takes more than 2 minutes as it is reading a file from a location, converts it to another format and then writes it to a different location. The problem is that the Logic Apps is creating a request, waits for 2 minutes to get a response, but this response doesn't come because the function is not finishing that fast. So the logic app assumes there is an error and recreates the request.\nI read in the documentation that there is no way to increase the timeout period. I tried creating two threads in the azure function. One returns 202 http status code to the logic app, and the other one would remain as a daemon and keeps running. But the file doesn't seem to be copied.\nDoes anyone have any idea how could this be achieved?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":101,"Q_Id":74446349,"Users Score":0,"Answer":"Continue the work on another logic app.\nJust change your logic app to return Accepted\/OK response and calls the function.\nThe function does the work and after it finishes (or fails) it calls another logic app where it continues the work (or deal with the error).","Q_Score":0,"Tags":"python,azure-functions,azure-logic-apps","A_Id":74476921,"CreationDate":"2022-11-15T13:20:00.000","Title":"Triggering an Azure Function that takes more than 2 minutes to run from logic apps","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"On hovering the mouse pointer over a function, whether inbuilt or custom, the definition and docstring of the function shows as expected, however it shows twice.  I have had a search for what might be causing this and looked around my settings, but have yet to find a reason for it.  If it makes a difference, am using Python on VSCode.\nPerhaps someone knows what might be causing this and how to resolve?  I have not attached any images, since I think the issue is quite clear, but happy to provide if needed for clarification.\nThanks!","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":122,"Q_Id":74449835,"Users Score":0,"Answer":"Not sure still what caused the issue, but disabling and then re-enabling the Pylance extension has solved this.  Thanks.","Q_Score":2,"Tags":"python-3.x,visual-studio-code,docstring","A_Id":74453193,"CreationDate":"2022-11-15T17:25:00.000","Title":"Why does the function definition and doctring show twice when I hover over the function in VS Code? How to resolve to showing once?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm using the RSA encryption\/decryption system, and I have the modulus n (which is a 2048 bit number) and I need to find p and q, which satisfy n = p*q and both are prime numbers. The clue that is given to me is that p is equal to q but with its bits inverted as I say in the title of this post (concretely r and s have the same bits so we could say that p and q have their halves inverted). I don't find the way to take advantage of this so I would be very grateful if someone could help me\nI have tried to traverse the number n to find the number p that satisfies that p * p_halfs_inverted = n but logically n is too huge and it is not viable to do it in this way.","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":147,"Q_Id":74451247,"Users Score":1,"Answer":"OK here's how you can solve this problem.\nStart by representing p and q in terms of two k-bit numbers r and s as follows (for your example, k=512):\n\np = 2kr + s\nq = 2ks + r\n\nThe value of n is the product of these two numbers:\n\nn \u00a0 = \u00a0 pq \u00a0 = \u00a0 (2kr + s)(2ks + r) \u00a0 = \u00a0 22krs + 2k(r2 + s2) + rs\n\nThe first two terms on the right are both multiples of 2k, so the k lowest bits of n are exactly equal to the k lowest bits of rs. Furthermore, since rs is typically a 2k-bit number and r2 + s2 is typically a (2k+1)-bit number, the k highest bits of n are also mostly equal to the k highest bits of rs, but perhaps slightly larger due to the carry generated when adding the 2k(r2 + s2) term.\nIf n\u25c1 and n\u25b7 are numbers representing the top k bits and bottom k bits of n, then we can generate a candidate value for rs by calculating 2kn\u25c1\u00a0+\u00a0n\u25b7. If this value is correct, we can subtract (22k + 1)rs from n to obtain the value of 2k(r2 + s2). Divide this result by 2k and add 2rs to obtain r2 + 2rs + s2, then calculate the square root of this value to obtain the value of r + s. (If the number isn't a perfect square, then you need to subtract 1 from n\u25c1 and try again.\nAfter at most two iterations of this process, you will have the exact values of rs and r+s. You should then have no difficulty solving a simultaneous equation to obtain values for r and s, from which you can find p and q.\nNote: You might find the sympy.sqrt() function useful for calculating square roots of large numbers. It returns objects with an is_integer attribute that will tell you if the number you provided was a perfect square.","Q_Score":0,"Tags":"python,encryption,cryptography,rsa,factors","A_Id":74477798,"CreationDate":"2022-11-15T19:37:00.000","Title":"Having n (2048 bit number), how can I find two numbers p and q that satisfy n = p*q, where p = r||s (r and s concatenated) and q = s||r?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have an emergency door that individuals should only be exiting from, so I'm trying to think of ways to use computer vision with python to identify if someone entered through it. I've found posted discussing tracking individuals and object detection, but I can't find anything on entering or exiting a door. Any suggestions\/guidance would be greatly appreciated.","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":24,"Q_Id":74454625,"Users Score":1,"Answer":"It can be done in different ways. I'll give you few suggestions and you pick up as per your need\n\nFix the camera in a way like only those people, who exit the room will be recorded\nIf you want to save and record those data , you can have ID card detection with matching face\n\nIf you explain it some more deep I'll suggest some other ways","Q_Score":0,"Tags":"python,deep-learning,computer-vision","A_Id":74454684,"CreationDate":"2022-11-16T02:58:00.000","Title":"Python identify if someone entered a door from a video feed","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I would like to create a CNN model in Python and I have organized my data in such a way that I have 100 csv files with different sizes (all of them have 141 colunms but some have 33 rows and others have 70 rows). All of those files can be categorized in 6 different categories. All the examples that I have seen so far for buiding a CNN model are using either just one dataset in pandas or using several images of the same size. So the question would be, Can I use my data for creating a CNN model in this fashion? If yes, Can anyone give me some tricks or\/and tips of how to?\nThanks a lot in advance!\nI have seen some Tensorflow or PyTorch examples but I dont know how to use them with my data","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":64,"Q_Id":74457562,"Users Score":0,"Answer":"It depends on the reason that the data are separated in different files in the first place and what you want to achieve.\nIf each file contains observations for a different entity AND you want to predict observations about EACH specific known entity, you can build a model for each entity. In this case, the entities with more training data will of course have better results.\nStill, if the difference between those entities can be described with numerical values, depending on the exact problem, you can also try adding those to the training data and then concatenating everything. In this case, the added features will make the final classification to better classify the observations of each different entity without building 100 models. Note however that this could work only if the \"qualities\" of the entities actually affect the observations in some degree, otherwise (if the observations are randomly distributed amongst the entities) the results will probably be worse.\nIf however the observations of different entities are needed to train a model that works for any entity (including unknown ones), the data can be concatenated to a single table (pandas DataFrames were mentioned in the question) and then train your model with this combined dataset.","Q_Score":1,"Tags":"python,tensorflow,pytorch,conv-neural-network","A_Id":74492920,"CreationDate":"2022-11-16T08:50:00.000","Title":"Using several csv files of different sizes to build a CNN model in Python","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Would anybody know how to change the version I use in Py-Script? Currently my Py-Script is using python 3.10, but I would like to be able to use python 3.6.\nI had python 3.10 and 3.6 installed, so i tried removing 3.10, but that didn't work, as I also expected, but other than that, I have no clue how to and have had no luck finding any information on the topic online.\nI'm quite new to programming, so any help would be greatly appreciated!","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":30,"Q_Id":74463760,"Users Score":2,"Answer":"You cannot easily change the Python version. Python is included with Pyodide which PyScript loads. Changing the version would require rebuilding Pyodide.\nNote: I am not sure if it would be possible to use vanilla Python 3.6 with the current version of Pyodide.\nImprove your code to work with Pyodide's bundled version of Python.","Q_Score":0,"Tags":"python,pyscript","A_Id":74470036,"CreationDate":"2022-11-16T16:09:00.000","Title":"Using older version of python with Py-Script","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":1,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":1,"DOCUMENTATION":1,"ERRORS":0,"REVIEW":0},{"Question":"I have been doing a lot of search engine search for past 7 days on how to do FFI with python but most examples are on using C or Rust and one example on using go lang but I do not see anyone going with Python but it is widely used one.\nCan we use Python code to run via PHP FFI to process any data?\nIf yes, can you show a sample example of the same as I do not see a reference of it or presence of it only, this will be helpful of whoever else is searching on it.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":153,"Q_Id":74496877,"Users Score":0,"Answer":"FFI enables you to run code from a shared library. As far as I know, you are not able to compile python code as a shared library, so no, you cannot use PHP FFI to run python scripts.","Q_Score":2,"Tags":"python,php,ffi,php-ffi","A_Id":76496859,"CreationDate":"2022-11-19T01:19:00.000","Title":"Can we use PHP FFI to run python scripts?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have a django project, that works similar to Jupyter Notebook, in terms of Being a program launched offline in localhost on a web browser, moreover my webapp has an opencv webcam pop-up, that will be launched when you press a button.\nI want to deploy my django project, so it can be launched by just clicking a file in Windows.\nAccording to what I read, There are two possible solutions:\n\nInstall Python Interpreter with Dependencies on client computer first, and using a bat file, to launch the django server.\nContainerizing the Django project with Python and its dependencies, either using Docker or perhaps an exe file?\n\nWhich solution is better? I would prefer the second one personally, but I\u2019m confused how to do so.\nCan it be done as simple as using pyinstaller or not?\nHere are my dependencies for reference:\nDjango\npillow\ndjango-object-actions\ndjango_user_agents\ndjango-cleanup\nopencv-python\nimutils\ncmake\ndlib\nface-recognition","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":91,"Q_Id":74499789,"Users Score":1,"Answer":"I think that the best practise would be to use containers like e.g. docker. After that you have the following benefits:\n\nDependencies inside the container machine (automatically with pip install from requirements file)\nMultiplatform possibility\nVersioning with tags\nYou can run database in a second container if needed (combined with docker compose)\nClick and run with docker desktop\n\nfyi: There a lots of tutorials on how to deploy django in docker containers :)","Q_Score":1,"Tags":"python,django,batch-file,pyinstaller,executable","A_Id":74500471,"CreationDate":"2022-11-19T11:58:00.000","Title":"Deploy Django Project Using Pyinstaller","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm new in programming, actually I use it for Machine Learning.\nI have installed python and anaconda (I don't know if that is right, or I have to install only anaconda?).\nAnd I can see in start menu: (Anaconda powershell, Jupyter, Spyder, Anaconda navigator, Anaconda prompt).\nSo my question is: Do I still have to use vscode as IDE, or one of the listed programs that come with anaconda? If the answer is the second choice, I will ask, which one of them?\nThanks.\nI'm using python just because I have a project in ML, So I must to set the necessary things for ML, like libraries, dataset, and algorithms. Then I have to learn how to use them.\nAny help will be very apprecheated.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":31,"Q_Id":74503272,"Users Score":0,"Answer":"If I were you I would use vcscode. Anaconda is only a python with extra features, but to code you would appreciate the VSCOde. It comes with many features and you can install extensions to burst your experience. Go for it.","Q_Score":0,"Tags":"python,machine-learning,anaconda,dataset","A_Id":74503718,"CreationDate":"2022-11-19T20:03:00.000","Title":"If I install anaconda, do I still have to use vscode?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I need to add different types of files (CSV, XML, xlsx, etc.) to the database (Postgresql). I know how I can read it via pandas, but I have some issues with adding this to the database.\nWhat libraries do I need to use? And does it need to convert them into one format?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":39,"Q_Id":74515976,"Users Score":1,"Answer":"Read files with pandas:\ncsv_df = pd.read_csv('file.csv')\nxml_df = pd.read_xml('file.xml')\nxlsx_df = pd.read_excel('file.xlsx')\n\nAdd tables in db with columns like in your file\n\nAdd files to db\nxlsx_df.to_sql('table_name', engine, if_exists='replace', index=False)","Q_Score":1,"Tags":"python,xml,postgresql,csv,xlsx","A_Id":74569708,"CreationDate":"2022-11-21T08:21:00.000","Title":"How to add different type of files in postgresql on Python","Data Science and Machine Learning":0,"Database and SQL":1,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Good evening, I'm trying to do some tests with selenium in Firefox, but I'm stuck, I can not click on a button, because I got the message accepting cookies and that does not allow me to continue with the test, I do not know how to make selenium accept cookies.\nThis is the message it gave me:\nAn exception occurred: ElementClickInterceptedException Message: Element <select id=\"tramiteGrupo[1]\" class=\"mf-input__l\" name=\"tramiteGrupo[1]\"> is not clickable at point (470,571) because another element <a class=\"small cli-plugin-button cli-plugin-main-button\" href=\"#\"> obscures it\nI want to get selenium to accept cookies and be able to continue entering parameters.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":27,"Q_Id":74526008,"Users Score":0,"Answer":"Get Selenium to pause(check docs on how to pause, something like Thread.sleep(2000);) for a minute just before it clicks the \"Accept cookies\" button and try click the button yourself when it's paused. So you will be able to see what element is blocking it.\nThen use \"page scroll up\"\/\"page scroll down\"\/x\/y\/whatever to move it so it will not be blocked when trying to click the button.","Q_Score":0,"Tags":"python,selenium,geckodriver","A_Id":74526088,"CreationDate":"2022-11-21T23:44:00.000","Title":"Please Help me with selenium on Firefox","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have used widely used packages(installed via pip) for a while in Jupyter notebook without any issues. I tried to do Python coding in VScode,but it somehow cannot load those packages.\nI have tried changing python interpreter, but it did solve the issue. Does anyone know how to resolve this issue?","AnswerCount":2,"Available Count":1,"Score":-0.0996679946,"is_accepted":false,"ViewCount":35,"Q_Id":74541851,"Users Score":-1,"Answer":"Hi you can use terminal for installation.\notherwise you can anaconda iDE its very good tool and user friendly.","Q_Score":0,"Tags":"python,visual-studio-code,package","A_Id":74541905,"CreationDate":"2022-11-23T04:37:00.000","Title":"Unable to import numpy\/pandas\/matplotlib packages in VScode","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm trying to develop a code that open an image where you can select a point quit the mouse and drag to form a rectangle until you don't release the left button.\nThen from python I should receive the starting coordinates and the height and width in pixel of the rectangle, how can I do it?\nI saw that the packages argparse and cv2 can be used, but I don't really know how to approach it.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":19,"Q_Id":74549601,"Users Score":0,"Answer":"I won't do the job for you but I'm willing to help.\nYou will need 2 blocks of code:\n\nan image displayer\na mouse-event listener\n\nTo start, you may forget about the image displayer. You may concentrate on the mouse listener while you draw your rectangle anywhere on the screen.\nSelect a mouse listener library. There are many on pypi.org.\nI propose pynput because it is easy to work with and is well documented.\n\nread documentation (focus on \"on_click\")\nwrite your code to implement your mouse listener. It's simple (less than 10 lines). At the end of your program, add a statement:\ninput(\">\")\nrun your program. Click anywhere on the screen and drag to another point. Release.\nyour on_click() function will be called twice (once for button press and once for button release). Record the two sets of X-Y coordinates (unit is pixels).\nonce the button is released, compute the size of the rectangle (in pixels).\npress any key on the keyboard to end the program.\n\nOnce your program is working you may work on the imager. If the image is large, you may have to use a scaling factor to reduce it. You will have to introduce the scaling factor in your sizing equations.\nWhen a program skeleton will exist, do not hesitate to ask questions.\nAsking for help when there is no visible sweat will not bring you  many answers.","Q_Score":0,"Tags":"python","A_Id":74551986,"CreationDate":"2022-11-23T15:51:00.000","Title":"Draw a Rectangle over an image and get the coordinates in python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have a directory full of other directories with thousands of text files and I don't know how to parse every file to look for matches. Is there any way in python?\nI tried the read file module but I have to specify a directory and I don't know how to open every file, not only the ones I specified.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":25,"Q_Id":74549827,"Users Score":0,"Answer":"If you have a character that separates each directory, you can use that to split the text.\nSearch about the split function in Python.\n' txt.split('') '\nIf you put the text it's more easy to explain.","Q_Score":0,"Tags":"python,directory,txt","A_Id":74549891,"CreationDate":"2022-11-23T16:05:00.000","Title":"Is there any way in python to parse files in a directory full of directories full of text files to find for a match?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have two data frames that I want to merge on a same column name but the values can have different variations of a values.\nExamples. Variations of a value :\n\n\n\n\nVariations\n\n\n\n\nUSA\n\n\nUS\n\n\nUnited States\n\n\nUnited States of America\n\n\nThe United States of America\n\n\n\n\nAnd let's suppose the data frames as below:\ndf1 =\n\n\n\n\ncountry\ncolumn B\n\n\n\n\nIndia\nCell 2\n\n\nChina\nCell 4\n\n\nUnited States\nCell 2\n\n\nUK\nCell 4\n\n\n\n\ndf2 =\n\n\n\n\nCountry\nclm\n\n\n\n\nUSA\nval1\n\n\nCH\nval2\n\n\nIN\nval3\n\n\n\n\nNow how do I merge such that the United States is merged with USA?\nI have tried DataFrame merge but it merges only on the matched values of the column name.\nIs there a way to match the variations and merge the dataframes?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":34,"Q_Id":74555443,"Users Score":0,"Answer":"Use .count to count how many times United States is stated in the list and then make an if command to see if united stated is listed more than once in the list. Do it to all of the other options and make a final if command to check if either any of them are in the list to output the value that you want.","Q_Score":0,"Tags":"python,pandas,dataframe","A_Id":74556675,"CreationDate":"2022-11-24T03:52:00.000","Title":"How to merge two dataframes with different variations of a column values?","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have 2 windows, first is the main window (window1) and another window with opencv (window2). I have a button on window1 that opens window2. Whenever I open window2 on window1 the camera won't show on the GUI. But if I open window2 individually which is on a different file, the camera is showing.\nI tried to put it on a single python file, and it still doesn't work, the camera is still not showing.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":44,"Q_Id":74573165,"Users Score":0,"Answer":"I found the answer.\nI fixed it by removing the main loop on window2 since camera window2 also runs in tkinter.","Q_Score":0,"Tags":"python,tkinter,camera,window","A_Id":74587578,"CreationDate":"2022-11-25T12:56:00.000","Title":"python - Opening another tkinter window with opencv camera don't show live feed","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have a data file that I'm cleaning, and the source uses '--' to indicate missing data.\nI ultimately need to have this data field be either an integer or float.  But I am not sure how to remove the string.\nI specified the types in a type_dict statement before importing the csv file.\n6 of my 8 variables correctly came in as an integer or float.  Of course, the two that are still objects are the ones I need to fix.\nI've tried using the df = df.var.str.replace('--', '')\nI've tried using the df.var.fillna(df.var.mode().values[0], inplace=True)\n(and I wonder if I need to just change the values '0' to '--')\nMy presumption is that if I can empty those cells in some fashion, I can define the variable as an int\/float.\nI'm sure I'm missing something really simple, have walked away and come back, but am just not figuring it out.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":43,"Q_Id":74578696,"Users Score":0,"Answer":"OK, we figured out two options to make this work:\nsolution 1:\ndf = df.replace(r'^--$', np.nan, regex=True)\nsolution 2 (a simplified version of #1):\ndf = df.replace(r'--', np.nan)\nBoth gave the expected output of empty cells when I exported the csv into a spreadsheet.  And then when I reimported that intermediate file, I had floats instead of strings as expected.","Q_Score":1,"Tags":"python,pandas,replace,nan,dtype","A_Id":74579480,"CreationDate":"2022-11-25T23:47:00.000","Title":"Replacing a string with NaN or 0","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have a DynamoDB with hashes as UserIDs and set as partition key.\nI want to know whether an Item exists in the table or not.\nI gonna pass an array of User-Hashes. Each Hash in this array should be checked whether it exists or not.\nI already found a solution with GetItem. But that would mean, that i have to loop over all the User-Hashes in the array, right?\nDoes anybody has a solution how to do this without looping? Looping takes too much of the performance.","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":25,"Q_Id":74629090,"Users Score":2,"Answer":"There is no shortcut here. You could do parallel (multi-threaded client) calls to reduce the overall latency.","Q_Score":0,"Tags":"python-3.x,amazon-web-services,for-loop,amazon-dynamodb","A_Id":74661425,"CreationDate":"2022-11-30T14:04:00.000","Title":"Checking if an array of items exist in a DynamoDB Python without looping","Data Science and Machine Learning":0,"Database and SQL":1,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":1},{"Question":"I'm deploying django app to pythonanywhere where i used APScheduler for automatically send expire mail whenever subscription end date exceed.\nI don't know how to enable threads, so that my web app runs perfectly on pythonanywhere.","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":64,"Q_Id":74651948,"Users Score":1,"Answer":"On hosting platforms like PythonAnywhere, there might be multiple copies of your site running at different times, in order to serve the traffic that you get.  So you should not use an in-process scheduler to perform periodic tasks; instead, you should use the platform's built-in scheduled tasks function.","Q_Score":0,"Tags":"django,django-rest-framework,deployment,pythonanywhere","A_Id":74655227,"CreationDate":"2022-12-02T07:00:00.000","Title":"The scheduler seems to be running under uWSGI, but threads have disabled.You must run uWSGI with the --enable-threads option for the scheduler to work","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm restricted to a PostgreSQL as 'model storage' for the models itself or respective components (coefficients, ..). Obviously, PostgreSQL is far from being a fully-fledged model storage, so I can't rule out that I have to implement the whole model training process in Java [...].\nI couldn't find a solution that involves a PostgreSQL database as intermediate storage for the models. Writing files directly to the disk\/other storages isn't really an option for me. I considered calling Python code from within the Java application but I don't know whether this would be an efficient solution for subsequent inference tasks and beyond [...]. Are there ways to serialize PMML or other formats that can be loaded via Java implementations of the algorithms? Or ways to use the model definitions\/parameters directly for reproducing the model [...]?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":109,"Q_Id":74656521,"Users Score":0,"Answer":"Using PostgreSQL as dummy model storage:\n\nTrain a model in Python.\nEstablish PostgreSQL connection, dump your model in Pickle data format to the \"models\" table. Obviously, the data type of the main column should be BLOB.\nAnytime you want to use the model for some application, unpickle it from the \"models\" table.\n\nThe \"models\" table may have extra columns for storing the model in alternative data formats such as PMML. Assuming you've used correct Python-to-PMML conversion tools, you can assume that the Pickle representation and the PMML representation of the same model will be functionally identical (ie. making the same prediction when given the same input). Using PMML in Java\/JVM applications is easy.","Q_Score":0,"Tags":"python,java,machine-learning,xgboost,lightgbm","A_Id":74659868,"CreationDate":"2022-12-02T13:28:00.000","Title":"How to save XGBoost\/LightGBM model to PostgreSQL database in Python for subsequent inference in Java?","Data Science and Machine Learning":0,"Database and SQL":1,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have two series of stock prices (containing date, ticker, open, high, low, close) and I'd like to know how to combine them to create a dataframe just like the way Yahoo!Finance does. Is it possible?\n\"Join and merge\" don't seem to work","AnswerCount":1,"Available Count":1,"Score":0.537049567,"is_accepted":false,"ViewCount":29,"Q_Id":74659398,"Users Score":3,"Answer":"Use pd.concat([sr1, sr2], axis=1) if neither one of join and merge work.","Q_Score":0,"Tags":"python,pandas,dataframe,yahoo-finance,yahoo-api","A_Id":74659488,"CreationDate":"2022-12-02T17:27:00.000","Title":"Combining series to create a dataframe","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"When running ipynbs in VS Code, I've started noticing Pylance warnings on standard library imports. I am using a conda virtual environment, and I believe the warning is related to that. An example using the glob library reads:\n \"env\\Lib\\glob.py\" is overriding the stdlib \"glob\" modulePylance(reportShadowedImports)\nSo far my notebooks run as expected, but I am curious if this warning is indicative of poor layout or is just stating the obvious more of an \"FYI you are not using the base install of python\".\nI have turned off linting and the problem stills persists. And almost nothing returns from my searches of the error \"reportShadowedImports\".","AnswerCount":1,"Available Count":1,"Score":0.537049567,"is_accepted":false,"ViewCount":2660,"Q_Id":74660176,"Users Score":3,"Answer":"For anyone that still has this problem, if your file name has the same name as a stdlib python module, for example your filename is \"datetime\", it's gonna have this problem, try avoiding naming files the same names as the stdlib python modules.","Q_Score":4,"Tags":"python,visual-studio,conda,pylance","A_Id":75850148,"CreationDate":"2022-12-02T18:40:00.000","Title":"Using VisualStudio+ Python -- how to handle \"overriding stdlib module\" Pylance(reportShadowedImports) warning?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"When trying to make an animation in Ursina Engine you can call a frameanimation3d function but it requires an obj file for each frame.\nSo if there are 100 .obj files to load, the game will be slower. Is there maybe a way to load all these files faster?\n( Or maybe use panda3d actor function, but doesn't it support a certain type of file? )","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":44,"Q_Id":74671926,"Users Score":0,"Answer":"It is true, you can load animations faster with panda3d or ursina. If you are using panda3d, use their .egg file. You can improve performance by instancing and using LoD. Check the examples in Panda's Manual. Don't forget, ursina is built above panda3d, so you can use Panda's code in ursina.\nP.S.: I'm not sure if Panda's actor supports LoD.\nI wrote this in case if you are using the same model","Q_Score":1,"Tags":"python-3.x,animation,panda3d,ursina","A_Id":74782573,"CreationDate":"2022-12-04T00:21:00.000","Title":"Does anybody know how to load the frameanimation3d in ursina faster?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am working on an application similar to a quiz model. My requirement is,\n\nThe web socket server should be able to send time updates - say each question has 30 sec time, i need a scheduled job which will send 30,29,28.....0 to the web socket client.\nOnce the time is up, i need one more functionality to send the next question to the web socket client(i.e., it should be 30 sec interval job).\n\nNote: I am usign AsyncWebSocketConsumer as my base consumer.\nCan anyone help me with good design on how i can implement this functionality and some code snippets\/tutorials in doing so?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":35,"Q_Id":74689713,"Users Score":0,"Answer":"I think the count should be done on the quizz page, and one finished the answer is sent to the server.\nOn the server you can also control that the question has been answer in 30s.","Q_Score":0,"Tags":"python,websocket,redis,django-channels","A_Id":74689775,"CreationDate":"2022-12-05T14:25:00.000","Title":"Django-Channels: Schedule jobs","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"For example, the following list has x number of items each (2 in the one below, item1 and item2 in each sublist).\nalist = [[1,2],[4,1],[3,2]...]\n...\nI want to get the average of item1 and the average of item2 throughout all sublists.\nOutput should be something like: [('item1', item1's avg), ('item2', item2's avg), \u2026 ]\nI'm having trouble finding out how I can do this with 2 unknowns, the number of items, and the number of sublists. Is there a pythonic way to do this?","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":33,"Q_Id":74710231,"Users Score":1,"Answer":"averages = [sum(sublist)\/len(sublist) for sublist in alist]","Q_Score":0,"Tags":"python,list,list-comprehension","A_Id":74710275,"CreationDate":"2022-12-06T23:36:00.000","Title":"How can I perform this calculation on each [nth] item and append it to a list of lists in python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I recently installed a newer version of python version 3.10.8. I still have the old version running version 3.9.9.\nI would like to install pandas on the new python installation using pip install pandas command. I don't know how to specify in the terminal so that it installs on the python 3.10.8 version installation.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":62,"Q_Id":74717493,"Users Score":0,"Answer":"The comments above were useful. I will explain how i resolved it in case someone else has a similar issue.\nThere was no installation folder for the python 3.10.8 in the programs folder, i want to believe it was because of the installed 3.9.9 version which had a folder Python39 in the default installation location.\nSo I uninstalled and reinstalled the newer version (3.10.8) to a custom location\/folder. I opened the Python\\Scripts folder of the new installation in the command line. I was able to install pandas with\npip install pandas","Q_Score":0,"Tags":"python,pandas","A_Id":74718195,"CreationDate":"2022-12-07T13:32:00.000","Title":"Install pandas on different python versions on same computer(Windows 10)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":1,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"By using python I need to know how to find a substring in a text file.\nI tried using in and not in function in python to find a substring from a text file but i am not clear about it","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":16,"Q_Id":74720554,"Users Score":0,"Answer":"Finding the index of the string in the text file using readline() In this method, we are using the readline() function, and checking with the find() function, this method returns -1 if the value is not found and if found it returns 0.","Q_Score":0,"Tags":"python,list","A_Id":74720570,"CreationDate":"2022-12-07T17:20:00.000","Title":"How to find a substring in a text file using python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"By using python I need to know how to find a substring in a text file.\nI tried using in and not in function in python to find a substring from a text file but i am not clear about it","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":16,"Q_Id":74720554,"Users Score":0,"Answer":"finding the index of the string in the text file using readline()In this method,we are using the readline()function,and checking with the find()function,this method returns-1 if the values is not found and if found it returns o","Q_Score":0,"Tags":"python,list","A_Id":74720646,"CreationDate":"2022-12-07T17:20:00.000","Title":"How to find a substring in a text file using python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have an embedded linux system that I need to run a python script whenever it boots. The python script needs to have a terminal interface so the user can interact and see outputs. The script also spawns another process to transfer large amounts of data over SPI, this was written in C.\nI've managed to get the script to start on launch and have terminal access by adding\n@reboot \/usr\/bin\/screen -d -m python3 \/scripts\/my_script.py\nto the crontab. I can then do \"screen -r\" and interact with the script. However if launched in this way the script fails to start the external SPI script. In python I launch the script with subprocess.Popen\nproc=subprocess.Popen([\".\/spi_newpins,\"-o\",\"\/media\/SD\/\"+ latest_file\"])\nand this works perfectly whenever I manually launch the script, even within screen. Just not when it is launched by crontab. Does anyone have any ideas on how to get the spi subprocess to also work from crontab?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":20,"Q_Id":74731780,"Users Score":0,"Answer":"Fixed now, I had to add an absolute path to the spi_newpins function call\nproc=subprocess.Popen([\"\/scripts\/.\/spi_newpins\",\"-o\",\"\/media\/SD\/\"+ latest_file\"])","Q_Score":0,"Tags":"python,cron,embedded-linux","A_Id":74733159,"CreationDate":"2022-12-08T14:26:00.000","Title":"Embedded linux start python from crontab with terminal access and subprocess permissions","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"admin SDK. I want to know how to set the Channel Id on the Notification? I saw in Legacy Http Server Protocol has a parameter \"android_channel_id\", but in the SDK, Notification, or Android_Config, I don't see the way to set the channel id. Please help","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":31,"Q_Id":74738190,"Users Score":0,"Answer":"I found that I have to use AndroidConfig and AndroidNotification Objects to construct the message. On the Android Notification Object that is an attribute channel_id to set the channel info.","Q_Score":0,"Tags":"python,firebase-admin","A_Id":74786860,"CreationDate":"2022-12-09T01:58:00.000","Title":"Firebase-admin Python SDK Notification with Channel ID","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I wish to call http api to change password in roundcube mail client using python code. How can this be done? Where is the exact location in the roundcube configuration and how is it invoked?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":31,"Q_Id":74742104,"Users Score":0,"Answer":"Ensure the httpapi is available in your install\n\nIn the main roundcube configuration file config.inc.php set the variables:\n$config['password_httpapi_url']         =\n'http:\/\/host:5000\/change_user_password'; \/\/ required\n$config['password_httpapi_method']      = 'GET'; \/\/ default\n$config['password_httpapi_var_user']    = 'username'; \/\/ optional\n$config['password_httpapi_var_curpass'] = 'curpass'; \/\/ optional\n$config['password_httpapi_var_newpass'] = 'newpass'; \/\/ optional\n\n\nImportant NOTE: If you use the GET method you can pass the variables as parameters using  query string values eg. the request.args.get('username')\nIf you use the POST method you need to use the form fields. eg. request.form['username']\n\nPass the http api driver name in plugins\/password\/config.inc.php:\n$config['password_driver'] = 'httpapi';\n\nReload the web server.","Q_Score":0,"Tags":"python,api,http,roundcube","A_Id":74811605,"CreationDate":"2022-12-09T10:52:00.000","Title":"how to call http api in roundcube mail client to change password?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm using the BeautifulSoup module in Python 3.10 to get HTML data off a web page.\nThe way this web page is structured, there's a bunch of <h1> tags which section the web page. Some of these will look like <h1 class=\"title\"><img attributes\/> Text<\/h1>, and some will lack the img element but are otherwise identical.\nSuppose I start with a string called name and a BeautifulSoup object called soup. This BeautifulSoup object contains several <h1> tags as described above, each of which is followed by more HTML code. Suppose further that no two <h1> elements contain identical text.\nI'd like to compile a function which does the following:\n\nSearches the BeautifulSoup object for a <h1> element which contains a string that, excluding the <img> content, exactly matches the input string name.\nIf it's not the last <h1> tag in the BeautifulSoup object, return everything from that <h1> tag until the next <h1> tag. The latter tag shouldn't be included in the return, but the former tag can be optionally included or excluded. If it is the last <h1> tag, return everything from that tag to the end of the object.\n\nI'm only just learning BeautifulSoup. I know how to use .find() or .find_all() to track down which <h1> tag matches, but I don't know how to return all the following blocks as well.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":22,"Q_Id":74745976,"Users Score":0,"Answer":"Actually, when you crawl data using BeautifulSoup. All HTML tags will be written down. Just use a loop to find that checks for your image's existence or not.","Q_Score":0,"Tags":"python,beautifulsoup","A_Id":74746022,"CreationDate":"2022-12-09T16:45:00.000","Title":"BeautifulSoup in Python: Get series of tags where first exactly matches input","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"So here's my situation:\nI am working on chess software and to make it work I had to change one line of MIT-licensed library which I am using in my project. Modified library is in my virtual environment which is not included in my GitHub repository because I've read that is a bad practice to include venv into GitHub repo. Someday I'd like to share with my project to the chess world and I don't know how to handle this modified library. Normally without any changes I'd just include requirements.txt so a user could simply install it with pip. But here I can't do that because it'd download a library without necessary change. I have some ideas how to handle that but none of them seems optimal. Thanks in advance for any help!\nPS. I know it's not strictly programming related question but honestly I don't know a better place to ask it.","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":40,"Q_Id":74753150,"Users Score":1,"Answer":"You can just fork the library and point your requirements.txt to e.g. git+https:\/\/github.com\/yourusername\/librarything.git@yourbranch for the time being.\n(Via my comment.)","Q_Score":0,"Tags":"python,github","A_Id":74760982,"CreationDate":"2022-12-10T13:03:00.000","Title":"How to properly share modified MIT library on GitHub?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Recently, I was working on my HTML project and I wanted to add some functionality and I had already written code for that in Python. But, I faced a problem I couldn't add that Python code to my HTML code.\nSo, I wanted to know that how I can add my Python code to my HTML code.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":35,"Q_Id":74754499,"Users Score":0,"Answer":"you can use PyScript it is a new framework and It uses python in HTML code to develop apps.","Q_Score":0,"Tags":"python,html,python-3.x","A_Id":74754544,"CreationDate":"2022-12-10T16:05:00.000","Title":"How do I add Python in HTML?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"In several Lambda functions and Elastic Beanstalk instances for a project, they all use the same helper functions and constants.\nI am trying to follow the DRY method and not hard code these parameters into each Lambda\/EB application, but instead have the modules that contain them just import into each Lambda\/EB application.\nI was ideally hoping to\n\nput all these modules in a separate GitHub repo\ncreate a codepipeline to an S3 bucket\nimport them into EB\/Lambdas wherever needed\n\nI have the first 2 steps done, but can't figure out how to import the modules from S3.\nDoes anyone have any suggestions on how to do this?","AnswerCount":4,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":159,"Q_Id":74755148,"Users Score":2,"Answer":"The best way to track changes in code is using a repo but if you need to use an s3 as a repo you can consider enabling versioning in the s3 bucket\/repo and define some s3 event source to trigger your pipeline.\nFor using those dependencies I think it's best to consider using layer for lambda functions or shared EFS volumes in instances for Beanstalk if these dependencies are very important in size.","Q_Score":2,"Tags":"python,amazon-web-services,amazon-s3,aws-lambda,amazon-elastic-beanstalk","A_Id":74818522,"CreationDate":"2022-12-10T17:32:00.000","Title":"How to share modules across multiple AWS Lambda and Elastic Beanstalk applications?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"A long time ago I read about the closest true value to zero, like zero = 0.000000001, something like that. In the article they mentioned about this value in Python and how to achieve it. Does anyone knows about this? I have look up here in SO but all the answers are about the closest value to zero of an array and that's not my point.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":102,"Q_Id":74755994,"Users Score":2,"Answer":"The minimum positive denormalized value in Python3.9 and up is given by math.ulp(0.0) which returns 5e-324, or 4.940656e-324 when printed with format(math.ulp(0.0), '.7').","Q_Score":4,"Tags":"python","A_Id":74757470,"CreationDate":"2022-12-10T19:38:00.000","Title":"Closest true value to zero in Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"This is a simple issue. I use jupyter notebook for python and usually deal with pdfs using pymupdf.\nI usually define pdf = fitz.open('dir\/to\/file.pdf') but somethimes I forget to close the file before i redefine pdf = fitz.open('dir\/to\/other_file.pdf')\nSometimes I need to (for example) move or delete file.pdf (the original file) but I can't because python is using it.\nNot being an expert, I don't know how to close this file when I have redefined the variable pdf, as obviously pdf.close() would close 'other_file.pdf' and I end up reeinitializing my .ipynb file, which feels dumb.\nHow can I access an object which variable name has been redefined?","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":90,"Q_Id":74756452,"Users Score":0,"Answer":"Writting this issue made me think about globals()\nBrowsing throughout its keys I found that the objects which variables have been reused are stored with dummy names (don't know the term used for them). I found the object I was looking for and I was able to 'close' it.\nIf there's a better - more elegant solution, I'd be glad to hear about it.","Q_Score":0,"Tags":"python,pdf,pymupdf","A_Id":74756685,"CreationDate":"2022-12-10T20:51:00.000","Title":"How to close a pdf opened with fitz if I've replaced its variable name?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Please i am trying to get the value of the last index in a list\nthe list is 3855 long\ni try using len(Atr[\"ADX\"]) - 1 \nbut it's giving me 3829, which is not correct\nso please guys how do get the last index\n`","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":33,"Q_Id":74773208,"Users Score":0,"Answer":"you can get last index with this code\na = {5,6,4,1,2,3}\na[-1]\nits an example for you\nyou can type index -1 and python gave you the last index","Q_Score":0,"Tags":"python,pandas,list,dataframe,arraylist","A_Id":74776376,"CreationDate":"2022-12-12T15:10:00.000","Title":"How to get the value of the last index in a list","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am running a command os.system(\"unit run\" + directoryPath + \" urun shell\"), which opens the shell prompt of the unit. How should I run commands on the shell prompt that is a whole new prompt getting open up with Python?\nI tried executing the command os.system(\"unit run\" + directoryPath + \" urun shell \/c command\"), but that didn't worked as I was expecting that the command should have ran on the shell prompt.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":25,"Q_Id":74803234,"Users Score":0,"Answer":"As far as I know you can just call os.system() again with your shell-command.","Q_Score":0,"Tags":"python,automation,teamcenter","A_Id":74803359,"CreationDate":"2022-12-14T19:18:00.000","Title":"I am executing os.system (\"unit run\"+ directoryPath+\" urun shell\"), which opens the shell prompt of the unit, how to run commands on the shell promt?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"When I run this code on google colab.\nfrom google.cloud import aiplatform\nThe following error occurred\nImportError: cannot import name 'WKBWriter' from 'shapely.geos' (\/usr\/local\/lib\/python3.8\/dist-packages\/shapely\/geos.py)\nDoes anyone know how to solve this problem?\nI was working fine on 2022\/12\/16, but today it is not working.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":970,"Q_Id":74831594,"Users Score":0,"Answer":"Running into a similiar issue. So far, I am able to tell that google.cloud actions will not run if I have shapley files installed. When I delete the shapley files on my computer I am able to run google.cloud methods","Q_Score":3,"Tags":"python,google-cloud-platform,google-ai-platform","A_Id":74844335,"CreationDate":"2022-12-17T03:27:00.000","Title":"cannot import name 'WKBWriter' from 'shapely.geos' when import google cloud ai platform","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"I want to create a Student Register and Login Api without using serializer in django Rest Framework.\nSo I want to know how I make CRUD operation for those api using ApiView\nAny one please solve this","AnswerCount":3,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":116,"Q_Id":74834215,"Users Score":0,"Answer":"If you are using DRF then you must need to create the serializers. But you can create the API without using DRF and serialzers.","Q_Score":0,"Tags":"python-3.x,django,django-models,django-rest-framework,django-views","A_Id":74841673,"CreationDate":"2022-12-17T12:53:00.000","Title":"How to develop a rest api without using serializer in Django Rest Framework?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I want to create a Student Register and Login Api without using serializer in django Rest Framework.\nSo I want to know how I make CRUD operation for those api using ApiView\nAny one please solve this","AnswerCount":3,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":116,"Q_Id":74834215,"Users Score":0,"Answer":"I don't think you can, or even should but first, you need to understand what a serializer actually does:\n\nSerializers allow complex data such as querysets and model instances to be converted to native Python datatypes that can then be easily rendered into JSON, XML, or other content types. Serializers also provide deserialization, allowing parsed data to be converted back into complex types, after first validating the incoming data\n\nSo don't be scared by serializers. Just take your time and learn how to use them using the many tutorials available online.","Q_Score":0,"Tags":"python-3.x,django,django-models,django-rest-framework,django-views","A_Id":74841478,"CreationDate":"2022-12-17T12:53:00.000","Title":"How to develop a rest api without using serializer in Django Rest Framework?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am using Jina ai for my neural search project, and setting up the jina in my pycharm. What will be the yaml configurations and json schema will be?\nI am trying to find setting up resources, unable to get the proper setup guide for pycharm.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":21,"Q_Id":74844276,"Users Score":1,"Answer":"Click menu Preferences -> JSON Schema mappings;\n\nAdd a new schema, in the Schema File or URL write https:\/\/api.jina.ai\/schemas\/latest.json; select JSON Schema Version 7;\n\nAdd a file path pattern and link it to *.jaml or *.jina.yml or any suffix you commonly used for Jina Flow\u2019s YAML.","Q_Score":3,"Tags":"python,python-3.x,pycharm,jina","A_Id":75140321,"CreationDate":"2022-12-18T20:45:00.000","Title":"how to map jina yaml configurations on Pycharm?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have quite some STL files to render as turntable in Blender.\nI need to apply to each model the same setting(scale, lights,shading, etc..)\nIs it somehow possible to do a \"batch process\" of all the models with the same setting?\nI know I can use python to re-create the same scene\/setting but I wonder is there is something easier.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":45,"Q_Id":74863467,"Users Score":0,"Answer":"I don't see a way around using the integrated Python Interface, which amongst others was made to facilitate exactly such problems.\nHowever, if programmatically setting all the \"outer\" scene parameters (such as lighting) is too much work, you may consider providing a standard scene that is set up using the classic \"click-by-click\"-way. Using such default template, you then could think of selectively loading and unloading your STL files (e.g. using a simple loop) into it, where you may have only little additional steps to take (e.g. scaling, triggering the final render). Loading all STLs at once and toggling their visibility in the renders is also a way to go, yet with potentially higher memory loads than integrating and deleting them one by one.","Q_Score":0,"Tags":"python,blender","A_Id":74864933,"CreationDate":"2022-12-20T12:58:00.000","Title":"Blender batch processing","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"So, I have been working in the jupyter lab and I have created a code that uses numpy.\nIn the jupyter I had no problem using numpy. I installed the library, and I used the command import to use such module.\nHowever, I had to save my code as a py file. When I try to run my py file using my cmd, I receive this message:\nModuleNotFoundError: No module named 'numpy'\nIf i type in my cmd \"pip show numpy\" it shows me that I have numpy installed.\nI also have tried to add to my code a line with:\n\npip install numpy\n\n\npip3 install numpy\n\n\npython -m pip install numpy\n\n\npython3 -m pip install numpy\n\n\nconda install -c anaconda numpy\n\n\nconda install numpy\n\nand for every option I received a syntax error:\nSyntaxError: invalid syntax\nCan someone help me?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":37,"Q_Id":74865531,"Users Score":0,"Answer":"As mentioned in the comments section, it seems like your Python script (.py) was not using the correct environment. Please ensure that correct virtual environment is selected by doing conda activate name_of_the_kernel, where name_of_the_kernel should match the kernel used in your Jupyter notebook.","Q_Score":0,"Tags":"python,python-3.x,numpy,import,module","A_Id":74867102,"CreationDate":"2022-12-20T15:41:00.000","Title":"Importing a module in a script","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am trying to merge multiple dataframes to a master dataframe based on the columns in the master dataframes. For Example:\nMASTER DF:\n\n\n\n\nPO ID\nSales year\nName\nAcc year\n\n\n\n\n10\n1934\nxyz\n1834\n\n\n11\n1942\nabc\n1842\n\n\n\n\nSLAVE DF:\n\n\n\n\nPO ID\nYr\nAmount\nYear\n\n\n\n\n12\n1935\n365.2\n1839\n\n\n13\n1966\n253.9\n1855\n\n\n\n\nRESULTANT DF:\n\n\n\n\nPO ID\nSales Year\nAcc Year\n\n\n\n\n10\n1934\n1834\n\n\n11\n1942\n1842\n\n\n12\n1935\n1839\n\n\n13\n1966\n1855\n\n\n\n\nNotice how I have manually mapped columns (Sales Year-->Yr and Acc Year-->Year) since I know they are the same quantity, only the column names are different.\nI am trying to write some logic which can map them automatically based on some criteria (be it column names or the data type of that column) so that user does not need to map them manually.\nIf I map them by column name, both the columns have different names (Sales Year, Yr) and (Acc Year, Year). So to which column should the fourth column (Year) in the SLAVE DF be mapped in the MASTER DF?\nAnother way would be to map them based on their column values but again they are the same so cannot do that.\nThe logic should be able to map Yr to Sales Year and map Year to Acc Year automatically.\nAny idea\/logic would be helpful.\nThanks in advance!","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":75,"Q_Id":74872940,"Users Score":0,"Answer":"Generally this is impossible as there is no solid\/consistent factor by which we can map the columns.\nThat being said what one can do is use cosine similarity to calculate how similar one string (in this case the column name) is to other strings in another dataframe.\nSo in your case, we'll get 4 vectors for the first dataframe and 4 for the other one. Now calculate the cosine similarity between the first vector(PO ID) from the first dataframe and first vector from second dataframe (PO ID). This will return 100% as both the strings are same.\nFor each and every column, you'll get 4 confidence scores. Just pick the highest and map them.\nThat way you can get a makeshift logic through which you can map the column although there are loopholes in this logic too. But it is better than nothing as that way the number of columns to be mapped by the user will be less as compared to mapping them all manually.\nCheers!","Q_Score":0,"Tags":"python,pandas,dataframe,merge,data-preprocessing","A_Id":74890716,"CreationDate":"2022-12-21T08:05:00.000","Title":"Automatically Map columns from one dataframe to another using pandas","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Like the title says, I would like to know if python's heapq.heapify() will work faster on a list that is close to a heap or does it do the entire operation element by element on every list?\nI'm debating on how often to use heapify().","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":57,"Q_Id":74915435,"Users Score":0,"Answer":"The obvious answer is yes. If you supply a sorted array to heapify it won't have to perform any swaps at all. If you supply a reverse-sorted array it will have to perform the maximum number of swaps.\nThat said, there is no benefit to pre-sorting the array before passing it to heapify because the total time (i.e. analyzing and arranging the array, plus heapify time) will exceed the maximum time required for heapify to do its work on even the worst-case arrangement.\nThat said, you shouldn't have to call heapify more than once. That is, you call heapify to construct the heap. Then you call the heappush and heappop methods to add and remove items.\nI suppose, if you have to add a large number of items to an existing heap, you could append them to an existing heap and then call heapify to re-build the heap. Hard to say the exact circumstances under which that would be useful. I'd certainly give any such code a big ol' WTF if I were to see it in a code review.","Q_Score":0,"Tags":"python,heap,heapq","A_Id":74934126,"CreationDate":"2022-12-25T19:22:00.000","Title":"Is python's heapq.heapify() faster on a list that is close to a heap?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"For some reason I can do almost everything on Django but access to model.objects, like, it doesn't even appear, I cannot delete nor find anything without that (or I do not know how), I'm learning Django from a basic course.\nI use Python 3.11, Django 4.1.4, on Pycharm 2022.3.\nPD:\nIf you know of another way of doing the Create, Read, Update and Delete of objects I would appreciate that.\nSorry for the English.\nI tried searching on the web about this problem but since I'm a noob on Django and trainee on Python most things are like white noise to me, like, I don't understand.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":40,"Q_Id":74924713,"Users Score":0,"Answer":"It does work, it's just that Pycharm does not detect the .objects functions, I do not know why though.","Q_Score":0,"Tags":"python,python-3.x,django,windows,django-models","A_Id":74943410,"CreationDate":"2022-12-26T23:35:00.000","Title":"I don't have models.Model.objects","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Newbie alert\nI have code that takes a picture with the camera on the ESP32 but then that picture is in the flash memory and I don't know how to retrieve it. How do I get it onto my computer using micropython or circuitpython?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":93,"Q_Id":74926193,"Users Score":0,"Answer":"If you wrote your code in Circuit Python you can make the esp32-cam connected to a wifi hotspot and transfer...  via http or mqtt as you whish.\nBut if you manage to get a picture from the camera WITH circuit python then you need to share how you achieved that!","Q_Score":0,"Tags":"camera,esp32,micropython","A_Id":75083414,"CreationDate":"2022-12-27T06:09:00.000","Title":"Micropython\/Circuitpython - ESP32-Cam - How to download images taken onto computer?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have been looking to communicate two or multiple microservices in django and need to make them communicate with each. I've reasearched about it and didnt get proper info about it. what i understood is each microservices application completely dont depend on one another including the database. Now how to communicate each microservices with one another. there are 2 methods **synchronous and asynchronous ** method.\ni dont want to use synchronous. how to communicate the endpoints of api in asynchronous way? i found some message brokers like rabbitMQ, kafka, gRPc... Which is the best brokers. and how to communicate using those service? i didnt get any proper guidance. I'm willing to learn , can anybody please explain with some example ? It will be huge boost for my work.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":212,"Q_Id":74926266,"Users Score":0,"Answer":"There are a few different ways to communicate between microservices in a Django Rest Framework (DRF) application. Here are a few options:\nUse HTTP requests: One option is to use HTTP requests to send data between microservices. This can be done using the requests library in Python or using JavaScript's fetch API in the frontend.\nUse a message queue: Another option is to use a message queue, such as RabbitMQ or Kafka, to send messages between microservices. This can be useful if you need to decouple the services and handle asynchronous communication.\nUse a database: You can also use a database, such as PostgreSQL or MongoDB, to store data that is shared between microservices. This can be done using Django's ORM or a database driver in your preferred language.\nWhich method you choose will depend on your specific requirements and the nature of the communication between your microservices.","Q_Score":0,"Tags":"python,django,rabbitmq,microservices,rabbitmq-exchange","A_Id":74926309,"CreationDate":"2022-12-27T06:21:00.000","Title":"How to communicate two or more microservices in django rest framework?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have a string 'ABCAPITAL23JAN140CE'. This is the symbol for an option traded on stock exchange. ABCAPITAL part of the string is the company name. 23 is year 2023. JAN is for month. 140 is the strike price and CE is the type of the option.\nAll these components can vary for different options.\nI need a function such that pieces_of_string = splitstring('ABCAPITAL23JAN140CE')\nwhere\npieces_of_string = ['ABCAPITAL', 23, 'JAN', 140, 'CE'] is returned\nhow do I do that?","AnswerCount":4,"Available Count":1,"Score":-0.049958375,"is_accepted":false,"ViewCount":72,"Q_Id":74930597,"Users Score":-1,"Answer":"import re\nprint(re.findall(r\"[A-Z]+|\\d+\", \"ABCAPITAL23JAN140CE\"))","Q_Score":2,"Tags":"python,string","A_Id":74930699,"CreationDate":"2022-12-27T14:33:00.000","Title":"how do I breakdown a string in multiple components","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm new with vim and working on Mac with python, and want to know how to comment\/uncomment a single line with vim. Most of the IDEs that I've worked with use Cmd+\/ it there something similar?  I tried to find the answer but everything I found was about multiple lines!","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":64,"Q_Id":74939314,"Users Score":1,"Answer":"Comments in Python are prefixed with #\nWorking in vim you will need to insert # at some point where you think it's appropriate.\nGo to that point then type: i#ESC\n...where ESC is the escape key\nTo delete a comment you'll want to search for #\nType: \/#\nThis will take you to the first occurrence of # from your current position. Once you've established that you've found the comment that you want to delete then...\nType: d","Q_Score":0,"Tags":"python,macos,vim","A_Id":74939443,"CreationDate":"2022-12-28T10:51:00.000","Title":"How to comment\/uncomment a single line in vim","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I was hoping you would be able to help me get pylint fully functional in nvim.\nEnv:\nMac OS Venture 13.1\nnvim v0.8.1\npylint 2.15.9\npython 3.11.1 (accessed through 'python3')\npip 22.3.1 (accessed through 'pip3')\nI am using the latest versions of null-ls and Mason and the related libraries to tie all of this together.\nMy problem is that pylint does not recognise any of the packages I have fetched with pip3. My code executes as expected when I run it using python3, so the packages are installed and the modules are loaded correctly. I have checked :Mason in nvim and it has access to the right python and pip executables.\nIf I install pylint outside Neovim, it gives me the same error. I can correct it by running it with --init-hook=\"import sys; sys.path.append('\/Library\/Fr...)\" which points to the directory where pip3 saves the packages that are installed.\nHow do I check which paths pylint uses to search for packages to import? And how can I neatly add the right paths to direct it to the correct place?\nI seem to be missing some fundamental piece of information to understand the problem. Any ideas?\nThank you all so much for the help and support! <3 And I look forward to continue my coding journey!","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":904,"Q_Id":74943296,"Users Score":0,"Answer":"I reinstalled pylint using mason and that fixed it for me.","Q_Score":2,"Tags":"python,macos,pylint,neovim,pythonpath","A_Id":76198263,"CreationDate":"2022-12-28T17:33:00.000","Title":"Pylint in Neovim using Mason and null-ls cannot load packages","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"My Python import could not be found after i changed the directory and restarted VSCode.\nI installed the package via cmd (pip install ) and it was found in Vscode.\nI restarted VSCode because i changed the file location to a other directory. The package wasnt found since then. I uninstalled the package and installed it via Powershell but it wouldnt work. Updated the pip installer.\nCreated a new file with in the directory where it has been before and installed the package again.\nVSCode doesnt recognize the package anymore.\nImport \"\" could not be Resolved (Pylance(reportMissingImports))\nDoes anybody know why this behavious appears and how to fix it?\nI havent found a proper solution on here or another forum","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":22,"Q_Id":74946334,"Users Score":0,"Answer":"In the bottom right of your VS code instance, you'll see something like 3.11.0 64-bit, which indicates the version of Python that VS code is referring to when running and linting your code. The problem is you installed the package with a different version of Python. If you click on the aforementioned button (that says 3.11.0 64-bit) you should see a list of options show up for the different Python versions installed. You need to change to the one that you installed the package on.","Q_Score":0,"Tags":"python,directory,python-import,pylance","A_Id":74946385,"CreationDate":"2022-12-29T01:00:00.000","Title":"Python import not found after VSCode restart","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":1,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm using Christofides algorithm to calculate a solution for a Traveling Salesman Problem. The implementation is the one integrated in networkx library for Python.\nThe algorithm accepts an undirected networkx graph and returns a list of nodes in the order of the TSP solution. I'm not sure if I understand the algorithm correctly yet, so I don't really know yet how it determines the starting node for the calculated solution.\nSo, my assumption is: the solution is considered circular so that the Salesman returns to his starting node once he visited all nodes. end is now considered the node the Salesman visits last before returning to the start node. The start node of the returned solution is random.\nHence, I understand (correct me if I'm wrong) that for each TSP solution (order of list of nodes) with N nodes that is considered circular like that, there are N actual solutions where each node could be the starting node with the following route left unchanged.\nA-B-C-D-E-F-G-H->A could also be D-E-F-G-H-A-B-C->D and would still be a valid route and basically the same solution only with a different starting node.\nI need to find that one particular solution of all possible starting nodes of the returned order that has the greatest distance between end and start - assuming that that isn't already guaranteed to be the solution that networkx.algorithms.approximation.christofides returns.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":32,"Q_Id":74963650,"Users Score":0,"Answer":"After reading up a bit more on Christofides, it seems like, due to the minimum spanning tree that's generated as first step, the desired result of the first and last node visited being those along the path that are the furthest apart, is already the case.","Q_Score":0,"Tags":"python,networkx,traveling-salesman","A_Id":75038663,"CreationDate":"2022-12-30T16:20:00.000","Title":"Christofides TSP; let start and end node be those that are the farthest apart","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Currently, we have a table containing a varchar2 column with 4000 characters, however, it became a limitation as the size of the 'text' being inserted can grow bigger than 4000 characters, therefore we decided to use CLOB as the data type for this specific column, what happens now is that both the insertions and selections are way too slow compared to the previous varchar2(4000) data type.\nWe are using Python combined with SqlAlchemy to do both the insertions and the retrieval of the data. In simple words, the implementation itself did not change at all, only the column data type in the database.\nDoes anyone have any idea on how to tweak the performance?","AnswerCount":3,"Available Count":1,"Score":-0.0665680765,"is_accepted":false,"ViewCount":75,"Q_Id":75008445,"Users Score":-1,"Answer":"You could also ask your DBA if possible to upgrade the DB to max_string_size=EXTENDED, then the max VARCHAR2 size would be 32K.","Q_Score":0,"Tags":"python,oracle","A_Id":75010399,"CreationDate":"2023-01-04T16:31:00.000","Title":"Why CLOB slower than VARCHAR2 in Oracle?","Data Science and Machine Learning":0,"Database and SQL":1,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have a Python script that downloads some excel spreadsheets from a website, and then uploads these spreadsheets to a folder on OneDrive, at the moment I have to run this script on my machine every day, I would like to know if there is a way to run this script on a server or something, so I don't have to keep my computer on all the time.\nI thought about uploading the script to Heroku and using the platform's scheduling service, but I don't know how to integrate with OneDrive","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":40,"Q_Id":75013429,"Users Score":0,"Answer":"Yes, it is possible to schedule a python script to run without using your local machine. There are a few options for doing this:\nUse a cloud-based computing service, such as Amazon Web Services (AWS) or Google Cloud Platform (GCP). These services allow you to set up virtual machines and run your python scripts on them.\nUse a scheduling service, such as Cron or Windows Task Scheduler. These services allow you to set up a schedule for your python script to run at specific intervals.\nUse a remote server or virtual private server (VPS). These allow you to access a machine remotely and run your python scripts on it.","Q_Score":0,"Tags":"python,heroku,onedrive","A_Id":75013492,"CreationDate":"2023-01-05T02:56:00.000","Title":"How can I schedule a Python script to upload files to One drive?","Data Science and Machine Learning":0,"Database and SQL":1,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have dataset for indoor localization.the dataset contain columns for wireless access point about 520 column with the RSSI value for each one .the problem is each row of the dataset has values of one scan for a signals that can be captured by a device and the maximum number of wireless access point that can be captured about only 20 ( the signal can be from 0dbm which is when the device near the access point and minus 100dbm  when the device far from the access point but it can capture the signal) the rest of access points which are out of the range of the device scan they have been compensated with a default value of 100 positive.these value (100 dbm ) about 500 column in each row and have different columns when ever the location differ .the question is how to deal with them?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":120,"Q_Id":75042895,"Users Score":0,"Answer":"One option to deal with this issue, you could try to impute (change) the values that are out of range with a more reasonable value. There are several approaches you could take to do this:\n\nReplacing the out-of-range values with the mean or median of the in-range values\nUsing linear interpolation to estimate the missing values based on the surrounding values\n\nThe choice will depend on the goal of your machine learning model and what you want to achieve.","Q_Score":0,"Tags":"python-3.x,machine-learning,deep-learning,localization,data-processing","A_Id":75044928,"CreationDate":"2023-01-07T18:42:00.000","Title":"how to deal with out of range values in dataset (RSSI values)","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have a pyautogui code that repeats a order to click on a webpage but sometimes that webpage freezes and does not load, how could i detect that.\n\nthe webpage in not on selenium and chrome has been opened by pyautogui too\n\nUpdate 1:\nI have just realised that the website will realise that i have been on the website for a long time so it will not load certain elements. This usually happens evry 20 minutes.","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":33,"Q_Id":75045356,"Users Score":1,"Answer":"I finally solved the problem by simply reloading the page every 20 minutes which solved the problem.","Q_Score":1,"Tags":"python,pyautogui","A_Id":75046354,"CreationDate":"2023-01-08T03:40:00.000","Title":"Pyautogui inactivity detection","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have a Lambda function which calls a Python script, which in turn gives results in json format.\nThere is a possibility for the results of the script to tend to infinity, and we end up with \"inf\" values in the json. When this happens, the script can run locally, but encounters an error when run in Lambda:\nbotocore.errorfactory.InvalidRequestContentException: An error occurred (InvalidRequestContentException) when calling the Invoke operation: Could not parse request body into json: Could not parse payload into json: Non-standard token 'Infinity': enable JsonParser.Feature.ALLOW_NON_NUMERIC_NUMBERS to allow at... \namong the results when run locally, I do see:\n0.008559854691925183, inf, inf, inf, 0.0011680872601948522\nIt seems to be telling me to enable this feature of the json parser.... I have no idea how to do that. I have checked around and I see people running into a similar json error in different contexts,but found no examples for AWS\/Python. Are there a couple lines I can add to my Lambda function to ignore the error?\nAlternatively, maybe \"inf\" should just be replaced by the largest possible float value, or something like that?\nThe plotting of these results is handled by a separate lambda function, so it would be enough to shuttle the results along and handle the infinite value there, but the mere presence of this non-numeric value seems to throw a wrench in the gears. How would you handle this? Thanks.","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":29,"Q_Id":75073143,"Users Score":1,"Answer":"The answer for me was to use the Numpy function np.nan_to_num() on the data before returning it from the python script","Q_Score":1,"Tags":"python,json,amazon-web-services,aws-lambda,data-analysis","A_Id":75073312,"CreationDate":"2023-01-10T16:38:00.000","Title":"Handling infinite values in returned JSON in AWS Lambda Python function","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"I can't find how to set up or change the Webhook through API.\nIs it possible to change it, set it when I am buying a number, or select one Webhook URL for all numbers?\nI tried to find this info in the documentation but there was helpful to me","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":73,"Q_Id":75076691,"Users Score":0,"Answer":"You will have to log into your Twilio console.\nFrom the Develop tab, select Phone Numbers, then Manage > Active Numbers.\nYou can set the default Webhook (and back-up alternate Webhook) by clicking on the desired number and entering it under the respective Phone or (if available) SMS fields. You will likely have to set the Webhook (takes 2 seconds) for each phone number purchased as the default is the Twilio Demo URL (replies back with Hi or something)\nThe nature of a Webhook should allow any change in functionality to be done externally (on your end) through your Webhook script's functionality and thus dynamically changing the Webhook URL through the API on a case-by-case basis is discouraged and frankly should not be necessary. Someone may correct me if mistaken.","Q_Score":0,"Tags":"twilio,webhooks,twilio-api,twilio-python","A_Id":75084856,"CreationDate":"2023-01-10T22:57:00.000","Title":"WebHook in Twilio API","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":1,"ERRORS":0,"REVIEW":0},{"Question":"I have a Orange python widget that I created.  I would like to make it a standard widget in Orange canvas.  I have reviewed several tutorials to do this so I understand the code that must be created but after that how do you import that code into the widget library in Canvas?\nNo problems at this point looking for a complete tutorial on widget creation and import into Orange Canvas.\nReviewed several tutorials both text and video but they fall short of successful importing the code into Canvas.\nWhen I followed the widget creation on Orange and ran the install command \"pip install -e .\" from the setup directory the command executed successfully but when I open Orange Canvas the Demo OWDataSampler was not present.  Not sure how the setup tool knows how to update the Orange application to recognize where the application is installed.\nAny help would be appreciated.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":29,"Q_Id":75121781,"Users Score":0,"Answer":"I was able to get it to work properly. Need to open the Orange command prompt, navigate to the directory that has the setup.py file, and run the pip install -e . command. The widget is listed properly in canvas.","Q_Score":0,"Tags":"python,orange","A_Id":75140732,"CreationDate":"2023-01-14T22:49:00.000","Title":"Orange Data Mining Widget Creation in Canvas","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have a python script which is executed from terminal as\nscript.py 0001\nwhere 0001 indicates the subcase to be run. If I have to run different subcases, then I use\nscript.py 0001 0002\nQuestion is how to specify a range as input? Lets say I want to run 0001..0008. I got to know seq -w 0001 0008 outputs what I desire. How to pipe this to Python as input from terminal? Or is there a different way to get this done?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":32,"Q_Id":75161984,"Users Score":0,"Answer":"Tried the following already but did not work earlier as I did not have the subcases pulled in the script repo. The following works:\nscript.py 000{1..8}","Q_Score":0,"Tags":"python,bash,terminal,sequence","A_Id":75162059,"CreationDate":"2023-01-18T16:02:00.000","Title":"Passing range of numbers from terminal to Python script","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"when using pip install pandas\nAn error occurs as follows:\nCollecting pandas\nUsing cached pandas-1.5.2.tar.gz (5.2 MB)\nInstalling build dependencies ... done\nGetting requirements to build wheel ... error\nerror: subprocess-exited-with-error\n\u00d7 Getting requirements to build wheel did not run successfully.\n\u2502 exit code: 1\n\u2570\u2500> [28 lines of output]\nTraceback (most recent call last):\nFile \"d:\\py\\lib\\site-packages\\pip_vendor\\pep517\\in_process_in_process.py\", line 351, in \nmain()\nFile \"d:\\py\\lib\\site-packages\\pip_vendor\\pep517\\in_process_in_process.py\", line 333, in main\njson_out['return_val'] = hook(**hook_input['kwargs'])\nFile \"d:\\py\\lib\\site-packages\\pip_vendor\\pep517\\in_process_in_process.py\", line 112, in get_requires_for_build_wheel\nbackend = _build_backend()\nFile \"d:\\py\\lib\\site-packages\\pip_vendor\\pep517\\in_process_in_process.py\", line 77, in build_backend\nobj = import_module(mod_path)\nFile \"d:\\py\\lib\\importlib_init.py\", line 126, in import_module\nreturn _bootstrap._gcd_import(name[level:], package, level)\nFile \"\", line 1030, in _gcd_import\nFile \"\", line 1007, in _find_and_load\nFile \"\", line 972, in _find_and_load_unlocked\nFile \"\", line 228, in _call_with_frames_removed\nFile \"\", line 1030, in _gcd_import\nFile \"\", line 1007, in _find_and_load\nFile \"\", line 986, in _find_and_load_unlocked\nFile \"\", line 680, in _load_unlocked\nFile \"\", line 790, in exec_module\nFile \"\", line 228, in call_with_frames_removed\nFile \"C:\\Users\\zijie\\AppData\\Local\\Temp\\pip-build-env-kqsd82rz\\overlay\\Lib\\site-packages\\setuptools_init.py\", line 18, in \nfrom setuptools.dist import Distribution\nFile \"C:\\Users\\zijie\\AppData\\Local\\Temp\\pip-build-env-kqsd82rz\\overlay\\Lib\\site-packages\\setuptools\\dist.py\", line 47, in \nfrom . import _entry_points\nFile \"C:\\Users\\zijie\\AppData\\Local\\Temp\\pip-build-env-kqsd82rz\\overlay\\Lib\\site-packages\\setuptools_entry_points.py\", line 43, in \ndef validate(eps: metadata.EntryPoints):\nAttributeError: module 'importlib.metadata' has no attribute 'EntryPoints'\n[end of output]\nnote: This error originates from a subprocess, and is likely not a problem with pip.\nerror: subprocess-exited-with-error\n\u00d7 Getting requirements to build wheel did not run successfully.\n\u2502 exit code: 1\n\u2570\u2500> See above for output.\nnote: This error originates from a subprocess, and is likely not a problem with pip.\npy:3.10.0\nos:windows11\nDoes anyone know how to solve the problem? Thanks!\nI tried several times but it doesn't work.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":34,"Q_Id":75167298,"Users Score":0,"Answer":"Have you tried:\npip3 install pandas?","Q_Score":0,"Tags":"python,python-3.x,pandas,pip","A_Id":75167312,"CreationDate":"2023-01-19T02:48:00.000","Title":"Cannot use pip install pandas","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"So I know how to create topics on Confluent Cloud with the confluent_kafka AdminClient instance but I\u2019m not sure how to set the topic\u2019s message schema programmatically? To clarify, I have the schema I want to use saved locally in an avro schema file(.avsc)","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":28,"Q_Id":75179766,"Users Score":0,"Answer":"Use the AdminClient to create the topic and then use the SchemaRegistryClient to register the schema for the topic.","Q_Score":0,"Tags":"apache-kafka,avro,confluent-schema-registry,confluent-kafka-python","A_Id":75179798,"CreationDate":"2023-01-20T01:18:00.000","Title":"How do I tell a topic on confluent cloud to use a specific schema programmatically?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am using robot framework as the main test framework with selenium (+ python libraries) to test web ui. I'm having issues with continuous integration in Jenkins and need to change the screenshot name (that is being assigned automatically with index (selenium-screenshot-{index}.png) to more unique name for several test cases eq.:\n${TEST NAME}-screen-{index}.png\n\nI know how to access automatic varibales, but how do I set the automatic generation name to something other than selenium-screenshot on Suite Setup\/ beggining of the tests level?\n\nTried using Set Screenshot Directory to make it more unique for test suites but filenames are still the issue. Also using keyword to capture screenshot and setting the name there is not enough, as some keywords make screenshots on failure and they are still being named with selenium-screenshot convention.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":27,"Q_Id":75183706,"Users Score":2,"Answer":"Also using keyword to capture screenshot and setting the name there is not enough, as some keywords make screenshots on failure and they are still being named with selenium-screenshot convention.\n\nYou could create your own custom keyword that would handle naming and run on failure. You could use Register Keyword To Run On Failure in Suite Setup to specify which keyword to run on failure.","Q_Score":1,"Tags":"python,selenium,robotframework","A_Id":75184305,"CreationDate":"2023-01-20T11:57:00.000","Title":"Robot framework and selenium with python - screenshot automatic name change","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"there may very well be an answer to this question, but it's really hard to google for.\nyou can add commands to gdb by writing them in python. I am interested in debugging one of those python scripts that's running in gdb session.\nmy best guess is to run gdb on gdb and execute the user added command and somehow magically break on the python program code?\nhas anybody done anything like this before? I don't know the mechanism by which gdb calls python code, so if it's not in the same process space as the gdb that's calling it, I don't see how I'd be able to set breakpoints in the python program.\nor do I somehow get pdb to run in gdb? I guess I can put pdb.set_trace() in the python program, but here's the extra catch: I'd like to be able to do all this from vscode.\nso I guess my question is: what order of what things do I need to run to be able to vscode debug a python script that was initiated by gdb?\nanybody have any idea?\nthanks.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":24,"Q_Id":75189350,"Users Score":0,"Answer":"so I figured it out. it's kinda neat.\nyou run gdb to debug your program as normal, then in another window you attach to a running python program.\nin this case the running python program is the gdb process.\nonce you attach, you can set breakpoints in the python program, and then when you run commands in the first window where the gdb session is, if it hits a breakpoint in the python code, it will pop up in the second window.\nthe tipoff was that when you run gdb there does not appear to be any other python process that's a child of gdb or related anywhere, so I figured gdb must dynamically link to some python library so that the python compiler\/interpreter must be running in the gdb process space, so I figured I'd try attaching to that, and it worked.","Q_Score":0,"Tags":"python,gdb,gdb-python","A_Id":75190767,"CreationDate":"2023-01-20T21:07:00.000","Title":"How do I debug through a gdb helper script written in python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am making an algorithm that performs certain edits to a PDF using the fitz module of PyMuPDF, more precisely inside widgets. The font size 0 has a weird behaviour, not fitting in the widget, so I thought of calculating the distance myself.\nBut searching how to do so only led me to innate\/library functions in other programming languages.\nIs there a way in PyMuPDF to get the optimal\/maximal font size given a rectangle, the text and the font?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":28,"Q_Id":75189505,"Users Score":1,"Answer":"As @Seon wrote, there is rc = page.insert_textbox(), which does nothing if the text does not fit. This is indicated by a negative float rc - the rectangle height deficite.\nIf positive however, the text has been written and it is too late for optimizing the font size.\nYou can of course create a Font object for your font and check text length beforehand using tl = font.text_length(text, fontsize=fs). Dividing tl \/ rect.width gives you an approximate number of lines in the rectangle, which you can compare with the rectangle height: rect.height \/ (fs * factor) in turn is a good estimate for the number of available lines in the rect.\nThe fontsize fs alone does not take the actual line height into account: the \"natural\" line height of a font is computed using its ascender and decender values lh = (font.ascender - font.descender) * fs. So the above computation should better be rect.height \/ lh for the number of fitting lines.\n.insert_textbox() has a lineheight parameter: a factor overriding the default (font.ascender - font.descender).\nDecent visual appearances can usually be achieved by setting lineheight=1.2.\nTo get a good fit for your text to fit in a rectangle in one line, choose fs = rect.width \/ font.text_length(text, fontsize=1) for the fontsize.\nAll this however is no guarantee for how a specific PDF viewer will react WRT text form fields. They have their own idea about necessary text borders, so you will need some experimenting.","Q_Score":0,"Tags":"python,pymupdf","A_Id":75191243,"CreationDate":"2023-01-20T21:32:00.000","Title":"PyMuPDF get optimal font size given a rectangle","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Working on a data transfer program, to move data from an oracle database to another\napplication that I cant see or change. I have to create several text files described below and drop them off on sftp site.\nI am converting from a 20+ year old SQR report. (yes SQR) :(\nI have to create text files that have a format as such    an_alpa_code:2343,34533,4442,333335,.....can be thousands or numbers separated by comma.\nThe file may have only 1 line, but the file might be 48k in size.\nThere is no choice on the file format, it is required this way.\nTried using Oracle UTL_FILE, but that cannot deal with a line over 32k in length, so looking for an alterative. Python is a language my company has approved for use, so I am hoping it could do this","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":39,"Q_Id":75216312,"Users Score":0,"Answer":"This gave me one long line\nfile_obj = open(\"writing.txt\", \"w\")\nfor i in range(0,10000):\nfile_obj.write(\"mystuff\"+str(i)+\",\")\n# file_obj.write('\\n')\nfile_obj.close()","Q_Score":0,"Tags":"python,oracle,text","A_Id":75224268,"CreationDate":"2023-01-24T00:11:00.000","Title":"In Python, how can i write multiple times to a file and keep everything on 1 long line line? (40k plus characters)","Data Science and Machine Learning":0,"Database and SQL":1,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have a list of expressions (+ - *):\n[\"2 + 3\", \"5 - 1\", \"3 * 4\", ...]\nand I need to convert every expresion to expression = answer like this 2 + 3 = 5.\nI tried just doing print(listt[0]) but it outputs 2 + 3, not 5. So how do i get the answer of this expression? I know that there is a long way by doing .split() with  every expression, but is there any other faster way of doing this?\nUPD: I need to use only built-in functions","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":67,"Q_Id":75218218,"Users Score":0,"Answer":"Use eval() function. The eval() function evaluates the specified expression, if the expression is a legal Python statement, it will be executed.","Q_Score":0,"Tags":"python","A_Id":75219112,"CreationDate":"2023-01-24T06:46:00.000","Title":"How to solve expressions from a list?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have a question regarding Python\/cx-Oracle.\nThe Oracle SQLcl and SQL*Developer tools, both support proxy server connections (not to be confused with proxy users).\nFor example, on SQLcl their is a command line option, \"--proxy\", which is nothing to do with proxy users.\nI can't say that I know exactly how they work, but the options are there, and I assume that there is an option in an API in there to support it.\nIs this something which cx-Oracle supports?\nThanks,\nClive\nI tried looking at the cx-Oracle docs, but couldn't spot anything which might help.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":21,"Q_Id":75238215,"Users Score":0,"Answer":"I had another through the docs and it appears that you are expected to make changes to oracle config files (sqlnet.ora and testament.ora). That said, it also appears that newer EZconnect string syntax supports the proxy server requirement.","Q_Score":0,"Tags":"python,api,server,proxy,cx-oracle","A_Id":75264569,"CreationDate":"2023-01-25T18:19:00.000","Title":"Proxy Server Connections via Python cx-Oracle","Data Science and Machine Learning":0,"Database and SQL":1,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have 10 virtual enviroments for 10 diferent projects, but they have in common many requirements.\nFor example: let say all use pandas.\nQuestion 1: this mean I have 10 pandas pip downloaded occuping storage?\nQuestion 2: for this commonly used requierments wouldn't be a better solution to install at system level (\"base\")? how do you do this?\nQuestion 3: Is it a crazy idea to create a virtual enviroment with this libraries and use it as a \"base\" and then set include-system-site-packages = true in pyvenv.cfg?\nWhat are the good practices?\nI'm on macOS and use hombrew python.\nThanks in advance for your insights and experience.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":15,"Q_Id":75240243,"Users Score":0,"Answer":"How about you create a docker container for your common packages, and then you just need to apply whatever you are doing on top of that image. Yes you will have 10 images, but only 1 image with pandas for example.\nSo to answer your questions...\nQuestion 1, yes.\nQuestion 2, check docker and start using it.\nQuestion 3, in line with question 2 if you use docker.","Q_Score":0,"Tags":"macos,python-venv","A_Id":75240548,"CreationDate":"2023-01-25T21:51:00.000","Title":"Python: virtual enviroments using the same modules","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Used Pymupdf faced the problem of getting information about the text in the pdf file\nI asked in the library's discord channel about the possibility of obtaining information about intervals, but they told me that the library does not know how to work with them\nPerhaps there are other libraries that can do this?\nI tried to look in other libraries but did not find it. Maybe I missed something....","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":35,"Q_Id":75255508,"Users Score":0,"Answer":"i solved my problem by pdfminer.six and pymupdf by getting line  and character position\nthx all of you","Q_Score":0,"Tags":"python,python-3.x,pdf,character-spacing","A_Id":75308210,"CreationDate":"2023-01-27T08:16:00.000","Title":"How to get information about character spacing and word spacing from pdf file?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have somehow managed to mess up my pip indexes for a local virtual env.\npip config list returns the following\n:env:.index-url='https:\/\/***\/private-pypi\/simple\/' global.index-url='https:\/\/pypi.python.org\/simple'\nThis makes pip to always default to searching the private pypi index first. Any idea how I can remove the env specific index? It does not appear in the pip.conf file and running pip config unset env.index-url does not work either or I can't get the right syntax.\nThanks!","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":17,"Q_Id":75336808,"Users Score":0,"Answer":"You can remove the environment-specific index by directly editing the environment's pip.ini file or pip.conf file. The file should be located in the environment's lib\/pythonX.X\/site-packages\/pip\/ directory. Simply delete the line with the \"index-url\" value and the default global index will be used.","Q_Score":0,"Tags":"python,pip,pypi","A_Id":75337096,"CreationDate":"2023-02-03T14:05:00.000","Title":"Remove private PyPi index from local virtual env","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"As an example, I can cross validation when I do hyperparameter tuning (GridSearchCV). I can select the best estimator from there and do RFECV. and I can perform cross validate again. But this is a time-consuming task. I'm new to data science and still learning things. Can an expert help me lean how to use these things properly in machine learning model building?\nI have time series data. I'm trying to do hyperparameter tuning and cross validation in a prediction model. But it is taking a long time run. I need to learn the most efficient way to do these things during the model building process.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":27,"Q_Id":75345615,"Users Score":0,"Answer":"Cross-validation is a tool in order to evaluate model performance. Specifically avoid over-fitting. When we put all the data in training side, your Model will get over-fitting by ignoring generalisation of the data.\nThe concept of turning parameter should not based on cross-validation because hyper-parameter should be changed based on model performance, for example the depth of tree in a tree algorithm\u2026.\nWhen you do a 10-fold cv, you will be similar to training 10 model, of cause it will have time cost. You could tune the hyper-parameter based on the cv result as cv-> model is a result of the model. However it does not make sense when putting the tuning and do cv to check again because the parameter already optimised based on the first model result.\nP.s. if you are new to data science, you could learn something call regularization\/dimension reduction to lower the dimension of your data in order to reduce time cost.","Q_Score":0,"Tags":"python,machine-learning,cross-validation,hyperparameters","A_Id":75348200,"CreationDate":"2023-02-04T14:05:00.000","Title":"How to do the cross validation properly?","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"We are developing a prediction model using deepchem's GCNModel.\nModel learning and performance verification proceeded without problems, but it was confirmed that a lot of time was spent on prediction.\nWe are trying to predict a total of 1 million data, and the parameters used are as follows.\nmodel = GCNModel(n_tasks=1, mode='regression', number_atom_features=32, learning_rate=0.0001, dropout=0.2, batch_size=32, device=device, model_dir=model_path)\nI changed the batch size to improve the performance, and it was confirmed that the time was faster when the value was decreased than when the value was increased.\nAll models had the same GPU memory usage.\nFrom common sense I know, it is estimated that the larger the batch size, the faster it will be. But can you tell me why it works in reverse?\nWe would be grateful if you could also let us know how we can further improve the prediction time.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":204,"Q_Id":75381096,"Users Score":0,"Answer":"There are two components regarding the speed:\n\nYour batch size and model size\nYour CPU\/GPU power in spawning and processing batches\n\nAnd two of them need to be balanced. For example, if your model finishes prediction of this batch, but the next batch is not yet spawned, you will notice a drop in GPU utilization for a brief moment. Sadly there is no inner metrics that directly tell you this balance - try using time.time() to benchmark your model's prediction as well as the dataloader speed.\nHowever, I don't think that's worth the effort, so you can keep decreasing the batch size up to the point there is no improvement - that's where to stop.","Q_Score":1,"Tags":"python,deep-learning,batchsize","A_Id":75381683,"CreationDate":"2023-02-08T03:21:00.000","Title":"In deep learning, can the prediction speed increase as the batch size decreases?","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":1},{"Question":"I am using aws codebuild to execute my testsuite. It says 'permission denied' when I try to run allure genrate in aws code build.\nPleas share the solution if anyone knows on how to generate allure report while working with aws code build.\nI am using pytest and the scenario is working fine in local. but failes in aws as aws build is not allowing me to run allure generate command.\non successful dev deployment -- > tetssuite execution -- > generate allure repors --> uploade them to s3 --> send the report via email using aws SNS with lambda.\nall above steps are working fine, but the 3rd step.(allure generate).\nPlease share the solution if anyone knows how to do it.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":167,"Q_Id":75432923,"Users Score":0,"Answer":"I am able to fix this is by downloading allure package freshly outside of the $CODEBUILD_SRC_DIR and set the path for the same location .\n(Initially I made this part of test repository itself and add that location to PATH, which was not working)","Q_Score":1,"Tags":"python,amazon-web-services,pytest,allure","A_Id":75457422,"CreationDate":"2023-02-13T07:24:00.000","Title":"How to run allure generate command while using aws code build","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have a use case where messages from an input_topic gets consumed and sent to a list of topics. I'm using producers[i].send_async(msg, callback=callback)  where callback = lambda res, msg: consumer.acknowledge(msg). In this case, consumer is subscribed to the input_topic. I checked the backlog of input_topic and it has not decreased at all.  Would appreciate if you could point out how to deal with this? What would be the best alternative?\nThanks in advance!","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":180,"Q_Id":75475387,"Users Score":1,"Answer":"Have you checked the consumer.acknowledge(msg) has actually been called? One possibility is the producer cannot write messages to the topic, and if the producer with infinite send timeout, you will never get the callback.","Q_Score":1,"Tags":"apache-pulsar,pulsar,python-pulsar","A_Id":75485101,"CreationDate":"2023-02-16T16:42:00.000","Title":"Pulsar producer send_async() with callback function acknowledging the sent message","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am using MAC and trying to run Ultralytics YOLOv8 pre-trained model to detect objects in my project. However, despite trying to use MPS, I am still seeing the CPU being used in torch even after running the Python code. Specifically, the output I see is: \"Ultralytics YOLOv8.0.43 \ud83d\ude80 Python-3.9.16 torch-1.13.1 CPU\".\nI wanted to know if has support for MPS in YOLOv8, and how can use it?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":222,"Q_Id":75526898,"Users Score":0,"Answer":"Try adding \"--device mps\" as a parameter when running the command line","Q_Score":1,"Tags":"python,macos,cpu,yolo","A_Id":75748615,"CreationDate":"2023-02-21T23:28:00.000","Title":"Unable to Use MPS to Run Pre-trained Object Detection Model on GPU","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"While implement Python unittest by subclassing IsolatedAsyncioTestCase, it only runs first test case successfully. For any subsequent test case it throws error that event loop is closed. This happens in both Windows and Mac. Could you please suggest how to make sure that event loop is running during the execution of test within each of the subsclasses  of the IsolatedAsyncioTestCase that I have implemented.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":82,"Q_Id":75566800,"Users Score":1,"Answer":"I had the same problem when trying to run integration tests. The first test passed, but the second one got an \"Event loop is closed\" error. I'm using MognoDB with the async driver. The reason for this error was the way the database connection was opened. IsolatedAsyncioTestCase creates a new event loop at the start and closes it at the end for execution.\nSo, a driver connection was attached to the event loop of the first TestCase, and when the second TestCase starts, it throws an error because the event loop of the first TestCase is already closed, but the new connection in the new event loop is not created.\nThe solution is to create a new database connection in each IsolatedAsyncioTestCase.","Q_Score":1,"Tags":"python,python-asyncio,python-unittest","A_Id":76249506,"CreationDate":"2023-02-25T16:27:00.000","Title":"How to resolve error of Event loop is closed python unittest?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"I am working with satellite images with different spatial resolutions, understood as pixel\/meter. For experiments I want to artificially down-sample these images, keeping the image size constant. For example I have a 512x512 image with spatial resolution 0.3m\/pixel. I want to downsample it to 0.5m\/pixel 512x512. I got advised to apply a Gaussian kernel to blur the image. But how do I calculate the standard deviation and kernel size of a Gaussian kernel to approximate the desired lower resolution? I can't find a rigorous method to do that calculation. Any help really much appreciated!\nChatGTP says that the formula is:\nsigma = (desired_resolution \/ current_resolution) \/ (2 * sqrt(2 * log(2)))\nand kernel_size = 2 * ceil(2 * sigma) + 1\nBut can't explain why. Can someone explain how standard deviation (sigma) and desired output resolution are connected? And how do I know which sigma to use? Oftentimes these existing resizing functions ask for a sigma, but in their documentation don't explain how to derive it.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":212,"Q_Id":75592762,"Users Score":0,"Answer":"I wonder where that equation for the sigma comes from, I have never seen it. It is hard to define a cutoff frequency for the Gaussian.\nThe Gaussian filter is quite compact in both the spatial domain and the frequency domain, and therefore is an extremely good low-pass filter. But it has no clear point at which it attenuates all higher frequencies sufficiently to no longer produce visible aliasing artifacts, without also attenuating lower frequencies so much that the downsampled image looks blurry.\nOf course we can follow the tradition from the field of electronics, and define the cutoff frequency as the frequency above which the signal gets attenuated with at least 3dB. I think this definition might have lead to the equation in the OP, though I don\u2019t feel like attempting to replicate that computation.\nFrom personal experience, I find 0.5 times the subsampling factor to be a good compromise for regular images. For example, to downsample by a factor of 2, I\u2019d apply a Gaussian filter with sigma 1.0 first. For OP\u2019s example of going from 0.3 to 0.5 m per pixel, the downsampling factor is 0.5\/0.3 = 1.667, half that is 0.833.\nNote that a Gaussian kernel with a sigma below 0.8 cannot be sampled properly without excessive aliasing, applying a Gaussian filter with a smaller sigma should be done through multiplication in the frequency domain.\nFinally, the kernel size. The Gaussian is infinite in size, but it becomes nearly zero very quickly, and we can truncate it without too much loss. The calculation 2 * ceil(2 * sigma) + 1 takes the central portion of the Gaussian of at least four sigma, two sigma to either side. The ceiling operation is the \u201cat least\u201d, it needs to be an integer size of course. The +1 accounts for the central pixel. This equation always produces an odd size kernel, so it can be symmetric around the origin.\nHowever, two sigma is quite small for a Gaussian filter, it cuts off too much of the bell shape, affecting some of the good qualities of the filter. I always recommend using three sigma to either side: 2 * ceil(3 * sigma) + 1. For some applications the difference might not matter, but if your goal is to quantify, I would certainly try to avoid any sources of error.","Q_Score":1,"Tags":"python,image-processing,resolution,image-resizing,gaussianblur","A_Id":75593965,"CreationDate":"2023-02-28T13:30:00.000","Title":"Calculating Gaussian Kernel sigma and width to approximate a desired lower resolution pixel\/m for satellite images","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm looking for a way to merge df. However, I don't know what would be the best way to do this.\nfirst df - metro cities\/population\/teams\n\n\n\n\nMetropolitan area\nPopulation (2016 est.)[8]\nNHL\n\n\n\n\nPhoenix\n4661537\nCoyotes\n\n\nLos Angeles\n13310447\nKings Ducks\n\n\nToronto\n5928040\nMaple Leafs\n\n\nBoston\n4794447\nBruins\n\n\nEdmonton\n1321426\nOilers\n\n\nNew York City\n20153634\nRangers Islanders Devils\n\n\n\n\nSecond df - team\/wins\/losses\n\n\n\n\nteam\nw\nL\n\n\n\n\nLos Angeles Kings\n46\n28\n\n\nPhoenix Coyotes\n37\n30\n\n\nToronto Maple Leafs\n49\n26\n\n\nBoston Bruins\n50\n20\n\n\nEdmonton Oilers\n29\n44\n\n\nNew York Islanders\n34\n37\n\n\n\n\nI tried to merge across teams. However, I need to arrange this data so that it collides in the Merge. I don't know how I would do that without looking at it case by case.\nNote: The data set is much larger and with more cities and teams.\nI had a little trouble presenting the DF here, so I only put 6 rows and the main columns.","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":80,"Q_Id":75665688,"Users Score":1,"Answer":"If you are trying to get the city part of a NHL team name, you could for example:\nMake a hash map which contains all the possible city names; {\"Toronto\": \"Toronto\"},\nsplit the NHL TEAM string and check if the hash map contains any part of the string. If it does that's the city name.\nWith the limited amount of possible city names that's not too bad.\nBut I'm not exactly sure what you are trying to accomplish, you should elaborate and simplify your question.","Q_Score":1,"Tags":"python,pandas,dataframe,data-cleaning","A_Id":75666854,"CreationDate":"2023-03-07T18:06:00.000","Title":"Thinking about the best way to merge two DataFrame","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":1},{"Question":"In lodash I can use the syntax:\nfind(ARRAY_OF_OBJECTS, OBJECT)\nThis will return an object from the array if it meets the criteria of the passed object. In this case OBJECT would be e.g. { active: true, dimension: 'target' }. The objects in the array would contain e.g. active, dimension, status etc.\nHow can I do the same in pydash? I know I can do find(ARRAY_OF_OBJECTS, lambda x: x.active == True, but the thing is, the object I pass is dynamically made. So sometimes it might not have active (as example)","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":67,"Q_Id":75693197,"Users Score":1,"Answer":"Figured it out. I can do it with is_match from pydash. In a complete line of code it would become this. target_data is an array of objects and source_row['dimensions'] is an object\npy_.collections.find(target_data, lambda x: py_.predicates.is_match(x, source_row['dimensions']))","Q_Score":1,"Tags":"python,lodash,pydash","A_Id":75693477,"CreationDate":"2023-03-10T07:14:00.000","Title":"Pydash: how to find using a object: py_.collections.find(DATA, OBJECT)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I try to make image some changes(crop, resize, undistort) and I want to know how distortion coefficients and camera intrinsinc parameters change after that.\n\nOrigin Image shape = [848, 480]\ncamera matrix = [[fx, 0, cx], [0, fy, cy], [0, 0, 1]]\ndistortion coefficients = [k1, k2, p1, p2]\n\ncrop\n\n[848, 480] -> [582, 326]\nfx, fy : no changes\ncx, cy : cx -133, cy - 77\ndistortion coefficients -> ??\n\nresize\n\n[582, 326] -> [848, 480]\nfx, cx -> 1.457fx, 1.457cx\nfy, cy -> 1.472fy, 1.472cy\n[k1, k2, p1, p2] -> [k1, k2, p1, p2] same\n\nundistort\n\nfx, fy, cx, cy -> same\n[k1, k2, p1, p2] -> [0, 0, 0, 0]\n\nDoes anyone knows the answer?\nFor me I tried using my camera and calibrate some results but I don't know the exact equation.\norigin\n\nfx = 402.242923\nfy = 403.471056\ncx = 426.716067\ncy = 229.689399\nk1 = 0.068666\nk2 = -0.039624\np1 = -0.000182\np2 = -0.001510\n\ncrop\n\nfx = 408.235312 -> almost no change\nfy = 409.653612 -> almost no change\ncx = 297.611639 -> cx - 133\ncy = 153.667098 -> cy - 77\nk1 = 0.048520 -> I don't know\nk2 = -0.010035 -> I don't know\np1 = 0.000943 -> I don't know\np2 = -0.000870 -> I don't know\n\ncrop_resize\n\nfx = 598.110106 -> almost * 1.457\nfy = 608.949995 -> almost * 1.472\ncx = 430.389861 -> almost * 1.457\ncy = 226.585804 -> almost * 1.472\nk1 = 0.054762 -> I don't know\nk2 = -0.025597 -> I don't know\np1 = 0.002752 -> I don't know\np2 = -0.001316 -> I don't know\n\nundistort\n\nfx = 404.312916 -> almost same\nfy = 405.544033 -> almost same\ncx = 427.986926 -> almost same\ncy = 229.213162 -> almost same\nk1 = -0.000838 -> almost 0\nk2 = 0.001244 -> almost 0\np1 = -0.000108 -> almost 0\np2 = 0.000769 -> almost 0","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":191,"Q_Id":75873241,"Users Score":2,"Answer":"All part you write as \"I don't know\" will be \"same(not changed)\".\nBecause Cropping and Resizing is representable with only (cx,cy,fx,fy).","Q_Score":1,"Tags":"python,opencv,camera,distortion,camera-intrinsics","A_Id":75873422,"CreationDate":"2023-03-29T04:51:00.000","Title":"How does camera distortion coefficients and camera intrinsic parameters change after image crop or resize?","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"The command line displays successful installation of pip, but when querying the pip version, it displays Script file 'D:\\anaconda\\Scripts\\pip-script.py' is not present.I don't know how to resolve it. Help!!!\nI tried many methods, but it seems like I can't use pip. I wanted to call scapy, but I can't use pip anymore.Please help me!","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":31,"Q_Id":75931207,"Users Score":0,"Answer":"Did you check the PATH variable in your windows? Check that the pip executable is in your PATH variable. To do this, open a command prompt and type echo %PATH%. Look for the directory where pip is installed (likely something like C:\\Python3\\Scripts).\nNow if pip is in your PATH, try running it directly from the command prompt by typing pip and pressing Enter. But If this still gives an error, I think you should try specifying the full path to pip.\nOr you should re install it","Q_Score":1,"Tags":"python,pip,scapy","A_Id":75931331,"CreationDate":"2023-04-04T15:30:00.000","Title":"Successfully installed pip, but error displayed when viewing pip version","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"this is my first question here :)\nWhen i try to install Anaconda on my MacBook (M1) with Ventura 13.3.1 i receive the following error:\n\"This package is incompatible with this version of macOS.\"\nI tried the arm64 installer and the x86 installer, both lead to the same error message.\nI used Anaconda on the same MacBook just a few days ago, but after the update from Ventura 13.2.1 to 13.3 I couldn't open Jupyter Notebooks from within the Anaconda Navigator. First I thought that the problem might be caused by Anaconda, so I uninstalled it. However, now here I am, unable to install it again. I also did a complete reset of my MacBook, nothing changed.\nDoes anyone have the same issue or know how I can fix this?\nThanks a lot","AnswerCount":5,"Available Count":4,"Score":0.1586485043,"is_accepted":false,"ViewCount":4353,"Q_Id":75968081,"Users Score":4,"Answer":"I had the same problem as you, I installed on my account only instead of Macintosh HD and it worked like a breeze.","Q_Score":2,"Tags":"python,installation,anaconda,macos-ventura","A_Id":76047692,"CreationDate":"2023-04-08T23:09:00.000","Title":"I can't install Anaconda on a MacBook Pro M1 with Ventura 13.3.1","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":1,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"this is my first question here :)\nWhen i try to install Anaconda on my MacBook (M1) with Ventura 13.3.1 i receive the following error:\n\"This package is incompatible with this version of macOS.\"\nI tried the arm64 installer and the x86 installer, both lead to the same error message.\nI used Anaconda on the same MacBook just a few days ago, but after the update from Ventura 13.2.1 to 13.3 I couldn't open Jupyter Notebooks from within the Anaconda Navigator. First I thought that the problem might be caused by Anaconda, so I uninstalled it. However, now here I am, unable to install it again. I also did a complete reset of my MacBook, nothing changed.\nDoes anyone have the same issue or know how I can fix this?\nThanks a lot","AnswerCount":5,"Available Count":4,"Score":0.0399786803,"is_accepted":false,"ViewCount":4353,"Q_Id":75968081,"Users Score":1,"Answer":"Try selecting a different partition\/folder for the installation.","Q_Score":2,"Tags":"python,installation,anaconda,macos-ventura","A_Id":75985899,"CreationDate":"2023-04-08T23:09:00.000","Title":"I can't install Anaconda on a MacBook Pro M1 with Ventura 13.3.1","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":1,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"this is my first question here :)\nWhen i try to install Anaconda on my MacBook (M1) with Ventura 13.3.1 i receive the following error:\n\"This package is incompatible with this version of macOS.\"\nI tried the arm64 installer and the x86 installer, both lead to the same error message.\nI used Anaconda on the same MacBook just a few days ago, but after the update from Ventura 13.2.1 to 13.3 I couldn't open Jupyter Notebooks from within the Anaconda Navigator. First I thought that the problem might be caused by Anaconda, so I uninstalled it. However, now here I am, unable to install it again. I also did a complete reset of my MacBook, nothing changed.\nDoes anyone have the same issue or know how I can fix this?\nThanks a lot","AnswerCount":5,"Available Count":4,"Score":1.2,"is_accepted":true,"ViewCount":4353,"Q_Id":75968081,"Users Score":3,"Answer":"if you have homebrew installed you should be able to run \"brew install anaconda\"","Q_Score":2,"Tags":"python,installation,anaconda,macos-ventura","A_Id":75988377,"CreationDate":"2023-04-08T23:09:00.000","Title":"I can't install Anaconda on a MacBook Pro M1 with Ventura 13.3.1","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":1,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"this is my first question here :)\nWhen i try to install Anaconda on my MacBook (M1) with Ventura 13.3.1 i receive the following error:\n\"This package is incompatible with this version of macOS.\"\nI tried the arm64 installer and the x86 installer, both lead to the same error message.\nI used Anaconda on the same MacBook just a few days ago, but after the update from Ventura 13.2.1 to 13.3 I couldn't open Jupyter Notebooks from within the Anaconda Navigator. First I thought that the problem might be caused by Anaconda, so I uninstalled it. However, now here I am, unable to install it again. I also did a complete reset of my MacBook, nothing changed.\nDoes anyone have the same issue or know how I can fix this?\nThanks a lot","AnswerCount":5,"Available Count":4,"Score":-0.0399786803,"is_accepted":false,"ViewCount":4353,"Q_Id":75968081,"Users Score":-1,"Answer":"thanks  \"brew install anaconda\".","Q_Score":2,"Tags":"python,installation,anaconda,macos-ventura","A_Id":76641130,"CreationDate":"2023-04-08T23:09:00.000","Title":"I can't install Anaconda on a MacBook Pro M1 with Ventura 13.3.1","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":1,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"I want to use tvm in my project,but got \"pycharm :No module named 'tvm'\". And I have configurated tvm.If I use the terminal environment to run the project, I can successful run program. The main problem is I need the hint in the pycharm.I try to add the system environment in pycharm, but I don't know how to do.","AnswerCount":1,"Available Count":1,"Score":0.537049567,"is_accepted":false,"ViewCount":191,"Q_Id":76015769,"Users Score":3,"Answer":"In PyCharm, in Project Settings, you can choose Python Interpreter.\nYou need to set this to point to the same python or python.exe command you run in a terminal. Otherwise PyCharm will use some (other) Python interpreter installed on your computer.\nIn UNIX shell you can find out which python command is run by your terminal by typing which python.","Q_Score":2,"Tags":"python,pycharm,tvm","A_Id":76017779,"CreationDate":"2023-04-14T13:44:00.000","Title":"pycharm :No module named 'tvm'","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I work on python. My laptop is going to change to a new laptop.\nIs there a command which i can run on my old laptop to see which python modules are installed,\nand by which commands have i installed them?\nso that I can ran that file on my new laptop to install all of them.","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":32,"Q_Id":76052780,"Users Score":2,"Answer":"Open a Powershell terminal and use pip like this pip freeze > requirements.txt this will list all your modules inside the file requirements.txt, then copy this file to your new computer and then on it run this to install all the previous modules pip install -r requirements.txt","Q_Score":1,"Tags":"python,installation,module","A_Id":76052918,"CreationDate":"2023-04-19T09:18:00.000","Title":"how to find exact modules of python which are there on my windows machine","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I try to build the mitsuba-msvc2010.sln using Visual Studio 2022. I fail to successfully build this solution; most probably due to some changes in SCons. This is the error I obtain\n\nAttributeError: 'SConsEnvironment' object has no attribute 'has_key':\n1>  File \"SConstruct\", line 15: 1>    env =\nSConscript('build\/SConscript.configure') 1>  File \"C:\\Program Files\n(x86)\\Microsoft Visual\nStudio\\Shared\\Python39_64\\lib\\site-packages\\SCons\\Script\\SConscript.py\",\nline 662: 1>    return method(*args, **kw) 1>  File \"C:\\Program Files\n(x86)\\Microsoft Visual\nStudio\\Shared\\Python39_64\\lib\\site-packages\\SCons\\Script\\SConscript.py\",\nline 598: 1>    return _SConscript(self.fs, *files, **subst_kw) 1>\nFile \"C:\\Program Files (x86)\\Microsoft Visual\nStudio\\Shared\\Python39_64\\lib\\site-packages\\SCons\\Script\\SConscript.py\",\nline 285: 1>    exec(compile(scriptdata, scriptname, 'exec'),\ncall_stack[-1].globals) 1>  File \"build\\SConscript.configure\", line\n111: 1>    if env.has_key('BOOSTINCLUDE'):\n\nWas anybody able to build this and\/or knows how to fix this problem?","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":45,"Q_Id":76068692,"Users Score":2,"Answer":"Python 3 dictionary objects no longer supports the has_key method, so that SConscript is out of date.  The membership test \"in\" can be used instead, as in if 'BOOSTINCLUDE' in env:.  There may be other things that need to be \"ported\" to use modern Python and SCons, usually not too complicated.","Q_Score":1,"Tags":"python,visual-studio-2022,scons","A_Id":76076529,"CreationDate":"2023-04-20T22:36:00.000","Title":"Compiling Mitsuba 2 on Visual Studio 2022 (SCons error)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"I have a flask project, usually i push it to dockerhub and i run it using docker run dockerhub-image, and after i updated things inside static folder, i stopped and removed the container and also removed the image, after that i repush it again to dockerhub and re-run it, but when visiting it on the web, the files inside static folder does not change at all (other files outside static folder are changed), had no idea to fix this.\nI have searched questions related to this issue but couldn't find any of it.\nQ: how do fix this issue?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":51,"Q_Id":76097898,"Users Score":0,"Answer":"Docker tags should ideally be immutable. If you're just using docker run <image> rather than docker run <image>:<new tag>, then you're just running the previously pulled, locally cached latest tag. Running an image doesn't automatically pull the newest latest tag\nAlso, as commented, your browser can cache static web assets","Q_Score":1,"Tags":"python,docker,flask","A_Id":76248524,"CreationDate":"2023-04-25T05:37:00.000","Title":"Files inside static folder are not updated on docker","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":1,"API_CHANGE":1,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"How do i add memory to RetrievalQA.from_chain_type? or, how do I add a custom prompt to ConversationalRetrievalChain?\nFor the past 2 weeks ive been trying to make a chatbot that can chat over documents (so not in just a semantic search\/qa so with memory) but also with a custom prompt. I've tried every combination of all the chains and so far the closest I've gotten is ConversationalRetrievalChain, but without custom prompts, and RetrievalQA.from_chain_type but without memory","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":3836,"Q_Id":76240871,"Users Score":0,"Answer":"When using the ConversationBufferMemory I am using a very simple test to confirm whether memory is working on my chatbot, which is asking the chatbot \"What was the first question I asked\".\nI always seems to get the same incorrect answer:\nI'm sorry, but I don't have access to your initial question as I am an AI language model and I don't have the capability to track previous interactions. Could you please repeat your question?\nApart from this though it does seem that memory is working to an extent, for example if I ask non-contextual questions, it does seem to be able to answer correctly.\nHas anyone else encountered this anomaly.\nI'm not sure if I need to work on the prompting or why else this anomaly is arising.","Q_Score":5,"Tags":"python,openai-api,chatgpt-api,langchain,py-langchain","A_Id":76449229,"CreationDate":"2023-05-13T02:43:00.000","Title":"How do i add memory to RetrievalQA.from_chain_type? or, how do I add a custom prompt to ConversationalRetrievalChain?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am relatively new to application development, but I'm working on a personal project and I would like it to automatically deploy a mariadb\/mysql db on first install\/through an option in the application. Now, I understand how to create a db, after the mariadb server has been set up, and I've got that part implemented and working. But what I would like to do is not have to install mariadb, configure the server, etc, and have the application handle that automatically. I feel like it must be possible, but I haven't been able to find an answer on how to implement it.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":32,"Q_Id":76297581,"Users Score":1,"Answer":"You can't have your application automatically install MariaDB & configure it on the machine you're running it on. And even if it could, then you wouldn't want to do that.\nIf you were to automatically install and configure the DB, then whenever you run your program for the first time on a new machine, it could take a really long time to install the DB. If you do want to automatically install & configure, then you're better off writing (or finding online) a bash script to do it. Then, you can just run the script separately and don't have to worry about any unexpected side effects.\nAlso, most of the time in production your DB isn't even on the same machine as your web app, especially if you're running it on Docker or some other form of containerization. The point of this is to take the strain off of the web app and let another isolated machine handle all the DB stuff. You could also use a service to handle your DB for you, so you don't have to install or configure anything, just provide your web app the URL, username, and password of your DB. This is likely your best bet if you don't want to do any DB configuration. I won't spend any time here listing services that can do it for you, but you can find hundred by just doing a Google search for \"MariaDB hosting\".","Q_Score":2,"Tags":"python,mysql,database,mariadb","A_Id":76297648,"CreationDate":"2023-05-20T22:32:00.000","Title":"Automatically create database in python application","Data Science and Machine Learning":0,"Database and SQL":1,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm encountering an issue while trying to install a Python package named 'mymodule'. I followed the standard installation process using pip, but whenever I attempt to import the module in my code, I receive the error message: \"ImportError: No module named 'mymodule'.\"\nHere's what I have already tried:\nVerified that 'mymodule' is installed by running \"pip show mymodule\". It shows up as installed with the correct version.\nRestarted my Python interpreter and even restarted my computer to ensure a clean environment.\nChecked the Python version compatibility. 'mymodule' is listed as compatible with Python 3.6+ and I'm using Python 3.9.\nTried reinstalling the package using \"pip uninstall mymodule\" followed by \"pip install mymodule\" to ensure a clean installation.\nConfirmed that the package is not a sub-module of another package and should be imported directly.\nDespite these efforts, the import error persists. I would greatly appreciate any suggestions or insights on how to resolve this issue and successfully import the 'mymodule' package into my Python environment.","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":51,"Q_Id":76375453,"Users Score":1,"Answer":"Check the module name: Ensure that the module name is spelled correctly and matches the case sensitivity. Python is case-sensitive, so 'mymodule' and 'MyModule' would be considered different modules.\n\nCheck the module installation: Double-check that the 'mymodule' package was installed successfully. You can use the command pip show mymodule to verify its installation details. If it doesn't appear, reinstall the package using pip install mymodule.\n\nCheck the Python environment: Ensure that you are using the correct Python environment where the 'mymodule' package is installed. Sometimes, different Python versions or virtual environments can cause module import issues. Check your Python version and confirm that it matches the requirements of 'mymodule'.\n\nVerify the module's visibility: If the 'mymodule' package is installed in a specific virtual environment, make sure that your Python interpreter is using that environment. Check your IDE or terminal settings to ensure you are using the correct Python environment.\n\nCheck the module location: If the 'mymodule' package is not installed in a standard location, you might need to add its installation path to the Python module search path. You can do this by modifying the sys.path list in your code.\n\n\nIf none of these steps resolve the issue, consider providing additional details such as the operating system, Python version, and any relevant code snippets to assist in further troubleshooting.","Q_Score":2,"Tags":"python","A_Id":76375790,"CreationDate":"2023-05-31T16:10:00.000","Title":"How can I fix 'ImportError: No module named 'mymodule' when installing a Python package using pip?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"import dbf\nopen file\ntable = dbf.Table(str(\"\/art_gr.dbf\"))\nopen table\ntable.open(mode=dbf.READ_WRITE)\nadd data to table\ntable.append({'DENUMIRE': '2', 'COD': '3'})\nopen cdx file\nindex = dbf.Idx(filename='C:\/SAGA C.3.0\/salv_bd\/0001\/art_gr.cdx', table=table)\n#how can i update the index with new data??\nclose table\ntable.close()\nI want to update an existing .cdx file with data inserted in .dbf file","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":38,"Q_Id":76480738,"Users Score":1,"Answer":"My python dbf library doesn't support index files at this time.  If no other means of updating the .cdx index file is available, you'll need to rebuild the indices in the accounting program.","Q_Score":1,"Tags":"python,visual-foxpro,dbf","A_Id":76484690,"CreationDate":"2023-06-15T08:49:00.000","Title":"How to create .cdx file from .dbf file in pyhton?","Data Science and Machine Learning":0,"Database and SQL":1,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have a frontend web application built with JavaScript, HTML, and CSS. I would like to incorporate the output of a Python script into my frontend without using a server or a full backend solution.\nThe Python script is a simple neural network, and I want to display its output in the frontend, such as showing the result as a header or plotting a graph generated by the script.\nI have already tried printing the output to the console from the Python script, but I need assistance with transferring that output to the frontend.\nIs it possible to achieve this without a server? I am open to suggestions and starting with a simpler solution, like plotting a graph generated by the Python script in the frontend.\nI appreciate any guidance or code examples on how to accomplish this. Thank you!\nI have looked into Django but I feel as if that seems too complex and more server focused for the simple task I require.\n! ANSWERED ! It only lets me accept one answer but I would say that both the streamlit and the Wasm Answers are acceptable.","AnswerCount":3,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":102,"Q_Id":76585705,"Users Score":3,"Answer":"looks like you are trying to make a web application with no backend.\njavascript is your only hope, if there is no backend.\nit is not possible to integrate python with CSS, Javascript, and HTML without a backend.","Q_Score":1,"Tags":"javascript,python,html,django,web","A_Id":76586292,"CreationDate":"2023-06-30T02:44:00.000","Title":"Is it possible to integrate python with CSS, Javascript, and HTML?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0}]