Trending questions in Python

0 votes
1 answer

Python Pandas: strip blank spaces in string in Index?

Yes, you can string the blank spaces ...READ MORE

May 14, 2019 in Python by Raj
2,812 views
0 votes
1 answer

How to stop input in SublimeREPL?

You have to do ctrl+break or ctrl+space ...READ MORE

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

How to calculate cosine similarity between two lists using Pythong?

You should try SciPy. It has a bunch ...READ MORE

Dec 18, 2018 in Python by charlie_brown
• 7,720 points
9,173 views
0 votes
1 answer

Reconstruct an array by replacing every element with a[[i-1]%K] - Python

Hey varsha, Have a look at this ...READ MORE

Jun 14, 2019 in Python by Miya
1,435 views
0 votes
1 answer

Getting first row from sqlalchemy

Use  query.one() to get one result. In ...READ MORE

Feb 21, 2019 in Python by SDeb
• 13,300 points
6,310 views
0 votes
1 answer

Deleting elements from numpy array

Use the following code: import numpy as np a=np.array([1,2,3,4]) b=np.delete(a,2) OUTPUT: array([1, ...READ MORE

Jun 24, 2019 in Python by Fata
• 1,050 points

edited Jun 25, 2019 by Kalgi 994 views
+1 vote
1 answer

How is set() implemented?

Sets in Python can be created using ...READ MORE

Jul 1, 2019 in Python by anonymous
647 views
0 votes
1 answer

Why is Seaborn better than Mtaplotlib?

Factually, Matplotlib is good but Seaborn is ...READ MORE

Jul 3, 2019 in Python by Wajiha
• 1,960 points
602 views
0 votes
1 answer

Python code Tic Tac Toe game

You could use random.shuffle from random import shuffle players ...READ MORE

May 28, 2019 in Python by Idam
2,156 views
0 votes
2 answers

What is the difference between python lists and arrays?

Python arrays and lists have the same ...READ MORE

Jun 11, 2019 in Python by Nisa
• 1,090 points
1,610 views
0 votes
1 answer

how to use urllib module in python?

If you are using Python 3.x then ...READ MORE

Jun 28, 2019 in Python by Neel
• 3,020 points
793 views
0 votes
1 answer

Python error "AttributeError: incompatible shape for a non-contiguous array"

It is not always possible to change ...READ MORE

May 29, 2019 in Python by Imran
2,077 views
+1 vote
1 answer

Converting integers to strings

Yes you can convert integers to strings ...READ MORE

Jul 1, 2019 in Python by Nisa
• 1,090 points
612 views
0 votes
1 answer

Getting this error Error sqlite3.InterfaceError: Error binding parameter 0 - probably unsupported type

Found out that the problem was that ...READ MORE

Oct 1, 2018 in Python by Priyaj
• 58,020 points
12,451 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
2,282 views
0 votes
1 answer

Length and dimensions of NumPy arrays

The length of NumPy arrays can be ...READ MORE

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

Create an ec2 instance using boto

Hi @Neel, try this script: reservations = conn.get_all_instances(instance_ids=[sys.argv[1]]) instances ...READ MORE

Jun 24, 2019 in Python by Varsha
924 views
0 votes
0 answers

How to remove elements from a list that may or may not be present?

In case I want to remove some ...READ MORE

Jun 27, 2019 in Python by Nisa
• 1,090 points
810 views
0 votes
1 answer

Access the sole element of a set

Use set.pop: >>> {1}.pop() 1 >>> In your case, it would be: return ...READ MORE

Jun 28, 2019 in Python by SDeb
• 13,300 points
717 views
+1 vote
1 answer

Add Variables to Tuple

Use the following piece of code: ...READ MORE

Jul 4, 2019 in Python by Wajiha
• 1,960 points

edited Jul 5, 2019 by Kalgi 418 views
0 votes
0 answers

What is the use of cursor while querying a sqlite database?

I am completely new to sqlite, and ...READ MORE

Jul 4, 2019 in Python by Waseem
• 4,540 points
484 views
0 votes
1 answer

How to add new keys to an already created python dictionary?

my_dict = {'name':'Jack', 'age': 26} my_dict['address'] = 'Downtown' ...READ MORE

Jun 26, 2019 in Python by Neel
• 3,020 points
775 views
0 votes
1 answer

How to append a row to a Pandas dataframe?

You can use the append method provided by pandas ...READ MORE

May 9, 2019 in Python by Raj
2,830 views
0 votes
1 answer

Where is builtins module located?

The module is built-in to the python ...READ MORE

Jun 19, 2019 in Python by SDeb
• 13,300 points
1,066 views
0 votes
1 answer

'f' strings in Python

They are also known as Literal String ...READ MORE

Jun 25, 2019 in Python by Fata
• 1,050 points
796 views
0 votes
1 answer

How to count number of anchor tags got?

I had a similar requirement, this is ...READ MORE

Apr 2, 2019 in Python by Riya
4,407 views
0 votes
1 answer

How to convert string in Pandas Series to lower case?

Suppose you have the series stored in ...READ MORE

May 13, 2019 in Python by Raj
2,630 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 2,017 views
0 votes
1 answer

Is there a way to store a huge dataset as a dataframe using Pandas?

This can be easliy done by using ...READ MORE

Jun 22, 2019 in Python by Taj
• 1,080 points
919 views
0 votes
1 answer

Bash alias --> Python 2.7 to Python 3.3

Some linux utilities depend on python2.x currently. ...READ MORE

May 9, 2019 in Python by SDeb
• 13,300 points
2,772 views
0 votes
1 answer

Python: Sort list of lists numerically

You can try and De-dupe it with ...READ MORE

May 20, 2019 in Python by SDeb
• 13,300 points
2,288 views
0 votes
1 answer

Error: persisting 'ProgrammingError: column does not exist'

Something I like to try when my ...READ MORE

Sep 28, 2018 in Python by Priyaj
• 58,020 points
12,397 views
0 votes
1 answer

what are sockets?

Sockets are basically open and close gateways ...READ MORE

Jun 25, 2019 in Python by Fata
• 1,050 points
724 views
0 votes
2 answers

Do-while loop in Python

A more pythonic way would be this: ``` while ...READ MORE

Jul 6, 2020 in Python by Composer3
1,416 views
0 votes
1 answer

Snake head placed on the center - Python using turtle

You can use turtle's goto() function. This ...READ MORE

Jun 21, 2019 in Python by Greg
842 views
0 votes
1 answer

Python pygame error : Failed loading libpng.dylib: dlopen(libpng.dylib, 2): image not found

Try installing libpng You can do it with ...READ MORE

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

Why are Python lambdas useful?

The main purpose of anonymous functions come ...READ MORE

Jun 19, 2019 in Python by Wajiha
• 1,960 points
903 views
0 votes
1 answer

How do I run a set of code for all the requests in Flask?

Hi, You can use dedicated hooks(decorators) called before ...READ MORE

Jun 21, 2019 in Python by Shabnam
• 930 points
833 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,876 views
0 votes
1 answer

How to convert date string to date object in python?

Use this :-  >>> datetime.datetime.strptime('24052010', "%d%m%Y").date() datetime.date(2010, 5, 24) Hope ...READ MORE

Oct 22, 2018 in Python by Priyaj
• 58,020 points
11,258 views
0 votes
0 answers

How do you install Tkinter in python?

What is the basic function of Tkinter ...READ MORE

Jun 24, 2019 in Python by Waseem
• 4,540 points
689 views
0 votes
1 answer

How to get current time in Python?

Hi, You can use Datetime class. Input: import datetime datetime.datetime.now() Output: datetime.datetime(2019, 6, ...READ MORE

Jun 22, 2019 in Python by Taj
• 1,080 points
760 views
0 votes
1 answer

How to find count/length of dictionary values of list?

You should have used d.itervalues() instead and ...READ MORE

May 13, 2019 in Python by John
2,450 views
0 votes
1 answer

How do I trim the leading or trailing zeros from a 1d array in python?

Hey @Akki, you can use the numpy ...READ MORE

May 29, 2019 in Python by Wakir
1,748 views
0 votes
1 answer

Tkinter to android translation

Even for native purposes, most developers would ...READ MORE

May 22, 2019 in Python by SDeb
• 13,300 points
2,058 views
0 votes
1 answer

Create ESB Volume using python

You only have to use two simple ...READ MORE

Jun 24, 2019 in Python by Greg
617 views
0 votes
1 answer

How do I read a file on only read only mode in python?

Hey @David! TRy something like this: campaign_data = ...READ MORE

Jun 20, 2019 in Python by Jason
788 views
0 votes
1 answer

Python from Python: restricting functionality?

This doesn't seem like a good idea ...READ MORE

Jun 24, 2019 in Python by SDeb
• 13,300 points
608 views
0 votes
1 answer

How do I install pytype?

Installing pytype is very simple. Just execute ...READ MORE

Jun 7, 2019 in Python by Rakshi
1,327 views
0 votes
1 answer

How to get size of a list?

Hi, You can use built-in function "len" to ...READ MORE

Jun 21, 2019 in Python by Shabnam
• 930 points
748 views