I’m writing a tool to index a document. I have a long list of hundreds, perhaps thousands of fixed patterns. E.g. my index might look like {“cat training”:”p.27″, “cat handling”:”p.29″, “cat”:”p.15″, “dog training”:̶…
Serial RS485 / RS232 communication with TDK-Lambda ZUP very slow only in Linux
In our experiment, we use many ZUP power supplies to power up the electronics. The exact models are TDK-Lambda ZUP80-2.5 and ZUP6-33. They are remotely controlled and monitored by a server running Linux. The problem is that the serial communication is very slow. By slow I mean that the ZUP baud rate can be se…
Problem with searching multiple keywords using google custom search API
I am trying to search for multiple keywords (in the list of filteredList) and get a list of each search result. This is the code I have tried below: Running the answer script The error code I got (Running the answer script): Answer I don’t have API keys to run this code but I see few mistakes: When you …
Passing two variables between functions
EDIT I have made huge mess! I’m sincerely sorry! Issue is not about last 2 print statement. Those were added when I run out of idea. Whole issue is about passing title and final_price form check_price to send_email and use them in body and subject. I’ve just hit brick wall and don’t know her…
NameError: name ‘__file__’ is not defined
I am trying to store the path of a script into a variable using: However, it keeps returning a name ‘__file__’ is not defined error. Answer Pretty sure you are running this in a terminal in the interactive Python as it is the only place (I’m aware of) to not have __file__. Also, if it was a …
Pandas – Duplicate Rows and Slice String
I’m trying to create duplicate rows during a dataframe on conditions. For example, I have this Dataframe. And I would like to get the following output: Answer For pandas 0.25+ is possible use DataFrame.explode with splitted values by Series.str.split and for remark column list comprehension with filteri…
Is it possible to display pandas styles in the IPython console?
Is it possible to display pandas styles in an iPython console? The following code in a Jupyter notebook correctly produces In the console I only get Is it possible to achieve a similar result here, or is the style engine dependent on an html frontend? Thanks in advance for any help. Answer I believe that the …
Output tuple from a list without ‘for’
I need to output tuple from a list without for. Tell me please, how I can do it? I have list of all permutation for some n: and I need (for example, if n = 2) : I tried, to use sum(l, []), but I have not idea, how I can do line break. Answer What you get back from
geopy wont return proper coordinates for canadian postal codes
I am trying to convert Canadian Postal codes into lat, long coordinates however geopy returns them as either none or somewhere in a different country Output AttributeError: ‘NoneType’ object has no attribute ‘latitude’ OR some random address Answer I think the problem here is either th…
Unable to install pygame on Python via pip (Windows 10)
Currently unable to install Pygame via pip: Getting this message: Concerned by it being termed an EOF error, is this an error in the module itself? Answer There’s dev versions available as of now. Get them via