0

I've been checking different questions similar to this one but I didn't find the answer, the only one I found a bit similar was this article.

I have a dataframe "df" with some variables called "OrigenDestino", "Operación" and "Tipo Buque". I used the function pd.get_dummies:

dum_df = pd.get_dummies(df_notimestamp, columns=["OrigenDestino"], prefix=["Origen and Destino are"] )
dum_df = pd.get_dummies(dum_df, columns=["Operación"], prefix=["Operación is"])
dum_df = pd.get_dummies(dum_df, columns=["Tipo Buque"], prefix=["Tipo Buque is"])

Now I have a bigger dataframe with this variables split. What I want to do now is split this dataframe into smaller dataframes based on these variables. For example, I like to have a dataframe where variable: "Tipo Buque is_Ro-Ro Cargo Ship"==1 and ""Tipo Operación is Salida"==1.

Tipo Buque is_Ro-Ro Cargo Ship" are dummy variables ""Tipo Operación is Salida"

Thank you!

Sabil
  • 3,750
  • 1
  • 5
  • 16
Enrique
  • 81
  • 8

1 Answers1

1

I found a workaround in this article (How do I select rows from a DataFrame based on column values?). I'd like to do it automatically based on some dummy variables but looks like I'm not able to do it.

Enrique
  • 81
  • 8