Am trying to just get a list of the made up gigs, (and hopefully make them links, to view them in a different html). Page result right now looks like this; <QuerySet [<Gig: Fulltime assistent needed from fall 2021!>, <Gig: Looking for event staff!>]> I don’t know how to remove queryset…
Pandas “A value is trying to be set on a copy of a slice from a DataFrame”
Having a bit of trouble understanding the documentation See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy dfbreed[‘x’] = dfbreed.apply(testbreed, axis=1) C:/Users/erasmuss/PycharmProjects/Sarah/farmdata.py:38:…
Django Migrations Circular Dependencies
so my django project was working completely fine and everything worked. I wanted to rename an app something else so I did and updated all the associated files in including the app.py config file. I also cleared the database and removed all migration files from each app. Ever since then I have never been able …
Problem with plotting two lists with different sizes using matplotlib
I’m extremely new to matplotlib and I’m trying to create a discord bot in python that simply logs the server activity and displays it as a line graph based on what time the server is most active (msgs per 10sec / time of day). The problem is, the number of messages is different from the amount of …
(discord.py) change discord avatar with someone’s avatar url
I’m trying to change my bot’s avatar with the avatar url of someone in my server. The code isn’t working. Any help? Answer The other answer says you have to have a bytes-like object, which is true. Adding onto it though: you can retrieve the image as a bytes-like object with requests like: i…
Big Query how to change mode of columns?
I have a Dataflow pipeline that fetches data from Pub/Sub and prepares them for insertion into Big Query and them writes them into the Database. It works fine, it can generate the schema automatically and it is able to recognise what datatype to use and everything. However the data we are using with it can va…
Pandas, how can cast a column as floats that hold floats, strings, and strings that cannot be converted?
Let’s say I have the following pandas df: And I wish to remove all rows in which the value of the column floats cannot be cast as float and cast all values as float that can be cast as such: Answer use to_numeric()+dropna(): OR in 2 steps: output:
Refactoring Test Logic in Pytest to Avoid Complex Raises Block
I’m using the flake8-pytest-style plugin and it flags a certain test as violating PT012. This is about having too much logic in the raises() statement. The code in question is this: Basically this is testing the following code: What I do is just pass in a version of Python that is less than the required…
Get filetype from BASE64 file
What is the way to get file type from base64 string? I need a solution which will work on Windows and Linux(Centos7) E.G.: This is string ; eHh4eHh4 which is = to a text file with xxxxxx inside. If websites can do this, I guess it is possible to do it in python: https://base64.guru/converter/decode/file What …
Flask CLI shows “TypeError: exceptions must derive from BaseException”
When I run Flask from the terminal with flask run, if my code has an error I see “TypeError: exceptions must derive from BaseException” instead of the actual error. To debug it I need to open the browser and inspect the exc_info variable in the Werkzeug debugger, which is not convenient. Why is Fl…