Skip to main content
added 6 characters in body
Source Link
Barmar
  • 788.5k
  • 57
  • 554
  • 668

I have a problem.

Check out the dataframe below

Company Year Status A 2021 Unpaid B 2021 Paid C 2021 Unpaid D 2021 Paid A 2020 Unpaid B 2020 Unpaid C 2020 Paid D 2020 Paid

Company Year  Status
A       2021  Unpaid
B       2021  Paid
C       2021  Unpaid
D       2021  Paid
A       2020  Unpaid
B       2020  Unpaid
C       2020  Paid
D       2020  Paid

I want to get a list of the companies that were unpaid in 2020 but paid in 2021 (so just C). I can do this in excel with no problem but can't figure it out in pandas. Am stumped.

I have a problem.

Check out the dataframe below

Company Year Status A 2021 Unpaid B 2021 Paid C 2021 Unpaid D 2021 Paid A 2020 Unpaid B 2020 Unpaid C 2020 Paid D 2020 Paid

I want to get a list of the companies that were unpaid in 2020 but paid in 2021 (so just C). I can do this in excel with no problem but can't figure it out in pandas. Am stumped.

I have a problem.

Check out the dataframe below

Company Year  Status
A       2021  Unpaid
B       2021  Paid
C       2021  Unpaid
D       2021  Paid
A       2020  Unpaid
B       2020  Unpaid
C       2020  Paid
D       2020  Paid

I want to get a list of the companies that were unpaid in 2020 but paid in 2021 (so just C). I can do this in excel with no problem but can't figure it out in pandas. Am stumped.

Source Link

filter data frame based on multiple column values

I have a problem.

Check out the dataframe below

Company Year Status A 2021 Unpaid B 2021 Paid C 2021 Unpaid D 2021 Paid A 2020 Unpaid B 2020 Unpaid C 2020 Paid D 2020 Paid

I want to get a list of the companies that were unpaid in 2020 but paid in 2021 (so just C). I can do this in excel with no problem but can't figure it out in pandas. Am stumped.