I have a data set called df with the information of the name of the Drugs that has been administered. The column “drug_name” consists of all the various drug names. I would like to extract entries that only contain a specific name of the drugs. I have tried the .str.contain method df_adr= df[df[&#…
Tag: python
To find words starting with vowels
I am trying to pickout the words that start with vowels from given list. I am having issue when the starting letter of word is a capital vowel. I am trying below code, can anyone explain why I am not getting desired output. Answer The expression (‘aeiou’ or ‘AEIOU’) evaluates to just &…
How to format a user input into a different out put?Python
How can from an input (10 number): XXXXXXXXXX convert into : X.XX.XX.XX.XXXX So far this is my code: OUTPUT: Answer Adding to answer by @Sefan, keep prompting the user until the correct format is recevied:
Python Selenium unclickable button
I am working with the following website: www.offerte.smartpaws.ch I am trying to use the French site: www.offerte.smartpaws.ch/fr I have a piece of code that works with the German part but for some reason I get an error when trying to do the same thing on the French side, even if the elements are identical. I…
Python Pivoting dataframe that has mulitple ID columns
from a database I get the following table into a python dataframe df: FunctionID FunctionText FunctionModule UserGroup 1 Fct1 ModX GroupA 2 Fct2 ModX GroupA 2 Fct2 ModX GroupB 3 Fct3 ModY GroupB 3 Fct3 ModY GroupC . … … … 3000 Fct3000 ModZ GroupF My goal is to get a pivot-like table that loo…
Retrieve loss for each epoch in Python H2O
I would like to plot a loss vs epoch graph from a deep quantile regression model in H2O. I’m using the H2ODeepLearningEstimator but can’t seem to find a way to retrieve the loss like in Keras. https://machinelearningmastery.com/display-deep-learning-model-training-history-in-keras/ Could somebody …
Geopandas: different .sjoin() results with different projections systems
I tried to run a spatial join between a list of assets and a river basin dataset that you can find at the link below https://datasets.wri.org/dataset/aqueduct-global-flood-risk-maps?msclkid=630fc948b63611ec9931936b22cf4990 The first approach was a join on an ESPG 4326 projection setting and it works fine. The…
Tkinter App – TypeError: can only concatenate str (not “StringVar”) to str
I am trying to build a weather app in tkinter for class and I am stuck! I keep getting the following error message in the console: Error Message from Visual Studio Code Here’s my Python code: So, the API I used is supposed to accept the zip code which is what I am collecting using: I’m not sure ho…
Having some difficulty finding out how to detect in Python
I’m sorry if this is a stupid question, but I’m having a bit of trouble coming up with how to get the ‘a’s or ‘hrefs’ (aka the emails) to actually appear as the first item in the row. For starters, I’ve tried the insert() method, but it never actually gives me anythin…
How can I pass a list from one class to another?
I’m still pretty new to python so, as said in the title, I’m trying to pass a list from inside one class to another class. For example: As shown in the example I want a list from class one to be passed to class two so that it can then be used (printed in the example). Answer You should make