Trending questions in Python

0 votes
1 answer

How to create the following pattern using Python?

Hi, @Roshni, You can use two for-loops for ...READ MORE

Jun 26, 2020 in Python by Gitika
• 65,730 points
1,162 views
0 votes
0 answers

number of occurrence counting in a string

Write a function called number_of_occurrences that takes ...READ MORE

May 16, 2020 in Python by Anny
• 120 points
2,961 views
0 votes
1 answer

Importing Image

Hi@Amine, The error is because there is some ...READ MORE

Jun 25, 2020 in Python by MD
• 95,460 points
1,187 views
0 votes
1 answer

NameError on coding

well i think the sapi5 is not ...READ MORE

Jun 28, 2020 in Python by Shaurya Thapliyal
• 340 points
1,188 views
0 votes
1 answer

How to create lambda function inside a list in Python?

Hi@akhtar, The lambda statement can appear in places ...READ MORE

Jun 25, 2020 in Python by MD
• 95,460 points
1,151 views
0 votes
1 answer

How to delete items from a dictionary while iterating over it?

Hii Kartik, You could do it in two ...READ MORE

Apr 30, 2020 in Python by Niroj
• 82,800 points
3,554 views
0 votes
1 answer

How to use one URL in Python code?

Hi@akhtar, You can use the requests module in ...READ MORE

Jun 24, 2020 in Python by MD
• 95,460 points
1,203 views
0 votes
0 answers

Load and pre-process NSL_KDD data set

since I am a newbie in python ...READ MORE

May 27, 2020 in Python by arezoo
• 220 points
2,455 views
0 votes
1 answer

Error: import No module name urllib2

Hii, You have to install the modules like bs4, ...READ MORE

May 5, 2020 in Python by Niroj
• 82,800 points
3,299 views
0 votes
1 answer

Can anyone help to write a regular expression to fetch TEST:31275 from the below text?

Try using the following expression: Grep -o "TEST:d+" ...READ MORE

Jun 25, 2020 in Python by Nipul Aglawe
1,077 views
0 votes
1 answer

HTML to RTF string using Pandoc(pypandoc)

Hey, @There, Actually there is a simple solution: use ...READ MORE

May 27, 2020 in Python by Gitika
• 65,730 points
2,315 views
0 votes
2 answers

How do I access command line arguments in Python?

import sys print(sys.argv) More specifically, if you run python example.py ...READ MORE

Jun 25, 2020 in Python by Karan
1,983 views
0 votes
1 answer

Error :on installing matplotlib

Hello @kartik, You had to install libfreetype6-dev and libpng-dev from the repositories. ...READ MORE

May 27, 2020 in Python by Niroj
• 82,800 points
2,305 views
0 votes
1 answer

Change the window background color using turtle - python

Try this: import turtle #set up the screen wn = ...READ MORE

Jun 19, 2019 in Python by Faiza
17,092 views
0 votes
0 answers

For some reason i cannot click on this element/button and have been trying for hours PLEASE HELP!!

from selenium import webdriver from selenium.webdriver.chrome.options import Options from ...READ MORE

Jun 18, 2020 in Python by Justin
• 140 points

reshown Jun 18, 2020 by Sirajul 1,287 views
0 votes
1 answer

How change title bar background color in python tkinter?

You cant change colour cause its the ...READ MORE

Jun 10, 2020 in Python by bezlin
9,682 views
0 votes
1 answer

How to use a dot “.” to access members of dictionary?

Hello @kartik, If you want to pickle your ...READ MORE

Apr 30, 2020 in Python by Niroj
• 82,800 points
3,256 views
0 votes
1 answer

How can we install python in RHEL using CLI?

Run the following command: sudo yum install python3 This ...READ MORE

Jun 23, 2020 in Python by Tanay Singh
928 views
0 votes
1 answer

How to check if a website allows web scraping?

To check if a website allows web ...READ MORE

Jun 14, 2019 in Python by Wajiha
• 1,960 points
17,094 views
0 votes
1 answer

I can't get a graph out of my information

Hi@lzzy, According to your error, there is a ...READ MORE

Jun 11, 2020 in Python by MD
• 95,460 points
1,418 views
0 votes
1 answer

How to pretty-print a numpy.array without scientific notation and with given precision?

Hii @kartik, The numpy arrays have the method round(precision) which ...READ MORE

Apr 14, 2020 in Python by Niroj
• 82,800 points
3,898 views
0 votes
1 answer

How to make a flat list out of list of lists?

Hello @kartik, You can use itertools.chain(): import itertools list2d = [[1,2,3], ...READ MORE

Jun 5, 2020 in Python by Niroj
• 82,800 points
1,632 views
0 votes
1 answer

How do I integrate Ajax with Django applications?

Hello @kartik, You don't have to change your ...READ MORE

Jun 22, 2020 in Python by Niroj
• 82,800 points
870 views
0 votes
1 answer

Create a constant in Python?

No there is not. You cannot declare ...READ MORE

Aug 24, 2018 in Python by Priyaj
• 58,020 points
29,662 views
0 votes
1 answer

How to convert one list into generator?

Hi@akhtar, Say, you have one list A. Now convert ...READ MORE

Apr 23, 2020 in Python by MD
• 95,460 points
3,367 views
0 votes
1 answer

How to convert dictionary to JSON?

Hello @kartik, json.dumps() returns the JSON string representation of ...READ MORE

Apr 15, 2020 in Python by Niroj
• 82,800 points
3,712 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
25,747 views
0 votes
0 answers

How to do proper formatting of XML differences in dictionary using python 3.4.4

Need help in formatting the output. Please ...READ MORE

Jun 19, 2020 in Python by Abhinandan
• 120 points

edited Jun 19, 2020 by Abhinandan 927 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
16,088 views
0 votes
0 answers

hello world, somebody can help me to correct this error

for label, value in s.iteritems():     s.set_value(label, ...READ MORE

Jun 6, 2020 in Python by WELL
• 140 points
1,441 views
+1 vote
1 answer

How to save graph using matplotlib library?

Hi@akhtar, You can find one function called savefig ...READ MORE

May 21, 2020 in Python by MD
• 95,460 points
1,998 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
22,287 views
0 votes
0 answers

What does NameError: name 'withdrawal' is not defined mean ?

READ MORE

Jun 6, 2020 in Python by Shanice
• 120 points

recategorized Jun 8, 2020 by Gitika 1,359 views
+1 vote
3 answers

How to run the Python program forever?

you can also do the old fashioned ...READ MORE

Jun 10, 2019 in Python by brianno
23,618 views
0 votes
1 answer

How to send email via Django?

Hello @kartik, I use Gmail as my SMTP ...READ MORE

May 6, 2020 in Python by Niroj
• 82,800 points
2,553 views
0 votes
1 answer

Error:Pip install Matplotlib error with virtualenv

Hello @kartik, To generate graph in png format ...READ MORE

May 20, 2020 in Python by Niroj
• 82,800 points
1,943 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
30,736 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,190 points
7,221 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
16,988 views
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,800 points
3,341 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,730 points
3,251 views
0 votes
1 answer

How to print the full traceback without halting the program?

Hello @kartik, When you don't want to halt ...READ MORE

Jun 5, 2020 in Python by Niroj
• 82,800 points
1,056 views
0 votes
0 answers

for label, value in s.iteritems(): s.set_value(label, value+2) s.head()

READ MORE

Jun 6, 2020 in Python by WELL
• 140 points

recategorized Jun 8, 2020 by Gitika 1,021 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,800 points
2,501 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,800 points
1,300 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
13,334 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
3,367 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,730 points
3,422 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
4,819 views