Python Forum
Search Results
Post Author Forum Replies Views Posted [asc]
    Thread: pandas: Compute the % of the unique values in a column
Post: RE: pandas: Compute the % of the unique values in ...

For that would use groupby, not crosstab. import pandas as pd df = pd.DataFrame([[1,'A'],[2,'A'],[3,'B'],[4,'B']], columns=['Numbers','Letters']) idx = df.index nrows = len(idx) df1 = df.groupby(by='...
jefsummers Data Science 1 88 Yesterday, 07:55 PM
    Thread: What's wrong with my code?
Post: RE: What's wrong with my code?

(Oct-22-2021, 05:30 AM)NeedHelpPython Wrote: Thanks for the help can the moderators delete this post? That is really bad form. You posted, your solution was pointed out, and rather than leave it up ...
jefsummers Homework 4 203 Oct-22-2021, 07:46 PM
    Thread: The behavior of tune model has changed
Post: RE: The behavior of tune model has changed

Here is where I found the docs for the classification model. Here are tutorials. Look here and scroll down to tune_model to get an example use of tune model.
jefsummers General Coding Help 5 208 Oct-21-2021, 06:52 PM
    Thread: Printing During a Loop
Post: RE: Printing During a Loop

I pasted your original code into IDLE and it failed with a syntax error because of the quotes. Fixed the quotes and it runs fine in IDLE
jefsummers Homework 16 499 Oct-20-2021, 08:03 PM
    Thread: The behavior of tune model has changed
Post: RE: The behavior of tune model has changed

Before you tune the model, you must create the model.
jefsummers General Coding Help 5 208 Oct-20-2021, 07:38 PM
    Thread: while loops
Post: RE: while loops

Indeed, the instructions suggest one loop with exclusion of the bad names as soon as they are entered. But, your example desired output suggests that all names are added and then a second loop goes th...
jefsummers Homework 11 375 Oct-18-2021, 08:08 PM
    Thread: When using print what does end="" do ?
Post: RE: When using print what does end="" do ?

The other related argument is sep. Sep is what is printed between each item in the print statement. So, if you want commas you add "sep = ', '". More common these days is to use f strings which allo...
jefsummers Homework 3 211 Oct-18-2021, 12:31 AM
    Thread: function that run once for all objects
Post: RE: function that run once for all objects

One thought - have an optional parameter in the definition that, when set designates that as your "first", don't need to modify other calls as the parameter is optional (named).
jefsummers General Coding Help 10 409 Oct-14-2021, 05:21 PM
    Thread: help with commas in print functions
Post: RE: help with commas in print functions

Another simple approach is to use sep and end as arguments in your print statement first = 1 second = 3 third = 2 print("The input numbers are ",end="") print(first, second, third, sep=", ")Output:The...
jefsummers General Coding Help 10 333 Oct-12-2021, 01:00 PM
    Thread: HELP in python homework
Post: RE: HELP in python homework

Quick question - how much course credit do you deserve for simply posting your assignment on a website?
jefsummers Homework 4 1,622 Oct-11-2021, 10:20 PM
    Thread: What are syntaxes?
Post: RE: What are syntaxes?

Syntax refers to the structural rules of a language. For example, an assignment statement has a variable, then an equal sign, then what you want put into that variable. variable = 2+3. Some languages...
jefsummers Homework 4 225 Oct-08-2021, 11:27 AM
    Thread: Python MYSQL connection does not work after 1h idle
Post: RE: Python MYSQL connection does not work after 1h...

Got a few minutes to look it up. To see if a connection is still available/working, use ping - see MySQL Ping
jefsummers General Coding Help 9 452 Oct-06-2021, 06:15 PM
    Thread: Python MYSQL connection does not work after 1h idle
Post: RE: Python MYSQL connection does not work after 1h...

I have a MySQL project that I am currently working on (in Java, sorry), and whenever I want to do anything I make a call to a function I call assureCon where I check to see if the connection is valid,...
jefsummers General Coding Help 9 452 Oct-06-2021, 05:13 PM
    Thread: Exit function from nested function based on user input
Post: RE: Exit function from nested function based on us...

def foo(): def check(m): if m == "stop": return 'exit' msg = input("Type a msg: ") if check(msg) == 'exit': return msg2 = input("Type another message: ...
jefsummers General Coding Help 5 319 Oct-05-2021, 08:12 PM
    Thread: How to use GPU in Python or Pycharm?
Post: RE: How to use GPU in Python or Pycharm?

When I need hardware acceleration I use Google Colab and under Runtime/Change Runtime Type can choose GPU or TPU acceleration. I also have a Watson account and Colab has generally blown that away (esp...
jefsummers General Coding Help 2 262 Oct-03-2021, 11:59 AM
    Thread: Basic Inheritance, Why Use init
Post: RE: Basic Inheritance, Why Use init

The other part of the question, regarding super, is complex. Super in Python is different from super in most other languages and was instituted for cooperative multiple inheritance. Intrigued? Here is...
jefsummers General Coding Help 5 386 Sep-29-2021, 05:36 PM
    Thread: Meeting Room Booking
Post: RE: Meeting Room Booking

Need more info - you are writing an app in Python that you want to intereact with Microsoft Exchange server to schedule meetings? If correct, why are you doing this rather than using Outlook, Teams, o...
jefsummers General Coding Help 2 1,703 Sep-29-2021, 10:44 AM
    Thread: Maptplotlib Animation
Post: RE: Maptplotlib Animation

Thanks for posting this. I had tackled the problem and ran into similar headaches. Finally got it working, at least the sine wave and rain demos by using VSCode. I launch that from within Anaconda and...
jefsummers General Coding Help 4 328 Sep-26-2021, 12:00 PM
    Thread: RemoteDataError (PredictingCrpytoPrices)
Post: RE: RemoteDataError (PredictingCrpytoPrices)

The problem seems to be with pandas interpreting the page. I tested the URL and got a nicely formatted table on a page. The table is quite long, takes several loads, so thought might be related to tha...
jefsummers General Coding Help 8 388 Sep-25-2021, 12:44 PM
    Thread: imaginary number i
Post: RE: imaginary number i

The first one IS correct. The square root of 1 is 1 Then apply the unary minus and you get -1
jefsummers General Coding Help 8 327 Sep-23-2021, 04:10 PM

User Panel Messages

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