0

I created a dataframe from text files (very irregular from each other). I created a boolean array of all the strings that start with 'T-', using below 'masking'.

mask = np.column_stack([amadeus[col].str.startswith(r'T-', na=False) for col in amadeus])

Below you may see the dataframe (left) and the boolean matches of my 'masking'.

enter image description here

I have been trying to manage the irregularity of the files with dicts, etc. with no success.

What I really need is to use this masking to 'pull' the actual contents of the cells marked as 'True' into a dataframe. Something like:

enter image description here

This is just and intermediate step to other transformations I need to do. Editing it, because it was wrongly tagged as duplicate.

Daniel Vargas
  • 980
  • 2
  • 13
  • 21
  • 1
    pasting your question title into google led me to the linked duplicate – cs95 Feb 17 '19 at 21:28
  • I don't think so, the other answer refers to pd series and by column. I'm looking at the full df. But I still need to extract the actual content by the 'masking'. – Daniel Vargas Feb 17 '19 at 21:33

0 Answers0