How to subtract two dataframe?

data is the dataframe, of stock data, including the stock symbol and trading date.
then I want to eliminate the data that the trading day is less than 15 days per month.
the question now is:
I have obtained the dataframe2, of less than 15 days per month from the total stock data dataframe1. I also have the original total stock data dataframe1, [that is, dataframe2 is a subset of dataframe1]
I want dataframe1-dataframe2, to operate on dataframe1 so that his data no longer includes dataframe2
excuse me? Thank you for answering

Mar.02,2021

if the index and dataframe1 of your dataframe2 are the same
dataframe1.drop (dataframe2.index)


here we don't know what the stock data format looks like. Suppose it goes like this:

>>> dateframe3 = dateframe1.drop(labels=dateframe2.axes[0])
>>> dateframe3
     code   date_time
2  000002  2018-03-16
3  000003  2018-03-17

generally, you can use the DateFrame.drop method to remove specific lines from the DateFrame.

Menu