Skip to content
Advertisement

Tag: pandas

How to quickly subset many dataframes?

I have 180 DataFrame objects, each one has 3130 rows and it’s about 300KB in memory. The index is a DatetimeIndex, business days from 2000-01-03 to 2011-12-31: I preprocess all the data taking advantage of numpy/pandas vectorization, then I have to loop through the dataframes day by day. To prevent the possibility of ‘look ahead bias’ and get data from

Sort dataframe by substring condition excluding similar strings

I have a dataframe with a string type column named ‘tag’, tag has three categories (data_types): If I want to count the number of rows there are by each data_type in ‘tag’ column, I apply the string include condition this way But, obviously, the counting for the tag ‘DATA’ include the real ‘DATA’ rows and both ‘DATAKIND’ and ‘DATAKINDSIM’ in

get all pairs of columns where only one value in third column

I am try to get all pairs of columns where a third column has only one value, such that (given pair a,b and third column c): only returns 1,2 and 2,1 (the results from the last two rows). The first two rows are excluded since they describe the same pair but with different values in the third column. To be

How to split AFTER underscore in Python

I’ve seen a lot of threads that say how to split based on an underscore, but how can we split a string where the split is done after the underscore. So let’s say I have a pandas dataframe with one column: how can I achieve the following output? Thanks in advance. Answer You can split with the _ as a

Serach List names in a dataframe column pandas

I am trying to match my list of server with the pandas dataframe in the column Server Name if the name in the list matches in the Server Name then print the entire row. there are chances names is the my_List do not match entirely like one of the server name in my_List is tick1001.example.us.com while in Server Name. This

Advertisement