text stringlengths 226 34.5k |
|---|
java script html element scrape using a scrapy on phython 2.7.11 i get like these
Question:
[root@Imx8 craigslist_sample]# scrapy crawl spider
/root/Python-2.7.11/craigslist_sample/craigslist_sample/spiders/test.py:1: ScrapyDeprecationWarning: Module `scrapy.spider` is deprecated, use `scrapy.spiders` instead
... |
Django AppsNotLoaded
Question: I'm trying to make a python script to put some things in my database;
from django.conf import settings
settings.configure()
import django.db
from models import Hero #Does not work..?
heroes = [name for name in open('hero_names.txt').readlines()]
... |
large data transformation in python
Question: I have a large data set (ten 12gb csv files) that have 25 columns and would
want to transform it to a dataset with 6 columns. the first 3 columns remains
the same whereas the 4th one would be the variable names and the rest contains
data. Below is my input:
#... |
MAGICS - undefined symbol: _ZTIN5eckit9ExceptionE
Question: I'm stuck on a runtime error "undefined symbol: _ZTIN5eckit9ExceptionE" like
this
Start 2: basic_python
2: Test command: /usr/local/Python/2.7.10/bin/python "coast.py"
2: Environment variables:
2: PYTHONPATH=/opt/src/ecmwf/Magics-2... |
How to use a dict to subset a DataFrame?
Question: Say, I have given a DataFrame with most of the columns being categorical data.
> data.head()
age risk sex smoking
0 28 no male no
1 58 no female no
2 27 no male yes
3 26 no male no
4 ... |
Is there a way to use itertools in python to clean up nested iterations?
Question: Let's say I have the following code:
a = [1,2,3]
b = [2,4,6]
c = [3,5,7]
for i in a:
for j in b:
for k in c:
print i * j * k
Is there a way I can consolidate an iterator in on... |
imgurpython.helpers.error.ImgurClientRateLimitError: Rate-limit exceeded
Question: I have the following error:
/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL a... |
Minimize memory overhead in sparse matrix inverse
Question: As pretense, I am continuing development in Python 2.7 from a prior question:
[Determining a sparse matrix
quotient](http://stackoverflow.com/questions/40050947/determining-a-sparse-
matrix-quotient)
## My existing code:
import scipy.sparse as ... |
Python: Pandas, dealing with spaced column names
Question: If I have multiple text files that I need to parse that look like so, but can
vary in terms of column names, and the length of the hashtags above:

How would I go about turning this into a pandas da... |
Why additional memory allocation makes multithread Python application work few times faster?
Question: I'm writing python module which one of the functions is to check multiple IP
addresses if they're active and write this information to database. As those
are I/O bound operations I decided to work on multiple threads:... |
Python SQLite TypeError
Question:
from sqlite3 import *
def insert_record(Who, Invented):
connection = connect(database = "activity.db")
internet = connection.cursor()
list = "INSERT INTO Information VALUES((Alexander_Graham, Phone))"
internet.execute(li... |
Getting HTTP POST Error : {"reason":null,"error":"Request JSON object for insert cannot be null."}
Question: I am getting HTTP POST error when I am trying to connect to a Service Now
Instance for Change Request Automation using Python. Here is the script I am
using with Python 3.4.4
# SNOW CR AUTOMATION ... |
Error in inserting python variable in mysql table
Question: I am working on a raspberry pi project, in which I'm fetching data from plc
and storing it into mysql database.
Here is my code:
import minimalmodbus
import serial
import mysql.connector
instrument = minimalmodbus.Instrume... |
understanding marshmallow nested schema with list data
Question: Am new to python and am usign
[marshmallow](https://marshmallow.readthedocs.io/en/latest/) serialization.
unable to use the nested scehma. , my code
from sqlalchemy import Column, Float, Integer, String, Text, text,ForeignKey
from sqlal... |
NetworkX: how to properly create a dictionary of edge lengths?
Question: Say I have a regular grid network made of `10x10` nodes which I create like
this:
import networkx as nx
from pylab import *
import matplotlib.pyplot as plt
%pylab inline
ncols=10
N=10 #Nodes per side
... |
Why df[[2,3,4]][2:4] works and df[[2:4]][2:4] does not in Python
Question: suppose we have a datarame
import pandas as pd
df = pd.read_csv('...')
df
0 1 2 3 4
0 1 2 3 4 5
1 1 2 3 4 5
2 1 2 3 4 5
3 1 2 3 4 5
4 1 2 3 4 5
Why one approach is working and other returns ... |
Running the sample code in pytesseract
Question: I am running python 2.6.6 and want to install the
[pytesseract](https://pypi.python.org/pypi/pytesseract) package. After
extraction and installation, I can call the pytesseract from the command line.
However I want to run the tesseract within python. I have the following... |
Python cprofiler a function
Question: How to profile one function with cprofiler?
label = process_one(signature)
become
import cProfile
label = cProfile.run(process_one(signature))
but it didn't work :/
Answer: according to documentation (<https://docs.python.org/2/l... |
Reading files with hdfs3 fails
Question: I am trying to read a file on HDFS with Python using the hdfs3 module.
import hdfs3
hdfs = hdfs3.HDFileSystem(host='xxx.xxx.com', port=12345)
hdfs.ls('/projects/samplecsv/part-r-00000')
This produces
[{'block_size': 134345348,
'g... |
find repeated element in list of list python
Question: I have been struggling with this problem for two days and I need help with it.
I need to find repeated element in a list of lists `list_of_list = [(a1, b1,
c1), (a2, b2, c2), ..., (an, bn, cn)]` where "a" and "b" elements are integers
and "c" elements are floats.
... |
Python/Flask: UnicodeDecodeError/ UnicodeEncodeError: 'ascii' codec can't decode/encode
Question: Sorry for the millionth question about this, but I've read so much about the
topic and still don't get this error fixed (newbie to all of this). I'm trying
to display the content of a postgres table on a website with flask... |
Identify drive letter of USB composite device using Python
Question: I have a USB composite device that has an SD card. Using Python, I need a way
to find the drive letter of the SD card when the device is connected. Does
anyone have experience with this? Initially it needs to work in Windows, but
I'll eventually need ... |
Convert .fbx to .obj with Python FBX SDK
Question: I have a ten frame .fbx file of an animal walking. This file includes a rigged
model with textures, but I am only interested in the mesh of the model at each
frame.
How can I use Python FBX SDK or Python Blender SDK to export each frame of the
fbx file into an obj fil... |
How to tell Python to save files in this folder?
Question: I am new to Python and have been assigned the task to clean up the files in
Slack. I have to backup the files and save them to the designated folder Z
drive Slack Files and I am using the open syntax below but it is producing the
permission denied error for it.... |
Ipython cv2.imwrite() not saving image
Question: I have written a code in python opencv. I am trying to write the processed
image back to disk but the image is not getting saved and it is not showing
any error(runtime and compilation) The code is
"""
Created on Wed Oct 19 18:07:34 2016
@auth... |
how do i find my ipv4 using python?
Question: my server copy it if you want! :) how do i find my ipv4 using python? can i
you try to keep it real short?
import socket
def Main():
host = '127.0.0.1'
port = 5000
s = socket.socket()
s.bind((host,port))
... |
Drawing on python and pycharm
Question: I am a beginner on Python. I draw a square with this code.
import turtle
square=turtle.Turtle()
print(square)
for i in range(4):
square.fd(100)
square.lt(90)
turtle.mainloop()
However, there is another code for drawing square w... |
Work with a row in a pandas dataframe without incurring chain indexing (not coping just indexing)
Question: My data is organized in a dataframe:
import pandas as pd
import numpy as np
data = {'Col1' : [4,5,6,7], 'Col2' : [10,20,30,40], 'Col3' : [100,50,-30,-50], 'Col4' : ['AAA', 'BBB', 'AAA'... |
'DataFrame' object is not callable
Question: I'm trying to create a heatmap using Python on Pycharms. I've this code:
import numpy as np
import pandas as pd
import matplotlib
matplotlib.use('agg')
import matplotlib.pyplot as plt
data1 = pd.read_csv(FILE")
freqMap = {}
... |
Reformat JSON file?
Question: I have two JSON files.
File A:
"features": [
{
"attributes": {
"NAME": "R T CO",
"LTYPE": 64,
"QUAD15M": "279933",
"OBJECTID": 225,
"SHAPE.LEN": 828.21510830520401
},
"geometry": {
"paths": [
... |
How to execute multiline python code from a bash script?
Question: I need to extend a shell script (bash). As I am much more familiar with python
I want to do this by writing some lines of python code which depends on
variables from the shell script. Adding an extra python file is not an option.
result=`... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.