Skip to content

How to combine dataframes based on index column name

Hello I am new to python and I have 2 dfs and a list of tickers and i would like to combine the 2 dfs based on a list of tickers. My second df had the tickers imported from an excel sheet and so the column names in the index are in a different order, I am not sure if

I am curious about the time complexity

I am curious about the complexity of:- a function that multiply input by 5 (n*5) a function that add 5 to the input (n+5) in (3) is the time complexity o(3**n)? Answer Strangely enough, O(func(n)) is just func(n). Why? The only real think your code can do is add 1. So whatever result it go, it got there by ca…

Expecting integer values in calculation, but getting

I am working on implementing an ID3 algorithm in python. In order to get past the first step I need to calculate the information gain per column. The comments are self-explanatory. The issue that I am trying to resolve is From the simple program shown below. The Test set for ID3.csv The Training set for ID3.c…

Django NoReverseMatch error – urls.py path appears to match

In a Django application I am building as a project for an online course, I am expecting a link in one template (entry.html) to direct to a path (“edit”) in urls.py with a variable in the url. This should initiate a function called edit in views.py and render the template edit.html. I am getting a …

count consecutive vowels in words

So, this is what I have so far to find vowels in each word in the text file. It doesn’t work, and I still need to be able to count how many consecutive vowels are in the words. If you can help, but make it to the level of simplicity I have done so far, that’d be great help. Lmk

Python regex that matches superscripted text

My question is very simple but I couldn’t figure it out by myself: how to I match superscripted text with regex in Python? I’d like to match patterns like [a-zA-Z0-9,[]] but only if it’s superscripted. regards Answer The main problem is that information about “superscript” and &#…