Category "python"

RoBERTa classifier: cannot generate single prediction

I have succesfully trained a text emotion classifier fine-tuning a RoBERTa language model, mostly using a helpful notebook found online. Now I am trying to writ

problem in reading products CSV file with pandas python

I have products CSV file and I am trying to read this file with pandas python but i get this error my code import pandas as pd df = pd.read_csv('D:\\work\\am

How to match the unique ids that I created in df1 to df2 based on two column values?

I have two dataframes, and I am struggling to match the unique ids that I created in df1 to df2 based on 'name' and 'version' values. I need to add a column to

Same x-ticks for all subplots in matplotlib

Though this question has already been asked, but I am unable to implement that. I don't know how get the xticks for each subplot and then replace it with the ne

Same x-ticks for all subplots in matplotlib

Though this question has already been asked, but I am unable to implement that. I don't know how get the xticks for each subplot and then replace it with the ne

Creating a python script that returns the size of a new file

I'm trying to create_python_script function that creates a new python script in the current working directory, adds the line of comments to it declared by the '

Error22 with plt.savefig() [closed]

I'm trying to save a jpg in one of my files but I revice error 22 all the time. This is my code: buy_dir = r'‪C:/Users/Erik/Downloads/b

Stop printing warning message "Using CPU. Note: This module is much faster with a GPU."

I am running a Python program using the excellent EasyOCR module. It relies on PyTorch for image detection and every time I run it, it produces a warning: "Usin

How to convert DataFrame.append() to pandas.concat()?

In pandas 1.4.0: append() was deprecated, and the docs say to use concat() instead. FutureWarning: The frame.append method is deprecated and will be removed fr

Archive files directly from memory in Python

I'm writing this program where I get a number of files, then zip them with encryption using pyzipper, and also I'm using io.BitesIO() to write these files to it

Django / Ubuntu 20 - How change to a previous version of GDAL

first of all, thanks for your help. I'm new to django, and I'm developing a site where you have to enter coordinates in some forms and then they should be edit

Pivot dataframe with duplicate index by aggregating per group

I am facing the following dataframe. Date Security Field Value 0 2022-05-03 08:00:12.394000 CFI2Z2 VALUE 83.3 1 2022-05-03 08:00:12.394000 CFI2Z2 VOLUME 1 2 2

Expected Type Bytes and got str instead udp client error

import socket target_host = "127.0.0.1" target_port = 80 # create a socket object client = socket.socket(socket.AF_INET, socket.S

WinAppDriver & Python error: AttributeError: 'dict' object has no attribute 'click'

I have a mini project that needs to automate tasks on GUI windows app using Python. While trying to find a solution I found WinAppDriver which is Selenium-like.

"codec can't encode character" error when I run "pipx install eth-brownie"

Not sure if this helps but I couldn't run "python3 -m pip install --user pipx" and "python3 -m pipx ensurepath". Instead of "python3" I just used "python" and a

ValueError: Covariance matrix does not match expected returns

I am trying to optimize a portfolio for a certain timer period Error message

symbol lookup error after updating Qt package

I recently updated all Qt packages from Pacman(Arch Linux). After updating I am getting system lookup errors after executing any python code. python: symbol

Add commit hash to each commit message

I'm wondering how to add an original commit hash to each commit message with a help of git filter-repo --commit-callback What I've tried is git filter-repo --co

How to show xticks for all 365 distinct tick labels on the X-axis using matplotlib?

I have plotted two line plots. For Y-axis as the number of values are less, the Y-axis is clearly visible. However, for X-axis there are 365 values correspondin

FastAPI: reject a WebSocket connection with HTTP response

In a FastAPI based Web app, I have a WebSocket endpoint that should allow connections only if some conditions are met, otherwise it should return an HTTP 404 re