Search Results
|
Post |
Author |
Forum |
Replies |
Views |
Posted
[asc]
|
|
|
Thread: extracting from a string
Post: RE: extracting from a string
Quote:"The purpose is to extract the first 2 decimal places and not to round up."
Just work on the string of the number? The waiter comes:
“Here is your bill Sir."
bill1 = '£173.59'
# assume 9 peop... |
|
Pedroski55 |
General Coding Help |
6 |
321 |
Oct-01-2024, 06:26 AM |
|
|
Thread: pip install paddlepaddle-tiny does not install
Post: RE: pip install paddlepaddle-tiny does not install
Thanks, that is encouraging!
Some problem however:
jieba.enable_paddle()Output:Import error, cannot find paddle.fluid and jieba.lac_small.predict module. Now, back to jieba basic cut......
[2024-09-... |
|
Pedroski55 |
General Coding Help |
4 |
547 |
Sep-25-2024, 04:20 AM |
|
|
Thread: pip install paddlepaddle-tiny does not install
Post: RE: pip install paddlepaddle-tiny does not install
Oh, it's the Python version, not the paddlepaddle-tiny version!
I don't really want to go back to Python 3.5, I have 3.10 I believe.
I'll try without paddle. They just said, the tokenizer works bett... |
|
Pedroski55 |
General Coding Help |
4 |
547 |
Sep-24-2024, 02:55 PM |
|
|
Thread: pip install paddlepaddle-tiny does not install
Post: pip install paddlepaddle-tiny does not install
I want to use the package jieba to analyse Chinese text.
From PyPI here I should install paddlepaddle-tiny. I tried various commands, but I get an error:
Quote:(GP_env) pedro@pedro-MSI:~/Python_Vir... |
|
Pedroski55 |
General Coding Help |
4 |
547 |
Sep-24-2024, 04:52 AM |
|
|
Thread: search API calls in different format
Post: RE: search API calls in different format
I did not have a problem just using your code, the output of pretty is 2390 lines, which I will not copy here.
I have, for example:
Output:"link": "https://www.linuxquestions.org/questions/syndicate... |
|
Pedroski55 |
General Coding Help |
4 |
654 |
Sep-23-2024, 04:14 AM |
|
|
Thread: how can you make a question have more than one awnser
Post: RE: how can you make a question have more than one...
Maybe like this:
print("Do you like christmas?")
answers = ['Love it', 'Hate it', 'Don\'t care', 'Sometimes']
print('Possible answers:', answers)
likes_christmas = input('Choose an answer from the ab... |
|
Pedroski55 |
General Coding Help |
2 |
476 |
Sep-22-2024, 05:04 PM |
|
|
Thread: Nested Lists & Dictionaries
Post: RE: Nested Lists & Dictionaries
You may certainly use integers as the names of the array keys, and almost anything as the value under that name.
Nesting can be complex. You may lose the track of what is where.
madrugada = {1:{"who... |
|
Pedroski55 |
General Coding Help |
5 |
623 |
Sep-22-2024, 12:08 PM |
|
|
Thread: python read PDF Statement and write it into excel
Post: RE: python read PDF Statement and write it into ex...
Maybe you should post an actual PDF.
There was a recent question from India about getting this kind data, from text files I believe, then writing to Excel. Look for that question.
The PDF was format... |
|
Pedroski55 |
General Coding Help |
1 |
424 |
Sep-22-2024, 11:42 AM |
|
|
Thread: Unable to understand the function string.split()
Post: RE: Unable to understand the function string.split...
Quote:Did you convert the string into a list? What does sentence[0] mean here?
It is not so arcane or esoteric that only the initiated can understand it.
Python has things called: list
An array in... |
|
Pedroski55 |
General Coding Help |
8 |
588 |
Sep-16-2024, 04:25 AM |
|
|
Thread: Read TXT file in Pandas and save to Parquet
Post: RE: Read TXT file in Pandas and save to Parquet
A useful link for you.
Just tell Pandas that the separator is | (default separator is: , )
import pandas as pd
path2csv = 'csv/csv_files/pipe_separated.csv'
df = pd.read_csv(path2csv, sep="|")
dfOu... |
|
Pedroski55 |
General Coding Help |
2 |
293 |
Sep-15-2024, 05:05 AM |
|
|
Thread: Unable to understand the function string.split()
Post: RE: Unable to understand the function string.split...
When is a string not a string?
sentence = ["A tree in the park"]
print(sentence[0].split())
['A', 'tree', 'in', 'the', 'park']Claro? |
|
Pedroski55 |
General Coding Help |
8 |
588 |
Sep-13-2024, 03:28 PM |
|
|
Thread: Any idea?
Post: RE: Any idea?
I use rsync regularly, but never from Python. Why would you do that?
Look here in linuxquestions.org, an answer from michaelk, who has helped me many times!
Quote:arg="rsync -avn "+ bk_src_dir + " "... |
|
Pedroski55 |
General Coding Help |
1 |
292 |
Sep-12-2024, 05:33 PM |
|
|
Thread: Splitting Manhua & Manhwa
Post: RE: Splitting Manhua & Manhwa
I thought you said you wanted the picture cut along the red line.
That looks like these images below.
If that is not what you wanted, why is the red line there?[attachment=3039][attachment=3040] |
|
Pedroski55 |
General Coding Help |
12 |
1,022 |
Sep-11-2024, 05:08 PM |
|
|
Thread: tabular visualization
Post: RE: tabular visualization
You could use reportlab and make a pdf!
Get the column data from your df as a list.
from reportlab.pdfgen import canvas
from reportlab.lib.pagesizes import A4
from reportlab.lib.colors import pink, ... |
|
Pedroski55 |
Data Science |
4 |
724 |
Sep-11-2024, 04:53 AM |
|
|
Thread: Splitting Manhua & Manhwa
Post: RE: Splitting Manhua & Manhwa
Ah, well, if there is no red line, black line or any colour line, where exactly do you want to split the picture?
Post your original picture! |
|
Pedroski55 |
General Coding Help |
12 |
1,022 |
Sep-09-2024, 05:34 PM |
|
|
Thread: Splitting Manhua & Manhwa
Post: RE: Splitting Manhua & Manhwa
The first next_pixel comes from the pixel (303,1), which is pixel_coords[-1] at the start. Then we look in column 2 for the next red pixel.
pixel_coords = [(302,0),(303,1)]Then the function
def next... |
|
Pedroski55 |
General Coding Help |
12 |
1,022 |
Sep-09-2024, 04:40 AM |
|
|
Thread: Extracting data from bank statement PDFs (Accountant)
Post: RE: Extracting data from bank statement PDFs (Acco...
Get the text like this:
import pymupdf
import re
path2pdf = '/home/pedro/Downloads/BANK_SAMPLE.pdf'
savepath = '/home/pedro/Downloads/BANK_SAMPLE.text'
# there are no tables in the pdf
# below does... |
|
Pedroski55 |
General Coding Help |
3 |
499 |
Sep-08-2024, 08:33 AM |
|
|
Thread: Help with university work - reading and writing files
Post: RE: Help with university work - reading and writin...
regex stuff
Learn re, it will always help you when searching strings!
import re
lines = """The high today will be -15.567 degrees.
The high today will be +15.567 degrees.
The high today will be -.5... |
|
Pedroski55 |
Homework |
5 |
1,971 |
Sep-08-2024, 05:11 AM |
|
|
Thread: Splitting Manhua & Manhwa
Post: RE: Splitting Manhua & Manhwa
This works and gets what you want, if I understand what you want correctly.
I used the red line, but it could just as well be a black line, or any colour line. You just need to know where the curve ... |
|
Pedroski55 |
General Coding Help |
12 |
1,022 |
Sep-07-2024, 07:24 AM |
|
|
Thread: How do I make functions "interact" with each other?
Post: RE: How do I make functions "interact" with each o...
Look up Python LEGB, which has nothing to do with any kind of sexuality!
Locale: Variables created inside a function belong to the local scope corresponding to that function — and are not available o... |
|
Pedroski55 |
General Coding Help |
11 |
861 |
Sep-05-2024, 04:58 PM |