Skip to content

Tag: python

pip ignores python_requires field in setup

I have the following in my setup.cfg file: Problem is that I created an enviroment with Python 3.7 and installation had no problems. Installation command: Shouldn’t pip require a Python 3.8 enviroment? Here is the test.PyPI link: PyPI project, and here the repo: GitHub repo I know that the setup.cfg fil…

Executing functions through dictionaries

My script executes depending on user’s input, like this: The problem is that I can have over 15 different choices, so I would like to make it cleaner using dicts, but I can’t get it to work. This is what I did. In the class init for sh: And so on. Further down in the class: And finally the input

Convert JSON Dict to Pandas Dataframe

I have what appears to be a very simple JSON dict I need to convert into a Pandas dataframe. The dict is being pulled in for me as a string which I have little control over. I have tried the usual methods such as pd.read_json() and json_normalize() etc but can’t seem to get it anywhere close. Has anyone…

How to replace df.loc with df.reindex without KeyError

I have a huge dataframe which I get from a .csv file. After defining the columns I only want to use the one I need. I used Python 3.8.1 version and it worked great, although raising the “FutureWarning: Passing list-likes to .loc or [] with any missing label will raise KeyError in the future, you can use…