Most answered questions in Python

0 votes
1 answer

Difference between %s and %d in python string formatting??

%s and %d are used for string ...READ MORE

May 28, 2019 in Python by Shabnam
• 930 points
2,986 views
0 votes
1 answer

What are the features of Python 3?

Python 3 offers rich functionality making it ...READ MORE

May 28, 2019 in Python by Harsh
• 260 points
918 views
0 votes
1 answer

py2exe windows service problem

Check that your setup.py file should contain: setup(service=["we ...READ MORE

May 28, 2019 in Python by SDeb
• 13,300 points
976 views
0 votes
1 answer

How can I deal with python eggs for multiple platforms in one location?

Try virtualenv : http://pypi.python.org/pypi/virtualenv This helps you create isolated ...READ MORE

May 28, 2019 in Python by SDeb
• 13,300 points
710 views
0 votes
1 answer

What to do when len() does not return the number of integers in range(1,100)?

You can use the following code block: x=range(1,100) len(x) Output: ...READ MORE

May 28, 2019 in Python by Fata
• 1,050 points
605 views
0 votes
1 answer

What to do when I get and error saying python not recognized as internal or external command?

You need to set up the path ...READ MORE

May 28, 2019 in Python by Fata
• 1,050 points
2,263 views
0 votes
1 answer

How do I check if a list is empty in python?

Hey @Vedant, that's pretty simple and straightforward: if ...READ MORE

May 28, 2019 in Python by Karthik
845 views
0 votes
1 answer

How to drop missing value in python data-frame?

Hi Sarada,  I understand you are having problems with ...READ MORE

May 28, 2019 in Python by sampriti
• 1,120 points
1,200 views
0 votes
1 answer

Is there a way to loop between 0 and 1 by 0.1 in python?

You can use the linespace function. It ...READ MORE

May 28, 2019 in Python by Olly
2,721 views
0 votes
1 answer

Error saying "TypeError: range() integer end argument expected"

Try this: [x * 0.01 for x in ...READ MORE

May 27, 2019 in Python by Keshav
1,089 views
0 votes
1 answer

What does the random.triangular(low, high, mode) function do in python?

It returns a random floating point number ...READ MORE

May 27, 2019 in Python by Vinod
938 views
0 votes
1 answer

How do I get a random number with a float range in python?

Use random.uniform(a, b): Returns a random floating point ...READ MORE

May 27, 2019 in Python by Kiran
762 views
0 votes
1 answer

How do I compute the cross spectral density of two signals?

Hey @Akash, if your just looking for ...READ MORE

May 27, 2019 in Python by Kavya
928 views
0 votes
1 answer

An example showing how to plot the coherence of two signals

This should work well: import numpy as np import ...READ MORE

May 27, 2019 in Python by anonymous

edited May 27, 2019 by Kalgi 1,743 views
0 votes
1 answer

How to use categorical variables in Matplotlib?

Many times you want to create a ...READ MORE

May 27, 2019 in Python by Lisha
1,339 views
0 votes
1 answer

Example code for creating broken barh graph using matplotlib

Try this, it should work well. import matplotlib.pyplot ...READ MORE

May 27, 2019 in Python by Himanshu
1,973 views
0 votes
1 answer

Example of creating horizontal bar chart using matplotlib

Try this: import matplotlib.pyplot as plt import numpy as ...READ MORE

May 27, 2019 in Python by Vaishnavi
1,669 views
0 votes
1 answer

Example showing a way to create a grouped bar chart with Matplotlib?

Have a look at this: import matplotlib import matplotlib.pyplot ...READ MORE

May 27, 2019 in Python by Bobin
2,877 views
0 votes
1 answer

example of creating a stacked bar plot with error bars using the bar function

Have a look at this: import numpy as ...READ MORE

May 27, 2019 in Python by Kunal
1,272 views
0 votes
1 answer

Python error "TypeError: range() integer end argument expected, got numpy.float64."

Hi @Kashish, try something like this: for i ...READ MORE

May 27, 2019 in Python by Harish
2,711 views
0 votes
1 answer

How to count the number of elements in a list?

To count the number of elements of ...READ MORE

May 27, 2019 in Python by Nisa
• 1,090 points
4,644 views
0 votes
1 answer

How to check if a list is empty in python? [closed]

To check if a list is empty ...READ MORE

May 27, 2019 in Python by Nisa
• 1,090 points
767 views
0 votes
1 answer

What are the different types of data types one can use in Python?

Python provides an array of built-in constants, ...READ MORE

May 28, 2019 in Python by Harsh
• 260 points
3,060 views
0 votes
1 answer

What are the best IDE/platform to write code in Python

Just as any other programming language, even ...READ MORE

May 28, 2019 in Python by Harsh
• 260 points
538 views
0 votes
1 answer

How do you convert two lists into a dictionary?

There are three different ways of converting ...READ MORE

May 27, 2019 in Python by Taj
• 1,080 points
17,623 views
0 votes
1 answer

What is timedelta in python?

It represents a duration which is basically ...READ MORE

Aug 7, 2019 in Python by Wajiha
• 1,950 points
573 views
0 votes
1 answer

Django Postgresql syncdb error

If you're trying to connect to a ...READ MORE

May 27, 2019 in Python by SDeb
• 13,300 points
1,227 views
0 votes
1 answer

Sphinx: local conf for a page?

As far as I know there's no ...READ MORE

May 27, 2019 in Python by SDeb
• 13,300 points
355 views
0 votes
1 answer

Problem in real time matplotlib plotting

Hi Sucheta, The error I can see in ...READ MORE

May 24, 2019 in Python by sampriti
• 1,120 points
1,159 views
0 votes
1 answer

How do I convert type of an array in python?

Use the following command to change the ...READ MORE

May 24, 2019 in Python by Kishore
850 views
0 votes
1 answer

assert keyword in python is used for what purpose?

The assert keyword is used while debugging ...READ MORE

May 24, 2019 in Python by Taj
• 1,080 points
3,487 views
0 votes
1 answer

Is it possible to create an array with all values as zero in python?

You can use  np.zeros(4,3) This will create a 4 ...READ MORE

May 24, 2019 in Python by Anjali
890 views
0 votes
1 answer

How do I create 3 X 4 array of random numbers between 0 and 100 using python?

Use numpy in the following manner: np.random.rand(3,4)*100 When you ...READ MORE

May 24, 2019 in Python by Radhika
1,941 views
0 votes
1 answer

Create 3*4 array of random numbers - Python

To create different arrays like random arrays:  np.random.rand(3,4) ...READ MORE

May 24, 2019 in Python by Umer
1,486 views
0 votes
1 answer

Save NumPy arrays to File

Try this: np.savetxt('file.txt',arr,delimiter=' ') will save to a text ...READ MORE

May 24, 2019 in Python by Jason
1,181 views
0 votes
1 answer

Convert csv file to NumPy array

Hi @Lina, you can use this: numpy_array = ...READ MORE

May 24, 2019 in Python by Puneet
17,610 views
0 votes
1 answer

How do I turn a list into numpy array?

Use this line: numpy_array = np.array(list) And printing/displaying the ...READ MORE

May 24, 2019 in Python by Isha
591 views
+1 vote
1 answer

How to comment multiple lines in Python?

Comments in Python begin with a # ...READ MORE

May 24, 2019 in Python by Nisa
• 180 points
906 views
0 votes
1 answer

How to install Python on Windows and set path variable?

Install python from this link https://www.python.org/downloads/ After ...READ MORE

May 24, 2019 in Python by anonymous
• 180 points
2,484 views
0 votes
1 answer

python dynamic class names

You can try the following code: classmap = ...READ MORE

May 23, 2019 in Python by ana1504.k
• 7,910 points
989 views
+1 vote
1 answer

ssh first with mysqldb in python

Setup an ssh tunnel before you use ...READ MORE

May 23, 2019 in Python by ana1504.k
• 7,910 points
2,586 views
0 votes
1 answer

Write lambda function - python

Lambda equivalent for this section of python ...READ MORE

May 23, 2019 in Python by Umer
443 views
0 votes
1 answer

Map function with example in python

The map function executes the function_object for each ...READ MORE

May 23, 2019 in Python by Imran
703 views
0 votes
1 answer

Convert python code into lambda function

This should work: add = lambda x, y ...READ MORE

May 23, 2019 in Python by Payal
6,917 views
0 votes
1 answer

How can you use a single insert statement into three tables from three different classes in python

you can use executescript() method : This is ...READ MORE

May 23, 2019 in Python by Mihir
396 views
0 votes
1 answer

Python script if-else statement doubt

The reason for this is that the else loop ...READ MORE

May 23, 2019 in Python by Rajan
826 views
0 votes
1 answer

Python: Doubt regarding private access specifier

In Python, you don't write to other ...READ MORE

May 23, 2019 in Python by Jagan
534 views
0 votes
1 answer

How can I use the sleep function in a python program?

You can use sleep as below. import time print(" ...READ MORE

Jun 10, 2020 in Python by anonymous
796 views
0 votes
1 answer

PEP8 E226 recommendation

The maintainers of the PEP8 tool decide ...READ MORE

May 23, 2019 in Python by SDeb
• 13,300 points
505 views
0 votes
1 answer

X and Y or Z - ternary operator

According to the docs: The expression x and ...READ MORE

May 23, 2019 in Python by SDeb
• 13,300 points
1,436 views