Skip to main content

All Questions

Tagged with
0 votes
2 answers
50 views

Pandas DataFrame conditional formatting function with additional inputs

I developed a Qt GUI that reads data from a database and displays it on the screen in a table. The table includes conditional formatting which colors cell backgrounds based on cell contents. For ...
Kes Perron's user avatar
1 vote
0 answers
31 views

How to bold part of a cell value in a pandas data frame while writing to excel using xlsxwriter [duplicate]

I would like to bold semi colon and part of text that is before a semi colon in one of the columns in pandas dataframe. Using ApplyMap , i am not getting the text before : highlighted import pandas ...
Meenakshi Sakthi's user avatar
0 votes
0 answers
117 views

How to use speech_recognition and pyannote.audio simultaneously

How can I use the data from speech_recognition's listen() function as an embedding to compare with previously recorded .wav files of different speakers talking so that I can print (speaker): (...
Flamethrower's user avatar
2 votes
2 answers
84 views

Return placeholder values with formatting if a key is not found

I want to silently ignore KeyErrors and instead replace them with placeholders if values are not found. For example: class Name: def __init__(self, name): self.name = name self....
Pearoo's user avatar
  • 104
0 votes
1 answer
39 views

How can I prevent wx.StaticText from removing consecutive whitespaces in it's input string?

I want to print text on a window such that the text is justified (like in MS-Word). when I input a string to wx.StaticText(panel, label=txt), it completely ignores duplicate spaces and replaces them ...
topcat's user avatar
  • 189
1 vote
1 answer
40 views

Can you override the default formatter for f-strings?

Reading through PEP 3101, it discusses how to subclass string.Formatter to define your own formats, but then you use it via myformatter.format(string). Is there a way to just make it work with f-...
Edward Falk's user avatar
  • 10.2k
2 votes
3 answers
79 views

Combine Python f-string with printf style formatting?

I need to format a command line where some parameters come from simple variables, and others are the result of a longer expression. Python f-strings work well for the variables, and I'm using a printf-...
patraulea's user avatar
  • 916
0 votes
1 answer
46 views

Rendering datetime and proper formatting

I have a Django project to keep track of tasks in an office environment. I have this model for tasks, and it has a finish_date attribute that is assigned as soon as I access the route to do the ...
Diego Freire's user avatar
0 votes
1 answer
1k views

How to stream a Gemini (Google Generative AI) response in a Telegram bot message?

I'm developing a telegram bot using aiogram which takes user's message as a prompt and generates a response using google-generativeai GenerativeModel. It works fine in normal mode, where I wait for a ...
urban freestyler's user avatar
0 votes
1 answer
67 views

Way to handle both "," and "." as decimal separators

I have a program where the user can copy an excel table and paste it on the program itself for data analysis. The only value allowed for the table is float. The problem is that there are 4 different ...
Drovak's user avatar
  • 3
0 votes
1 answer
71 views

Python black formatting only one file in project

I've installed black formatting in the venv directory of my project. In my project, I have, among other files: .vscode/settings.json and djblogger/djblogger/settings/base.py in the settings.json is ...
J. Hines's user avatar
0 votes
2 answers
107 views

How do I format numbers with leading zeros efficiently in Python? [duplicate]

I have a set of floats in my script, and I'd like to print them from a method with a set number of leading zeros, and decimal points so that (for example): 0.0000 becomes 000.0000 12.1246 becomes 012....
Pete855217's user avatar
  • 1,602
4 votes
2 answers
93 views

Why is there "TypeError: string indices must be integers" when using negative indices or slices in string formatting?

I would like to understand why this works fine: >>> test_string = 'long brown fox jump over a lazy python' >>> 'formatted "{test_string[0]}"'.format(test_string=test_string)...
Art Gertner's user avatar
-1 votes
1 answer
69 views

How to make a bar chart for sales data in csv file [closed]

I'm trying to make a bar chart of customer sales value by date. I have imported the CSV but I'm stuck on formatting the date. In the file, each date reads like this: 01.08.2023 00:37. Each date has ...
Peter Snee's user avatar
0 votes
0 answers
83 views

Python Pandas reads inconsistent date formats from Excel files generated automatically with a 3rd part API

I'm using the PDF4me API to convert PDF invoices into Excel files. The dates are read correctly by the API. However, when I open the Excel files, the dates are displayed inconsistently: Some dates ...
Fateh Muhammad's user avatar

15 30 50 per page
1
2 3 4 5
136