Skip to content

Tag: pandas

pandas read_html – no tables found

I am attempting to see if I can read a table of data from WU.com, but I am getting a type error for no tables found. (first timer on web scraping too here) There is also another person with a very similar stackoverflow question here with WU table of data, but the solution is a little bit complicated to me.

How to zip together lists of unequal length into a dictionary?

I have three lists. I’d like to make these lists into a dataframe in which each row is the author paired with each coauthor and the frequency of collaborations. Basically if I could zip these three lists together, with the list ‘author’ replicated over and over in each row, this would be gre…

matplotlib: draw a box on axes

I want to draw the box between y=75 and 90 (green and red lines on the chart), but nothing is shown up when I do ax.add_patch this is the image I get: So How do I fill out the area between red and green horizontal lines? Answer If you have a fixed area you want to fill and you want

A few operations with df.groupby()

I working with a forex dataset, trying to fill in my dataframe with open, high, low, close updated every tick. Here is my code: So as you can see, with for loop I’m getting groups. Now I want to fill the following columns in my dataframe: idx be my df[‘candle_number’] df[‘1h_open&#8217…

Pandas: splitting data frame based on the slope of data

I have this data frame Update: I want a function If the slope is negetive and the length of the group is more than 2 then it should return True, index of start and end of the group. for this case it should return: result=True, index=5, index=8 1- I want to split the data frame based on the slope. This

Pandas fill in missing dates in DataFrame with multiple columns

I want to add missing dates for a specific date range, but keep all columns. I found many posts using afreq(), resample(), reindex(), but they seemed to be for Series and I couldn’t get them to work for my DataFrame. Given a sample dataframe: My goal is to return below; filling in qty as 0, but fill oth…