Python Forum
Cleaning my code to make it more efficient
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Cleaning my code to make it more efficient
#3
(Sep-26-2023, 11:52 AM)snippsat Wrote: Can clean up the and not mess to this.
if not any([regionas, valstija, marketas, zmogus, daiktas, dienos, menesiai, seima, augintinis, miestas, siurprizas]):
    filtered_df = df
else:
    filtered_df = df[df["Regionas"].isin(regionas)]

This is kinda simple and elegant and way much less of code.
Thank You.
Reply


Messages In This Thread
RE: Cleaning my code to make it more efficient - by BSDevo - Sep-26-2023, 12:43 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  hi need help to make this code work correctly atulkul1985 5 892 Nov-20-2023, 04:38 PM
Last Post: deanhystad
  newbie question - can't make code work tronic72 2 750 Oct-22-2023, 09:08 PM
Last Post: tronic72
  A more efficient code titanif 2 529 Oct-17-2023, 02:07 PM
Last Post: deanhystad
  how to make bot that sends instagram auto password reset code kraixx 2 1,472 Mar-04-2023, 09:59 PM
Last Post: jefsummers
  Make code non-blocking? Extra 0 1,187 Dec-03-2022, 10:07 PM
Last Post: Extra
  Making a function more efficient CatorCanulis 9 1,985 Oct-06-2022, 07:47 AM
Last Post: DPaul
  Apply textual data cleaning to several CSV files ErcoleL99 0 878 Jul-09-2022, 03:01 PM
Last Post: ErcoleL99
  Make the code shorter quest 2 1,570 Mar-14-2022, 04:28 PM
Last Post: deanhystad
  How would you (as an python expert) make this code more efficient/simple coder_sw99 3 1,863 Feb-21-2022, 10:52 AM
Last Post: Gribouillis
  Pyspark - my code works but I want to make it better Kevin 1 1,850 Dec-01-2021, 05:04 AM
Last Post: Kevin

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020