Python Forum
Search Results
Post Author Forum Replies Views Posted [asc]
    Thread: Help for simplifying code
Post: RE: Help for simplifying code

(Sep-20-2019, 06:59 AM)perfringo Wrote: With code above you will get NameError (if you haven't somewhere in your code defined none, which would be bad practice). a, b, c are the same in both cases,...
mmk1995 General Coding Help 8 4,162 Sep-24-2019, 11:46 AM
    Thread: Help for simplifying code
Post: RE: Help for simplifying code

(Sep-19-2019, 12:02 PM)perfringo Wrote: It seems to be counting so defaultdict could be an option: >>> from collections import defaultdict >>> c = defaultdict(int) >>> ru...
mmk1995 General Coding Help 8 4,162 Sep-20-2019, 06:16 AM
    Thread: Help for simplifying code
Post: Help for simplifying code

Hello, How can I simplify below two coding to make the code clean? coding 1: Case1,Case2,Case3,Case4,Case5=0,0,0,0,0,0 if rule = 1: Case1+=1 elif rule = 2: Case2+=1 elif rule = 3: Case3+=1...
mmk1995 General Coding Help 8 4,162 Sep-19-2019, 11:02 AM
    Thread: How can I do it in Python for this SQL statement?
Post: How can I do it in Python for this SQL statement?

Hello All, I would like to ask, I have dataframe like this: datetime,NO,PG,PART_TIME,COURSE_YEAR 09/02/2018 13:43:42,3035447142,UG,F,2 09/02/2018 13:43:45,3035447142,UG,F,2 09/02/2018 13:43:53,30355...
mmk1995 Data Science 1 1,751 Aug-23-2019, 04:49 AM
    Thread: String formatting difficulties
Post: String formatting difficulties

Hi all, I would like to ask, why the below code is valid, def place_value(number): return ("{:,.2f}".format(number)) print(place_value(1000000.006)) But below code is not valid? def place_value...
mmk1995 General Coding Help 3 2,761 Aug-09-2019, 10:33 AM

User Panel Messages

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