Trending questions in Python

0 votes
1 answer

How can we install python modules without root access?

Hii, You can run easy_install to install python ...READ MORE

Apr 14, 2020 in Python by Niroj
• 82,840 points
2,792 views
0 votes
1 answer

How Can I log a Python error with debug information?

Hii, Using exc_info options may be better, to allow you ...READ MORE

May 27, 2020 in Python by Niroj
• 82,840 points
796 views
0 votes
1 answer

How to keep keys/values in same order as declared?

Hello @kartik, Dictionaries will use an order that ...READ MORE

Apr 30, 2020 in Python by Niroj
• 82,840 points
1,932 views
0 votes
1 answer

What is the easiest way to implement 'IN' and 'NOT IN' in Pandas dataframe?

You can use pd.Series.isin. For "IN" use: something.isin(somewhere) Or for "NOT ...READ MORE

Aug 23, 2019 in Python by Arvind
• 3,050 points
12,798 views
0 votes
1 answer

How can I save a final model after training it on chunks of data?

Hey, @Anan, When you specify chunk size in a ...READ MORE

Apr 15, 2020 in Python by Gitika
• 65,770 points
2,472 views
0 votes
0 answers

How do I fix this Set function in python?

I have the following code below I ...READ MORE

May 20, 2020 in Python by Olufemiodubote
• 120 points
1,012 views
0 votes
1 answer

ImportError: matplotlib requires dateutil"

Hi@akhtar, The dateutil module provides powerful extensions to the standard ...READ MORE

Apr 9, 2020 in Python by MD
• 95,460 points
2,691 views
0 votes
1 answer

AttributeError: 'module' object has no attribute 'HTTPSConnection'

Hi@akhtar, You have to install openssl and openssl-devel before ...READ MORE

Apr 20, 2020 in Python by MD
• 95,460 points
2,202 views
0 votes
0 answers

I am trying to build a pong game this is what they showed me.

import turtle wn = turtle.Screen() wn.bgcolor("blue") wn.tracer(0) #Paddle A paddle_a = turtle.Turtle() paddle_a.speed(0) paddle_a.shape("square") paddle_a.color("red") paddle_a.ShapeSize paddle_a.penup() paddle_a.goto(-350, ...READ MORE

May 23, 2020 in Python by Praise
• 120 points

edited May 25, 2020 by Gitika 827 views
0 votes
2 answers

How to check if a csv file is empty in pandas?

Try this: df = pd.DataFrame(columns=['Name', 'ID', 'Department']) if df.empty ...READ MORE

Jul 1, 2019 in Python by Bob
14,859 views
0 votes
1 answer

How do I log a Python error with debug information?

Hii, In most applications, you won't be calling ...READ MORE

May 11, 2020 in Python by Niroj
• 82,840 points
1,255 views
0 votes
1 answer

how to run test cases of different modules with same marker at a time using pytest

Hey,@Nikitha, Suppose you have multiple files say test_sample1.py, test_sample2.py. To ...READ MORE

Apr 28, 2020 in Python by Gitika
• 65,770 points
1,799 views
0 votes
1 answer

How to check whether a pandas DataFrame is empty?

Hello @kartik, I use the len function. It's much faster ...READ MORE

Apr 23, 2020 in Python by Niroj
• 82,840 points
2,010 views
0 votes
1 answer

Error:Installation Issue with matplotlib Python

Hii @kartik, I assume you have installed the ...READ MORE

May 7, 2020 in Python by Niroj
• 82,840 points
1,402 views
+1 vote
1 answer

Want to know how to write paragraph on image using pillow python?

Hi, @Shantanu, You can make use of the ...READ MORE

Apr 14, 2020 in Python by Gitika
• 65,770 points
2,320 views
0 votes
1 answer

web scraping using python

Hey, @Pythonist, You can try this, ##################################### Method 1 import ...READ MORE

May 6, 2020 in Python by Gitika
• 65,770 points
1,397 views
0 votes
1 answer

How to unzip a list of tuples into individual lists?

Hello @kartik, zip is its own inverse! Provided you ...READ MORE

Apr 23, 2020 in Python by Niroj
• 82,840 points
1,942 views
+1 vote
0 answers

TypeError: only integer scalar arrays can be converted to a scalar index

import cv2 import numpy as np import matplotlib.pyplot as ...READ MORE

Dec 18, 2019 in Python by sandeep
• 130 points
7,396 views
0 votes
2 answers

Is it possible to launch python idle from a virtual environment?

Try running the following code. #!/usr/bin/env python """Simple script ...READ MORE

Jun 25, 2020 in Python by Sirajul
• 59,230 points
6,062 views
0 votes
1 answer

How can we remove an element from dic type variables. Eg : a={'A' : 2 , 'K' : 4 , 'D' : 6} }

Hey, @Kanishka, Suppose your dict contains: a={'A' : 2 ...READ MORE

May 20, 2020 in Python by Gitika
• 65,770 points
687 views
0 votes
1 answer

How to set Colorbar Range in matplotlib using Python

You could scale your data to the ...READ MORE

Nov 22, 2018 in Python by Nymeria
• 3,560 points
24,204 views
0 votes
0 answers

I am trying to install pyknow but i get this error

could not find a version that  satisfies ...READ MORE

Mar 4, 2020 in Python by Maria
• 120 points
3,951 views
0 votes
1 answer

Error:Render form errors with the label rather than field name

Hello @kartik, There is a simple way to ...READ MORE

Apr 29, 2020 in Python by Niroj
• 82,840 points
1,495 views
0 votes
1 answer

How to clone or copy a list?

Hello @kartik, With new_list = my_list, you don't actually ...READ MORE

May 15, 2020 in Python by Niroj
• 82,840 points
829 views
0 votes
1 answer

I want to download a file from the website by web scraping. Can anyone explain how to do this in jupyter lab (python) with an example?

Hey, Web scraping is a technique to automatically ...READ MORE

Apr 7, 2020 in Python by Gitika
• 65,770 points
2,429 views
0 votes
1 answer

I am trying to install visualize on my python 3.8 but i end up with the followinf error.

Hi@Avinash, I think the module name is visualization ...READ MORE

Apr 27, 2020 in Python by MD
• 95,460 points
1,606 views
0 votes
1 answer

Boto3 S3, sort bucket by last modified

I tried the following method. Its not 100% ...READ MORE

Jun 4, 2019 in Python by SDeb
• 13,300 points
15,706 views
0 votes
0 answers

I am trying to install PyBase64 on my python 3.8. But I end up with the following error:

$ pip install pybase ERROR: Could not find ...READ MORE

Mar 24, 2020 in Python by Nishant
• 210 points
3,040 views
0 votes
2 answers

Replacements for switch statement in Python?

The recommended path for Python 3.10 which ...READ MORE

Feb 9, 2022 in Python by Soham
• 9,710 points
898 views
0 votes
1 answer

TypeError: unsupported operand type(s) for -: 'list' and 'int'

Hey, @William For me the code is working ...READ MORE

Mar 11, 2020 in Python by Roshni
• 10,480 points
3,527 views
0 votes
1 answer

i write this python to read dataset into panda data frame but im getting NameError: name 'true' is not defined. Below is the code:

change  def parse(path):   g = gz ...READ MORE

Mar 15, 2020 in Python by Abhishek Shingadiya
3,734 views
+1 vote
2 answers

How to print first character of each word in upper case of a string in Python

class Solution:     def firstAlphabet(self, s):             self.s=s              k=''              k=k+s[0]              for i in range(len(s)):                     if ...READ MORE

Oct 28, 2020 in Python by Anurag
12,457 views
0 votes
0 answers

name error: name 'symtr' is not globally defined

class Solution(object):     def symtr(self,root1, root2):         if(root1==None and root2==None):             return True         elif(root1==None ...READ MORE

May 14, 2020 in Python by anonymous
• 120 points
760 views
0 votes
1 answer

How can I find script's directory with Python?

Hii, You need to call os.path.realpath on __file__, so that when __file__ is ...READ MORE

May 11, 2020 in Python by Niroj
• 82,840 points
795 views
0 votes
0 answers

Find all the classes of the table tags

Create a nested list containing classes of ...READ MORE

Apr 24, 2020 in Python by Abhishek
• 120 points
1,556 views
0 votes
1 answer

What is the procedure to update spyder on Anaconda?

This is a pretty simple thing to ...READ MORE

Aug 19, 2019 in Python by Arvind
• 3,050 points
12,241 views
0 votes
1 answer

Python code to send an email with an attachment

Hi @Vipul, try out this code. I've ...READ MORE

Jun 11, 2019 in Python by Adil
15,215 views
0 votes
1 answer

How to configure smtp server using python?

Hi@akhtar, To set smtp server in your system, ...READ MORE

Apr 15, 2020 in Python by MD
• 95,460 points
1,869 views
0 votes
1 answer

DatabaseError: current transaction is aborted, commands ignored until end of transaction block?

Hello @kartik, To get rid of the error, roll ...READ MORE

May 6, 2020 in Python by Niroj
• 82,840 points
929 views
0 votes
1 answer

How to create a zip archive of a directory in Python?

Hello @kartik, The easiest way is to use shutil.make_archive. ...READ MORE

May 11, 2020 in Python by Niroj
• 82,840 points
654 views
0 votes
2 answers

Removing Title bar in Tkinter program

you can remove the title bar by ...READ MORE

Mar 19, 2019 in Python by anonymous
20,514 views
0 votes
1 answer

How to remove a key from a Python dictionary?

Hello, If you need to remove a lot ...READ MORE

Apr 15, 2020 in Python by Niroj
• 82,840 points
1,747 views
+2 votes
6 answers

How can I change directory or "cd" in Python?

Context Manager: cd import os class cd:     """Context manager for ...READ MORE

Oct 18, 2018 in Python by Nabarupa
28,964 views
0 votes
0 answers

Python error " TypeError: string indices must be integers "

I am trying to execute following code ...READ MORE

Apr 3, 2020 in Python by Falguni
• 140 points

edited Apr 5, 2020 by Falguni 2,187 views
0 votes
1 answer

Python error "SyntaxError: invalid syntax"

but i m getting this ouput: Enter the ...READ MORE

Mar 20, 2020 in Python by anonymous
8,335 views
0 votes
1 answer

ImportError: No module named toolkit.interface

I think you didn't set your python ...READ MORE

Apr 22, 2020 in Python by MD
• 95,460 points
1,247 views
0 votes
1 answer

Building Time Series Model - Getting error involving datetime

Hey sharonda, Use a python datetime or string  results.get_prediction(start='2020-04-08', ...READ MORE

Apr 8, 2020 in Python by Niroj
• 82,840 points
1,782 views
0 votes
1 answer

How to connect mail server with smtplib module in python?

Hi@akhtar, You can connect mail server using smtplib ...READ MORE

Apr 15, 2020 in Python by MD
• 95,460 points
1,462 views