Quantcast
Browsing all 13921 articles
Browse latest View live

How to export a CSV file with a header using python 2.7

I'm trying to figure out how to export the results of my script to a CSV file with python 2.7. The CSV file should contain two columns:The first column should contain the URL results and I would like...

View Article


CS50P Problem set Little Professor: Not understanding check50's errors [closed]

My program runs fine manually, but upon testing it with check50, it returns these specific errors:(https://i.stack.imgur.com/uBS0n.png)I have tried to figure out the problem for hours without any...

View Article


"unexpected indent" or "object has no attribute 'compile'" errors [duplicate]

I tried using this code from the Tensorflow basic regression tutorial:def build_model(): model = keras.Sequential([ keras.layers.Dense(64, activation=tf.nn.relu, input_shape=(train_data.shape[1],)),...

View Article

How to space out xticks in matplotlib, pyplot?

As you can see, the xticks are very crowded and cannot be read. How do I space them out better on matplotlib? Any tips? 1

View Article

python-shell on linux system indentation error [duplicate]

I am a newbie in python and using the python shell through a linux system. I enter the python shell by typing "python" at the command line. When i try to execute a for-loop from the python shell, the...

View Article


pipenv doesn't show progress bar when installing packages

When I try to install packages with pipenv, the progress bar doesn't show up. This is very important for me since I have a limited data connection and I need to know in advance the size of the packages...

View Article

How the parameter vector of zeroes works in tensorflow?

So, I'm following book on Tensorflow by Chris Mattman. It is pretty buggy and outdated, but I'm still trying to get into ML with it (there are interesting concepts further in the book)Here is the...

View Article

How to debug indentation errors in python [duplicate]

I am trying to write my very first python script. This was working but then after some slight refactoring I have, apparently, broken the indentation. I can not determine what is the problem. The...

View Article


Jupyter notebook prevent new cells from inheriting values from previous cells...

1st code block:import...

View Article


How to set the value of __file__ in an exec() body of code?

I'm using this python3 construct to exec a PY file that I read in.When the read file throws an exception, the reported location is wrong.Example: # create Globals Dict fn='foobar.py' g={ '__file__' :...

View Article

How to fix Python indentation

I have some Python code that have inconsistent indentation. There is a lot of mixture of tabs and spaces to make the matter even worse, and even space indentation is not preserved.The code works as...

View Article

Accessing HDFS Data with Optimized Locality

I am wondering, how to make sure HDFS data accessing makes the best use of the local replication to minimize the use of network transfer.I am hosting HDFS on 3 machines and replication is set to 3....

View Article

Why do indented explicit line continuations not allow comments in Python?

I'm writing a Python parser to learn Flex and Bison, and I'm trying to find out why only the first of these programs is valid Python.a.py:\# This is valid Pythonproduces no error.b.py: \# This is not...

View Article


Why the decimal points of query results are different when using different...

For the same query SQL statement running in Apache IoTDB, there is only one decimal point of the query result when executed by the CLI client of IoTDB and dbeaver. However, there are four decimal...

View Article

Show question/input in vscode jupyter notebook output

Is there any way to show input question in cell output while using vscode jupyter notebook?When I use Google Colab, there are question in the cell output. I want to know how to show question without...

View Article


How can I do a line break (line continuation) in Python (split up a long line...

Given:e = 'a'+'b'+'c'+'d'How do I write the above in two lines?e = 'a'+'b'+'c'+'d'

View Article

psycopg2 insert python dictionary as json

I want to insert a python dictionary as a json into my postgresql database (via python and psycopg2).I have:thedictionary = {'price money': '$1', 'name': 'Google', 'color': '', 'imgurl':...

View Article


Indent and comments in function in Python [duplicate]

I am using Python 2.7 and wrote the following:def arithmetic(A): x=1"""Some comments here""" if x=1: x=1 elif x=2: x=2 return 0But it has the indentation issue: if x=1: ^IndentationError: unexpected...

View Article

Image may be NSFW.
Clik here to view.

Python script to print data inside text box in a word file

I am trying to print the values inside tables and text boxes as seen in the attached sample:Using the code below, I am trying to get the values inside the text box, but I am not able to get it. My...

View Article

Scipy minimize with multiple linear constraints

I'm having an issue trying to implement an NLP using scipy, given a dynamic vector x and a static utility vector u, where I'm interested in minimizing a utility function of the form:utility_vector =...

View Article
Browsing all 13921 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>