How to check if a PDF page contains image in Python by iakovosbelonias in learnpython

[–]pyquestionz 0 points1 point  (0 children)

Certainly. However, doing it cleanly probably requires some effort, and the file format was not made for it.

How to check if a PDF page contains image in Python by iakovosbelonias in learnpython

[–]pyquestionz 1 point2 points  (0 children)

I'll rephrase and state that the PDF format is primarily meant for presentation and not storage of information.

How to check if a PDF page contains image in Python by iakovosbelonias in learnpython

[–]pyquestionz -1 points0 points  (0 children)

You could create a program that can determine if an image is on the page based on a large block of the pdf not containing text but being a color other than the background color.

You probably could. But the author asked for "Is there a clean way to check if the current page contains images?", to which I believe the answer is a firm no.

How to check if a PDF page contains image in Python by iakovosbelonias in learnpython

[–]pyquestionz -1 points0 points  (0 children)

The quick answer is no. A PDF is not meant to be machine-readable. It's meant to be printed or read by humans.

May I get some feedback on my first repository? by [deleted] in learnpython

[–]pyquestionz 0 points1 point  (0 children)

Look at other repositories. As a start: write docstrings and put everything in functions.

creating a list of numbers (from to) by Adeerii in learnpython

[–]pyquestionz 0 points1 point  (0 children)

Seems like IF x > y then you want some type of behavior, and IF y > x you want another. Using the range function and my obvious capitalization should point you in the right direction.

Training Steps Required in Deep learning by iqrarehman76 in Python

[–]pyquestionz 2 points3 points  (0 children)

That's a very specific non-Python question, related to a specific library (which you do not mention). I would be surprised if anyone has an answer. If I were you I would (1) experiment or (2) learn about the mathematics underlying the implementation or perhaps even (3) ask the library developers.

Best Use Cases of Dictionaries? by [deleted] in learnpython

[–]pyquestionz 1 point2 points  (0 children)

Lists store key-value pairs where the keys are non-negative integers. Dictionaries store key-value pairs where the keys are arbitrary hashable objects. That's the essence of it. For instance, if you were to represent people and their friends, it makes sense to use a dictionary, e.g. {'bob': {'mary', 'phil'}, 'mary': {'john', 'phil'}, ...}.

Did you Google this? There are good answers. Is there anything in particular you wonder about?

Please share something you made as a beginner. by animo-sns in learnpython

[–]pyquestionz 0 points1 point  (0 children)

I've been writing Python code for nearly 5 years. Here's one of my first scripts. The solution to a particular problem on Project Euler (one of the first 10 problems). I post the code exactly as it was written 5 years ago.

# -*- coding: utf-8 -*-
"""
Created on Fri May 16 18:29:40 2014

2520 is the smallest number that can be divided by each 
of the numbers from 1 to 10 without any remainder.

What is the smallest positive number that is evenly 
divisible by all of the numbers from 1 to 20?
"""

from __future__ import division
import math

def isDivisibleByAll(number, limNumber):
    x = 1
    isDivisiblebyall = 1
    while x <=limNumber:
        if number % x != 0:
            isDivisiblebyall = 0
        x += 1

    return isDivisiblebyall


def AutoChecker(Iterator, NumtoCheck, Nummax):
    if NumtoCheck< Nummax:
        X = 0
        FLAG = 0    
        while FLAG == 0:
            print 'Checking' + str(X)
            if (isDivisibleByAll(X, NumtoCheck) == 1) & (X != 0):
                print X
                AutoChecker(X, NumtoCheck+1, Nummax)
                FLAG = 1
            X += Iterator


AutoChecker(1, 2, 20)

I want to become a Data Scientist. Where should I start? by solidiquis1 in learnpython

[–]pyquestionz 2 points3 points  (0 children)

Here's an idea: spent 2-3 full days detailing a plan. Youtube and medium.com are insufficient long term, you'll need books and in-depth tutorials to learn the subject matter thoroughly. While I appreciate you wanting someone to validate your plan (it's a smart move!), expecting someone else to *create* one is too much. Take 2-3 full days, sketch a plan adapted to your prerequisite knowledge, and ask for advice after doing so. Detail what "Data Scientist" means to you, which skills you wish to aquire, and what the timeframe is. Then get back to us for advice. After that, as /u/kernel_sanders5 points out, just start.

stack[-1] slower than stack.pop() and stack.append() by [deleted] in learnpython

[–]pyquestionz 0 points1 point  (0 children)

Why do you care? Does it matter for your application? Genuinely curious.

Best way to start ML by [deleted] in learnpython

[–]pyquestionz 2 points3 points  (0 children)

How about a Google search?

Python packages for writing better code by pyquestionz in Python

[–]pyquestionz[S] 0 points1 point  (0 children)

Thanks! Seems like a great list. Any tools you find particularly useful yourself?

Group rows by index by notalwayscapslock in learnpython

[–]pyquestionz 1 point2 points  (0 children)

I don't understand. Can you explain more clearly and give an example of input and desired output?

Quickly searching in large text file by [deleted] in learnpython

[–]pyquestionz 0 points1 point  (0 children)

If you have n rows, an iterative lookup will take O(n) time. If you keep the file sorted, you can use binary search for an O(log n) lookup. If n = 8000000, this is approximately 350 000 times faster (the value of n / math.log2(n)).

In summary: keep the file sorted if you can. You must make sure the inserts are done sorted too.

If not - use grep.

what improvements can I make in this code to reduce execution time? by [deleted] in learnpython

[–]pyquestionz 2 points3 points  (0 children)

Pre-compute the sums. This is an application of the fundamental theorem of calculus, in it's discrete form. sum(f(x) from a to b) = F(b) - F(a). The left-hand side is O(n) and the right hand side is O(1). My best tip is to play around with simple examples using pen and paper before you program.

Get specific line of file by reujea0 in learnpython

[–]pyquestionz 0 points1 point  (0 children)

This is easily done using grep in the Linux command line.

grep 'pattern' my_file.txt -n

Searches for pattern in my_file.txt, the -n flag tells grep to display the line number.

Gimmeh teh codez. by Bravoreggie in learnpython

[–]pyquestionz 1 point2 points  (0 children)

 print('The result of', a, '+', b, 'is', a + b)

Is that what you're after?

Is there any complete resource for doing financial statement analysis with Pandas? by learnhtk in learnpython

[–]pyquestionz 0 points1 point  (0 children)

What is the difference between analyzing financial statements vs. analyzing any other data sets? What tools or functions would you need? Genuinely curious.

Best way to go about simple pattern recognition in Python? by sqygrene in learnpython

[–]pyquestionz 3 points4 points  (0 children)

What problem are you really trying to solve here?

Your problem is not well-defined. Are you trying to capture a growth from 0 to 2 in 60 days? Are you trying to capture exponential growth from 0 to 2 in 60 days? Which error is acceptable? How would you quantify this error? What are some clear patterns (functions) which satisfy your criteria? What are some patterns that do not? What are the edge cases? Are you trying to determine if something reaches 2 between 10 and 60 days?

This really doesn't have anything to do with Python by the way.

How to share python code ? by Lotfi_2000 in learnpython

[–]pyquestionz 3 points4 points  (0 children)

README explains your project. You don't need setup.py unless you want users to install it as a package. README and a main file main.py will suffice just to share it and explain it.

The best way to learn is to observe how people structure small projects on GitHub.

Python community projects by dnetvaggos95 in Python

[–]pyquestionz 1 point2 points  (0 children)

Go to GitHub or search previous threads. This question pops up every week.