Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
Use for data science questions related to the programming language Python. Not intended for general coding questions (which should be asked on Stack Overflow).
1
vote
How to combine dictionary of word-forms into a single list without duplicates
You can get a list of all possible words (including the nouns, verbs, adjectives and so on) by using a comprehension. This loops over all elements of a sequence, as with a for-loop, but can be faster. …
1
vote
Accepted
saving the images to a folder with custom filenames
Most of the code you provided doesn't do much to help your actual problem of renaming the files. I will just focus on tha tpart by showing you how to get the filenames you want.
You can rename the fi …
1
vote
Function of functions and theirs arguments
I would probably just pass a parameter for the distribution name and then a set of parameters in a Python dictionary. …
1
vote
Arima and Sarima in python
It seems you are passing the same parameters to both Python classes: ARIMAX and SARIMAX... and this should produce the same answer, I agree. …
1
vote
how to Iterate over column
I would suggest using a Pandas DataFrame (you didn't mention it in your question).
Then it would be as simple as the following
Create the dataframe from you list x, calling the single column x:
In …
0
votes
Accepted
How to extract data from an API every hour in Python?
Assuming that example is working for you, trying to write the data every 3 seconds, you need to just change the scheduling to be
schedule.every(1).hour.do(write_to_excel)
You are currently writing …
1
vote
How to split a large set of coordinates into smaller sets using something like nearby select...
Have a look into KD-Trees. They work by partitioning your space into discrete blocks, via a (wait for it...) tree. Here is the wikipedia example for a 3d space:
Each of the cuboids is represented b …
0
votes
calculating the precision and recall for a specific threshhold
Assuming you have the ground truth results y_true and also the corresponding model predictions y_pred, you can use SciKit-Learn's precision_recall_fscore_support.
from sklearn.metrics import precision …
0
votes
numpy array quirks: does A.T return a view?
You get a view of the matrix, with only the the axes transposed. So your B doesn't get transposed.
More nuances depend on the shape of your original array:
In [1]: import numpy as np
In [2]: np.nda …
4
votes
Accepted
Is there any package in python that can identify similarity between alphanumeric alias names...
If you know there are only specific variants, you can obviously make a look-up table yourself (i.e. a Python dictionary).
Otherwise you could try using a fuzzy matching library, like fuzzywuzzy. …
1
vote
Accepted
Why does storing the output of .count() result in all 1's or 0's?
Because on each loop you assign a single value to the entire column:
tots_df['orc_4_totals'] = s4 # entire column orc_4_totals = s4!
(the same thing for the other column.
It equals all ones the …
0
votes
Accepted
Making predictions from keras with SciKit
This seems about right.
You can use SciKit learn quite easily, as the predictions and test results you have should all be in NumPy arrays anyway. Take a look at the regression metrics. The metrics yo …
1
vote
Accepted
Aggregating small values in a frequency bar plot
Here is an example where I create a new row called Other, which contains the sum of all values below a given threshold.
I then remove the rows that were below that threshold (and so included in the s …
1
vote
out of memory error when consrtucting 2d list from 2 numpy arrays
I would recommend breaking the problem down a little bit to reduce the memory usage at any one time.
The first part of your main function gets the IDs using getIDList. That seems fine, so leave it th …
1
vote
resampling image takes a large amount of time
Here is a nice example tutorial if you're new to profiling in Python.
You can use cProfile, a built-in python module. … You can do this in the terminal quite simply (if your script is designed to be run that way) by running:
python -m cProfile -o profiling_results.prof your_script.py
In words (flags shown in bold): python …