python

  1. Avi.Parker

    Python Pandas pd.date_range() HELP

    <start = dt.datetime(2022,1,1) end = dt.datetime(2023,1,1) dates = pd.date_range (start,end,freq='20D') print(dates)> I am the definition of a newbie to python, not to mention the pandas extension, That being said is there any way that I can have the pd.date_range() line count from the end...
  2. luckyoi

    Python Is programming for everyone?

    Hello everyone! I am kind of new in programming and I have some troubles learning and I was wondering; is programming really for everyone? I am 19 years old and I've been mostly editing codes rather then making own (with no intention of stealing but just messing around to have fun). I've tried...
  3. C

    Answered Request for Help with List Methods in Python

    Please find attached a screenshot of an error message pertaining to my code from an exercise in list methods in Python, specifically count() and index(). If anyone has any constructive criticisms or suggestions, I will be most grateful. Many thanks in advance for all your help.
  4. chrswe03

    Python What should be my next steps to solve this sorting/resolving issue?

    Hi all, first post here. Working on a project for corp, we take in lots of emails and need to process them accordingly, my role is to automate this process however possible.. What I've done so far: - Grab the email, convert it out of .msg format and into a more friendly format. - Developed the...
  5. C

    Answered Request for help with printing strings in Python

    Please see a directive which I am having trouble fulfilling: # Use upper() on place: place_up place_up = upper(place, place_up) I received this error message: NameError: name 'upper' is not defined Please see the code in context, attached. There are probably more errors which I have not...
  6. Casm

    Python How to repair the corrupted image below using opencv, python, numpy and necessary libraries

    import cv2 damaged_image = cv2.imread("Corrupted.png") mask = cv2.imread("mask.png", 0) output = cv2.inpaint(damaged_image, mask, 1, cv2.INPAINT_TELEA) cv2.imshow('test', output) cv2.waitKey(0) cv2.destroyAllWindows() I couldn't generate mask with python, i have drawn the mask by using Paint...
  7. G

    Python Not sure how I can fix my code for a small turtle feeding game (in turtle) :)

    Hi, I'm having some issues with this section of my code, it has errors in Terminal and the feedback isn't very specific. Thanks!! import turtle import time variable1=turtle # turtle object #img_turtle = Turtle.fish() #turtle.register_shape('turtle.gif') #img_turtle.shape('turtle.gif') speed =...
  8. shayman23

    Python Python Probability problem

    Suppose every day you wake up and you are randomly in a GOOD mood 60% of the time or in a BAD mood 40% of the time. Furthermore, anytime you have a quiz or test in a course, the grade you receive is also random based on the following: If you take a quiz or exam when you are in a GOOD mood...
  9. timotheetremblais

    Python How to call a float in this function ?

    I have defined those three functions: ``` def deriv(y,x) : dx = 10**(-5) dx2 = dx/2 return ((y(x+dx2)-y(x-dx2))/(dx)) def fex(y,x) : y_0 = y(x) return (np.sqrt(1 + deriv(y,x)**2))/(np.sqrt(2*9.81*(y_0-y(x)))) def tang(y,a,x): y_a= y(a) return(y_a+deriv(y,a)*(x-a))...
  10. User8574

    Python .get doesn't seem to work :/

    digit_mapping = { "1" == "One", "2" == "Two", "3" == "Three", "4" == "Four" } phone = input("Phone: ") output = "" for digits in phone: output = output + digit_mapping.get(digits, "!") + " " print(output) The .get function is shown as an error (btw this is Python...
  11. cegbuji14

    HTML Problem loading local Json file

    Hi, im currently using Python's Flask to create a dashboard and on one route I'd like to render an html template that turns a local json file into a table. When using getJSON for some reason the localhost/server cannot find the file no matter how I've defined the path so the table always only...
  12. T

    Python How can I write a program in Python that presses "a" and "d"?

    Hi there, I've been trying for a long time today to write a program in python which presses the "a" key for 20 seconds, then pauses for 2 seconds and then presses the "d" key for 20 seconds and this should repeat infinitily. But I couldn't do that. If someone could help me, that would be very...
  13. Freeto_India

    Python Read xls and xlsx file to write it in csv file using python

    Hi All, I have 2 -> .XLS files (with header), 1 -> .XLSX file and 1 -> .XLSX file (password protected) I have to read these files optimally and create respective .CSV files - What would be the best optimized approach? - What are the necessary libraries required? Can one library solve this...
  14. esqhol

    My python learning app

    Hello, I recently published an app that I built for google play, I would like to reviews from you about the app and suggestions for improvements. The app is made for python learning, practice, and competing against online players. App name: Sigma- code wars Link...
  15. T

    Python I want to implement a bootstrap method to get the 95% confidence intervals for a cumulative rate

    Hello, I basically have worked out a cumulative rate and have it as a pandas column, see attached below: The confidence bounds I want are for the column CumSum which was calculated from taking all individual rates (Rind ) so Cumsum[0] is the sum of all Rind from Rind[0] to Rind[1663] and...
  16. N

    Lua explaining the structure of two functions in Lua

    Hi everyone, I am trying to integrate a code which is a variational auto encoder model (where the prior of the VAE is a mixture of Gaussians) from Lua (torch) to pytorch as part of my model and I have a hard time to fully understand the Lua script (I didn't find a tutorial of the language)...
  17. T

    Python I need an understanding in this scenario

    Hi All, I want someone to tell me what goes on in the following scenario, I don't need the code I just want to understand what goes where i.e., array ,Boolean etc. Here is the scenario. Friends of Seaview Pier is an organisation devoted to the restoration and upkeep of a pier in the town. A...
  18. N

    Python I am making a Snake game using turtle and have a "raise terminator turtle.terminator" error.

    I would like it to run rather than terminate itself: #//Snake #Import random for spawns, turle for graphics, time for pauses, and urllib for downloading icon import random import turtle import time import urllib.request #//Downloading... print("Downloading necessary files...") #//Icon download...
  19. M

    Python Python code to read in data file, write it to a file, order columns in ascending order

    Specific Prompt Read in the included data file and write it to a file named sorted_data.txt with the same data, but order the columns in ascending alphabetical order. The data comes from a .txt file and is randomly generated data going up to 1000 How would I approach writing this code...
  20. davecleghan

    Meme Thread

    Hello I am new here and looking forward to interact with the community. Currently I am learning Python. So I have a meme for the community. Try posting more such memes. Credits: Data Scientists Love For Python
Top Bottom