-1

I'm noob in python. I have a dataframe with prices of a bunch of assets in NSE (National Stock Exchange of India). Now i need to filter those assets that contain a certain number of observations. It's a liquidity filter. Each column represents an asset. The index of dataframe is datetime. There are 2462 rows, so 2462 days of observations (since i got daily prices), but not for all assets, and that's why i need to filter my dataframe.

I tried to apply a groupby.filter but that's not working. I'm thinking in a for iteration using len() for each column. Can i do this?

This is a little example. The original dataframe have more assets.

Date (Index) Asset 1
2010-01-01 180
2010-01-02 181

My data goes from 2010-01-01 to 2020-01-01 so i need to pick those assets that had liquidity in all the 2462 rows. Instead of choosing manually the dates, i need to build a filter to selecting those assets and creating a new dataframe after the filter.

wjandrea
  • 28,235
  • 9
  • 60
  • 81
  • 2
    Welcome to Stack Overflow! Check out the [tour]. We need more details. You're talking about filtering each column, but the data you're showing here only has one column, and you haven't shown your code, so how are we supposed to learn from what doesn't work? Please make a [mre]. For specifics, see [How to make good reproducible pandas examples](/q/20109391/4518341). Lastly, if you want more tips, like how to write a good title, check out [ask]. – wjandrea Aug 30 '23 at 01:08

0 Answers0