Questions tagged [digits]

Questions dealing with getting, manipulating, or changing the digits of numbers

Use this tag for questions dealing with getting, manipulating, or changing the digits of numbers. More about digits on wikipedia

1098 questions
3
votes
4 answers

vectorised function to calculate sum of digits

I have a vector of numbers (eg. c(1, 11, 1232, 4221, 2)), and I need a corresponding vector of the sums of digit of each element (c(1, 2, 8, 9, 2), in the previous example). I found some nice solutions for single numbers. the nicest (from Digit sum…
BoTz
  • 477
  • 4
  • 15
3
votes
5 answers

How can I check a string for two letters or more?

I am pulling data from a table that changes often using Python - and the method I am using is not ideal. What I would like to have is a method to pull all strings that contain only one letter and leave out anything that is 2 or more. An example of…
johne518
  • 77
  • 5
3
votes
3 answers

Regex to extract digits and dots from a string

I'm using the following code to extract the version number from a string. The version number is the first match made only by digits and dots. For example in the string: "GT-I9000M-user 2.25.31 FROYO UGKC1 release-keys" the match would be:…
Ran
  • 391
  • 1
  • 4
  • 10
3
votes
1 answer

Factorial digit sum in APL (Project Euler 20)

First I found +/⍎¨⍕(!8) and it gave me the result 9. But if I do 100!, as the number is big, I am not able to get that. With ⍎¨⍕(!100) I am getting a syntax error: ⍎SYNTAX ERROR Is there any other way to solve the problem or can you suggest me some…
3
votes
2 answers

How can I generate sequence values of mixed letter characters and number digits in FactoryBot?

I need to generate sequences of labels that look like "ABC1" and "XYZ9" -- always three letters followed by a single digit. I want both parts of the label to increment logically, and always be the exact format and length. I started…
David Hempy
  • 5,373
  • 2
  • 40
  • 68
3
votes
3 answers

Add a zero before 1 digit number in a column pandas dataframe

I have a column in my pandas dataframe that includes communes of French cities. Here is an example: index Com 1 Paris 3 2 Paris 17 3 Marseille 5 4 Abainville 5 Aast 6 Marseille 15 7 Lyon 4 Except I would like to add a 0 to…
ascha
  • 103
  • 4
3
votes
0 answers

Tesseract for negative numbers

What might I do to improve tesseract accuracy for negative numbers? For whatever reason it just won't detect it correctly, even though the picture is pixel-perfect. I'm running tesseract 4.1, using LSTM with fast tessdata. I've assigned…
Naltamer14
  • 187
  • 3
  • 10
3
votes
4 answers

Show more digits in PHP

Let's say I have: echo 1/3; And it print out only 0.33333333333333, can I get more digits?
Templar
  • 1,843
  • 7
  • 29
  • 42
3
votes
4 answers

Regular expression matching a number of characters which amount had been parsed before

Say I have a file that contains lines that look like this: "7sunrIsEfoo" "10ecological09" "3bedtime" Each line starts with numeral(s) that represent number n. I want to match the n characters following it. The output should…
qdii
  • 12,505
  • 10
  • 59
  • 116
3
votes
0 answers

OCR recognize Digital Digit

I am working on an application where I want to read digital digits from image, for that, I use below libs, anyline is working fine to recognize but it's paid not affordable for client https://anyline.com/ ml-kit recognized text but not able to…
Jai Khambhayta
  • 4,198
  • 2
  • 22
  • 29
3
votes
1 answer

How to extract two integer values from a column of a dataframe

I have a data frame named StaffHours_df that looks similar to the following: Name Hours Description Maria 5 hours 10 minutes Volunteer Taylor 2 hours 4 minutes Employee Ben 4hrs 30mins …
Marnie
  • 31
  • 3
3
votes
4 answers

function to get second largest digit from a string

I have to write a function that accepts a string and returns the second highest numerical digit in the user input as an integer. These are the rules I have to follow: Inputs with no numerical digits should return -1 Inputs with only one numerical…
user12439954
3
votes
2 answers

rbind output formatting into publishable table

I used this this code outcomes_all<- round (rbind(RD_enbloc, Additional.surgery, Procedure.time,Hospital.LOS, Negative.margin, Positive.margin, Vertical.margin ), digits=3);…
Mohamed Rahouma
  • 1,084
  • 9
  • 20
3
votes
2 answers

How to Segment handwritten and printed digit without losing information in opencv?

I've written an algorithm that would detect printed and handwritten digit and segment it but while removing outer rectangle handwritten digit is lost using clear_border from ski-image package. Any suggestion to prevent information. Sample: How to…
Zara
  • 146
  • 1
  • 13
3
votes
3 answers

Counting digits in a phone number

My assignment is to write a program that counts the number of times a digit is repeated in a phone number (numbers only). This is what I have so far and its output. import java.util.Scanner; public class PhoneNumber { public static void…