Skip to content

First Unique Character in a String

Given a string, find the first non-repeating character in it and return its index. If it doesn’t exist, return -1. I came up with the following solution. How can I make it more efficient for very long input strings? Answer Your version isn’t bad for few cases with “nice” strings……

Why i can’t install autopy?

I’m using MacBook and Operating System is MacOS Sierra. I use this command to install autopy: But i get this error: Why am i getting this error? Answer There is a known issue that for some reason wasn’t fixed. Issue: https://github.com/msanders/autopy/issues/75 It contains following workaround (co…

pandas – Merging on string columns not working (bug?)

I’m trying to do a simple merge between two dataframes. These come from two different SQL tables, where the joining keys are strings: I try to merge them using this: The result of the inner join is empty, which first prompted me that there might not be any entries in the intersection: But when I try to …

Create wheel without building dependencies

I have a sample project: setup.py is just Then when I call pip wheel ., it automatically makes a wheel for numpy. Can I make it not do that? It’s my understanding that when you install a wheel, it will automatically go download and install any missing dependencies. Is the numpy wheel needed for making m…

Django – dropdown form with multiple select

I need guidance building a django dropdown forms.Form field in which I can select multiple choices. I need to select multiple locations on the office field of the form. When submitted, the form needs to return a list of the chosen offices (e.g. [“New York”, “Los Angeles”] or [“Au…

How do I download the entire pypi Python Package Index

I’m trying to find a way to download the entire PyPi index – and only the index – no code files. I’m wanting to analyze license types to be able to rule out libraries that have too restrictive license types. I’ve looked online and through the user’s guide, but if the answer…