Unnamed: 0 int64 0 378k | id int64 49.9k 73.8M | title stringlengths 15 150 | question stringlengths 37 64.2k | answer stringlengths 37 44.1k | tags stringlengths 5 106 | score int64 -10 5.87k |
|---|---|---|---|---|---|---|
2,100 | 41,539,658 | Tensorflow error when I try to use tf.contrib.layers.convolution2d | <p>When I invoke tf.contrib.layers.convolution2d the tensorflow execution terminates with an error about one of the parameters used</p>
<pre><code>got an unexpected keyword argument 'weight_init'
</code></pre>
<p>The parameter passed are the follows:</p>
<pre><code>layer_one = tf.contrib.layers.convolution2d(
fl... | <p>The book that you are reading (You didn't mention which one) might be using an older version of TensorFlow when the initial values for the weight tensor was passed through the <code>weight_init</code> argument. In the TensorFlow library version you are using (You didn't mention your TF version), probably that argume... | tensorflow|deep-learning|convolution | 3 |
2,101 | 61,598,173 | Datetime error in combining date and time dataframe objects | <p>I have an issue with Python when I want to merge two data columns into one DateTime object. The initial dates column is in string format and hours are integers (1, 2, 3, ....,23, 24) and a new day starts with 1 again (not with 24).
I use the command <code>smartmeter_data['Datetime']=pd.to_datetime(smartmeter_data['D... | <p>A day has 24 hours so if you add a timedelta of 24 hours to a date, the date will change to the next day. However, why don't you just subtract 1 to get the correct timedelta (0-23 instead of 1-24)? E.g.</p>
<pre><code>import pandas as pd
smartmeter_data = pd.DataFrame({'Date': ['01/09/2019', '01/09/2019', '01/09/2... | python|pandas|dataframe|datetime | 0 |
2,102 | 68,707,680 | How to automatically judge whether the training process of the deep learning model is converged? | <p>When training a deep learning model, I have to look at the loss curve and performance curve to judge whether the training process of the deep learning model is converged.</p>
<p>This has cost me a lot of time. Sometimes, the time of convergence judged by the naked eye is not accurate.</p>
<p>Therefore, I'd like to k... | <p>To the risk of disappointing you, I believe there is no such universal algorithm. In my experience, it depends on what you want to achieve, which metrics are important to you and how much time you are willing to let the training go on for.</p>
<ul>
<li><p>I have already seen validation losses dramatically go up (a s... | tensorflow|deep-learning|pytorch | 3 |
2,103 | 68,682,003 | How can I return a list with only up to the second decimal place python? | <p>I have the following list of values:</p>
<pre><code> value_list=[2.5655665, 3.151498745, 3.1, 0.9999999999]
</code></pre>
<p>I need to update this list keeping only to the second decimal place. I would like the result to be:</p>
<pre><code> print(value_list)
[2.56, 3.15, 3.1, 0.99]
</code></pre>
<p>... | <p>You can use map and apply whatever function you see fit:</p>
<pre><code>value_list=[2.5655665, 3.151498745, 3.1, 0.9999999999]
value_rounded = list(map(lambda x: float(format(x, '.2f')), value_list))
value_truncated = list(map(lambda x: float(str(x)[:str(x).index('.')+3]), value_list))
print(value_rounded)
print(val... | python|list|numpy | 1 |
2,104 | 36,480,100 | pandas query single output | <p>I have a pandas dataframe (called smalls) that is repurposed several times to create several network diagrams from a dataset. I am trying to set the color of the nodes in one of the diagrams based on entity type and need to query the original dataframe. However, when I do so it results in a series, which I then ca... | <p>I think you can use <a href="http://pandas.pydata.org/pandas-docs/stable/generated/pandas.Series.iloc.html" rel="nofollow"><code>iloc</code></a> or <a href="http://pandas.pydata.org/pandas-docs/stable/generated/pandas.Series.iat.html" rel="nofollow"><code>iat</code></a>:</p>
<pre><code>temp=smalls.Role[smalls.Entit... | python|python-3.x|pandas|dataframe | 1 |
2,105 | 36,271,186 | Partially argsort a 2D array in Python | <p>I have a KNN, and I need to partially <strong>argsort</strong> a list. </p>
<p>Here is how it works right now in code: </p>
<pre><code>sorted_distance_indices = distances.argsort(axis=1)[:,:self.parameters['k']+1]
kplus_1_nearest_classes = self.trainingY[sorted_distance_indices]
...etc.
</code></pre>
<p>I found... | <p>I think I've got the answer. </p>
<p>Running: </p>
<pre><code>sorted_distance_indices = np.argpartition(distances,self.parameters['k']+1,axis=1)[:,:self.parameters['k']+1]
</code></pre>
<p>Gets the job done. Open for a faster way. </p> | python|numpy|heap|heapsort | 2 |
2,106 | 53,330,407 | Combine SIMILAR value rows using Python Pandas | <p>Suppose I have the following Dataframe-</p>
<pre><code>company money
jack & jill, Boston, MA 02215 51
jack & jill, MA 02215 49
</code></pre>
<p>Now, I know that these 2 rows mean the same company, so I want to merge them and also sum the money-</p>
<pre><cod... | <p>If you have same pattern in <code>company</code> column i.e. the value before the 1st comma is company name. You can use something like below:</p>
<pre><code>df = pd.DataFrame({'company':['jack & jill, Boston, MA 02215','jack & jill, MA 02215','Google, New Jersey', 'Google'],
'money':[51... | python-3.x|pandas|dataframe|data-science | 0 |
2,107 | 65,823,701 | Is there a way to import compare_ssim for python IDLE? | <p>I tried running the python code in IDLE to import compare_ssim with this command line,</p>
<p>from skimage.measure import compare_ssim: <a href="https://i.stack.imgur.com/MJbdX.jpg" rel="nofollow noreferrer">code for importing compare_ssim</a></p>
<pre><code>from keras.layers import Input, Dense
from keras.models im... | <p>As per - <a href="https://github.com/scikit-image/scikit-image/blob/b38fd6f02917db2965f5faf2e6e18fc197b8d6c8/skimage/metrics/_structural_similarity.py#L17" rel="nofollow noreferrer">https://github.com/scikit-image/scikit-image/blob/b38fd6f02917db2965f5faf2e6e18fc197b8d6c8/skimage/metrics/_structural_similarity.py#L1... | python|python-3.x|tensorflow|keras|tf.keras | 3 |
2,108 | 65,790,561 | clean dataset nulls, etc cannot astype a datetimelike from [datetime64[ns]] to [float64] Tags | <p>I have the following function</p>
<pre><code>def clean_dataset(df):
assert isinstance(df, pd.DataFrame), "df needs to be a pd.DataFrame"
df.dropna(inplace=True)
indices_to_keep = ~df.isin([np.nan, np.inf, -np.inf]).any(1)
return df[indices_to_keep].astype(np.float64)
</code></pre>
<p>Howeve... | <p>I got this problem in the past. The solution is to convert to string first:</p>
<pre><code>return df[indices_to_keep].astype(str).astype(np.float64)
</code></pre> | python|python-3.x|pandas|dataframe | 1 |
2,109 | 3,209,362 | How to plot empirical cdf (ecdf) | <p>How can I plot the empirical CDF of an array of numbers in matplotlib in Python? I'm looking for the cdf analog of pylab's "hist" function.</p>
<p>One thing I can think of is:</p>
<pre><code>from scipy.stats import cumfreq
a = array([...]) # my array of numbers
num_bins = 20
b = cumfreq(a, num_bins)
plt.... | <p>If you like <code>linspace</code> and prefer one-liners, you can do:</p>
<pre><code>plt.plot(np.sort(a), np.linspace(0, 1, len(a), endpoint=False))
</code></pre>
<p>Given my tastes, I almost always do:</p>
<pre><code># a is the data array
x = np.sort(a)
y = np.arange(len(x))/float(len(x))
plt.plot(x, y)
</code></pre... | python|numpy|statistics|matplotlib|scipy | 122 |
2,110 | 63,374,903 | Get all integer values between two set of arrays | <p>I have two set of numpy.arrays like for example:</p>
<pre><code>a = np.array([10, 25, 36, 56, 78], dtype=int)
b = np.array([15, 32, 45, 64, 89], dtype=int)
</code></pre>
<p>They represent the upper and lower limits of indices for some other dataset.
So, I want a pythonic way to get all values between a pair of eleme... | <p>Shortest way of doing this using list comprehension:</p>
<pre><code>[np.arange(x, y + 1) for x, y in zip(a, b)]
</code></pre> | python|arrays|numpy | 4 |
2,111 | 63,694,539 | Checking for Specific Value in a Pandas Column and performing further operation | <p>I have a pandas DataFrame, which has a column named <code>is_retweeted</code>. The values in this column are either <code>Yes</code> or <code>No</code>. If, the value is 'Yes', I want to go ahead performing X type sentiment analysis (the code for which I have). Else-if value is <code>No</code>, I want to go ahead pe... | <p>I think you can do it with np.where:</p>
<pre><code>import pandas as pd
import numpy as np
def SentimentX(text):
#your SentimentX code
return f"SentimentX_result of {text}"
def SentimentY(text):
#your SentimentY code
return f"SentimentY_result of {text}"
data={"date"... | python|pandas|numpy|csv|data-science | 0 |
2,112 | 24,788,732 | Finding unique columns in an HDF5 dataset | <p>I'm using <code>HDF5</code> to store very large data sets of <code>uint8s</code> (400 x 121000000). There is a huge amount of redundancy in the columns (97% of the columns are not unique). I need to merge duplicate columns efficiently. This means that I need to remove duplicate columns, while storing metadata to rem... | <p>I did some profiling with <a href="https://pythonhosted.org/line_profiler/" rel="nofollow">kernprof</a> and optimized my code. </p>
<ul>
<li><p>The biggest bottleneck was the instantiation of HashableNDArray objects. I found that by making the numpy arrays read-only, I could hash their data buffer without having to... | python|c++|numpy|hdf5|h5py | 3 |
2,113 | 30,167,822 | group-by + case when Equivalent | <p>Want to select:</p>
<pre><code>select
user_id,
max(case when value > 0 then timestamp else 0 end) as max_timestamp_when_value_is_positive
from df
group by user_id
</code></pre>
<p>What is the right way to aggregate?</p>
<pre><code>groupped = raw_data.groupby('user_id')
res = groupped.agg({<how-to-do... | <p>Create a new column <code>positive_value_timestamp</code> as</p>
<pre><code>df['positive_value_timestamp'] = df.timestamp * df.value.apply(lambda x: 1 if x > 0 else 0)
</code></pre>
<p>When grouping, take the <code>max</code> of this column</p>
<pre><code>res = df.groupby('user_id').agg(
{
'timesta... | python|pandas|group-by|dataframe | 4 |
2,114 | 29,971,075 | Count number of non-NaN entries in every column of Dataframe | <p>I have a really big DataFrame and I was wondering if there was short (one or two liner) way to get the a count of non-NaN entries in a DataFrame. I don't want to do this one column at a time as I have close to 1000 columns. </p>
<pre><code>df1 = pd.DataFrame([(1,2,None),(None,4,None),(5,None,7),(5,None,None)],
... | <p>The <a href="http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.count.html"><code>count()</code></a> method returns the number of non-<code>NaN</code> values in each column:</p>
<pre><code>>>> df1.count()
a 3
b 2
d 1
dtype: int64
</code></pre>
<p>Similarly, <code>count(axis=1)... | python|pandas|dataframe|count|nan | 187 |
2,115 | 17,633,377 | Merging two columns in a DataFrame while preserving first column values | <p>Here is an example DataFrame:</p>
<pre><code>In [308]: df
Out[308]:
A B
0 1 1
1 1 2
2 2 3
3 2 4
4 3 5
5 3 6
</code></pre>
<p>I want to merge A and B while keeping order, indexing and duplicates in A intact. At the same time, I only want to get values from B that are not in A so the resulting DataF... | <p>To get those elements of B not in A, use the <a href="http://pandas.pydata.org/pandas-docs/stable/generated/pandas.Series.isin.html" rel="nofollow"><code>isin</code></a> method with the <code>~</code> invert (not) operator:</p>
<pre><code>In [11]: B_notin_A = df['B'][~df['B'].isin(df['A'])]
In [12]: B_notin_A
Out[... | python|pandas | 0 |
2,116 | 15,711,019 | How to detect if a 2D array is inside another 2D array? | <p>So with the help of a stack-overflow member, I have the following code:</p>
<pre><code>data = "needle's (which is a png image) base64 code goes here"
decoded = data.decode('base64')
f = cStringIO.StringIO(decoded)
image = Image.open(f)
needle = image.load()
while True:
screenshot = ImageGrab.grab()
haystac... | <p>To convert the image into a numpy array, you should be able to simply do this:</p>
<pre><code>import numpy as np
from PIL import Image
needle = Image.open('needle.png')
haystack = Image.open('haystack.jpg')
needle = np.asarray(needle)
haystack = np.asarray(haystack)
</code></pre>
<p>To get you started with findi... | python|python-2.7|numpy|scipy|detection | 3 |
2,117 | 15,618,976 | Trying to use replace method with pandas | <p>I am trying to do a simple replace with pandas:</p>
<pre><code>from pandas import *
In [2]: df = DataFrame({1: [2,3,4], 2: [3,4,5]})
In [4]: df[2]
Out[4]:
0 3
1 4
2 5
Name: 2
In [5]: df[2].replace(4, 17)
---------------------------------------------------------------------------
AttributeError ... | <p>The <a href="http://pandas.pydata.org/pandas-docs/stable/generated/pandas.Series.replace.html" rel="nofollow"><code>replace</code></a> method was added in version 0.9.0 (see <a href="http://pandas.pydata.org/pandas-docs/version/0.9.0/whatsnew.html#other-new-features" rel="nofollow">release notes</a>).</p>
<p><em>No... | python|replace|pandas | 3 |
2,118 | 71,911,437 | Efficient way to get the N largest values of a column | <p>I need to get the <code>w highest</code> values of a <code>column</code> groupying by Country.</p>
<p>The code below is working:</p>
<pre><code>w = 100
df.groupby('country').apply(lambda x: x.sort_values('x', ascending=False).head(w)
</code></pre>
<p>Is there a way to make this code more efficient? My dataset is hu... | <p>You can try <a href="https://pandas.pydata.org/docs/reference/api/pandas.core.groupby.SeriesGroupBy.nlargest.html" rel="nofollow noreferrer"><code>pandas.core.groupby.SeriesGroupBy.nlargest</code></a></p>
<pre class="lang-py prettyprint-override"><code>w = 100
df.groupby('country').nlargest(w)
</code></pre>
<p>Accor... | python-3.x|pandas|jupyter-notebook | 1 |
2,119 | 71,962,543 | Python: Convert JSON from df column into individual df columns | <p>I have an excel file that looks something like this:</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th>Header1</th>
<th>Header2</th>
<th>Header3</th>
</tr>
</thead>
<tbody>
<tr>
<td>data</td>
<td>data</td>
<td>[{"key1":"123","key2":"Value1"},{"k... | <p>You can't normalize it because it's loaded as string from Excel. Try this:</p>
<pre class="lang-py prettyprint-override"><code>import json
s = df["JSON"].apply(json.loads).explode()
tmp = (
pd.DataFrame(s.to_list(), index=s.index)
.set_index("card", append=True)
.unstack()
)
tmp.colu... | python|json|pandas | 1 |
2,120 | 71,826,557 | Compare two rows on a loop for on Pandas | <p>I have the following dataframe where I want to determinate if the column A is greater than column B and if column C is greater of column B. In case it is smaller, I want to change that value for 0.</p>
<pre><code>d = {'A': [6, 8, 10, 1, 3], 'B': [4, 9, 12, 0, 2], 'C': [3, 14, 11, 4, 9] }
df = pd.DataFrame(data=d)
df... | <p>To use a vectorial approach, you cannot simply use a diff as the condition depends on the previous value being replaced or not by 0. Thus two consecutive diff cannot happen.</p>
<p>You can achieve a correct vectorial replacement using a shifted mask:</p>
<pre><code>m1 = df.diff(axis=1).lt(0) # check if... | python|pandas | 1 |
2,121 | 72,040,940 | Removing outliers in a df containing mixed dtype | <p>I am working on a pandas DataFrame containing numerical columns as well as string columns (dtype is <code>object</code>), and would like to remove the rows containing outliers with respect to the distributions within a column. In other words, detect the outliers in each column and drop the corresponding rows.</p>
<p... | <p>I would break the problem into stages:</p>
<p>Firstly, identify (numeric) columns you want to do the outlier removal.
<a href="https://stackoverflow.com/questions/25039626/how-do-i-find-numeric-columns-in-pandas">Reference</a></p>
<pre class="lang-py prettyprint-override"><code>newdf = df.select_dtypes(include=np.nu... | python|pandas|dataframe|dtype | 2 |
2,122 | 16,856,470 | Is there a MATLAB accumarray equivalent in numpy? | <p>I'm looking for a fast solution to MATLAB's <a href="http://www.mathworks.com/help/matlab/ref/accumarray.html" rel="noreferrer"><code>accumarray</code></a> in numpy. The <code>accumarray</code> accumulates the elements of an array which belong to the same index. An example:</p>
<pre><code>a = np.arange(1,11)
# arra... | <p>Use <a href="http://docs.scipy.org/doc/numpy/reference/generated/numpy.bincount.html"><code>np.bincount</code></a> with the <code>weights</code> optional argument. In your example you would do:</p>
<pre><code>np.bincount(accmap, weights=a)
</code></pre> | python|numpy|accumulator | 21 |
2,123 | 19,035,736 | python ncreduce for windows | <p>I'm doing astronomical image processing using python, and numpy.std(a) is consuming way too much memory. Some searching turns up the ncreduce package by Luis Pedro, but I'm having difficulty building my download of the package form <a href="https://pypi.python.org/pypi/ncreduce/0.2" rel="nofollow">here</a>. <a href=... | <p>The package requires a few small changes to build with msvc. It is quite old and there are no tests so use at your own risk.</p>
<pre><code>--- ncreduce/reduce.cpp Thu Aug 14 13:02:50 2008
+++ ncreduce/reduce.cpp Thu Sep 26 11:56:04 2013
@@ -6,6 +6,7 @@
#include <iterator>
#include <vector>
#include ... | c++|python|numpy | 3 |
2,124 | 22,213,576 | how to optimize the performance of pandas retrieving stock quotes from yahoo feed | <p>my code is about looping 1200+ nos of stock symbols and retrieve the historical quotes (160~200 days)from yahoo feed. as it takes time, i stored the quotes in csv, just make it to download the quotes for the time delta, i.e. any quotes for the date differences or any quote csv files are missing... i used the pandas ... | <p>Pandas uses _get_hist_yahoo to get your data in pandas/io/data.py, like below:</p>
<pre><code>def _get_hist_yahoo(sym, start, end, retry_count, pause):
"""
Get historical data for the given name from yahoo.
Date format is datetime
Returns a DataFrame.
"""
start, end = _sanitize_dates(start, end)
url = (_HISTORICAL... | python|pandas | 0 |
2,125 | 22,398,266 | Compound word Pattern detection using pandas for large datasets | <p>Lets say I have two list of words one that follows the other. They are connected by a space or dash. To make it simple they will be the same words:</p>
<pre><code>First=['Derp','Foo','Bar','Python','Monte','Snake']
Second=['Derp','Foo','Bar','Python','Monte','Snake']
</code></pre>
<p>So the following combinations... | <p>I don't think it's too hard to generate those regexes from the combination matrix you've got:</p>
<pre><code># Reading in your combination matrix:
pattern_mat = pd.read_clipboard()
# Map from first words to following words:
w2_dict = {}
for w1, row in pattern_mat.iterrows():
w2_dict[w1] = list(row.loc[row == 'Y... | python|pandas|pattern-matching|iteration | 1 |
2,126 | 22,119,877 | Need help thinking through splitting lists at integer divisions in Python | <p>I currently have a dataset as a list of lists which I'd like to split at integer divisions, and insert new data if there is overlap. For example:</p>
<p>edit:The data set is always ordered ascendingly.</p>
<pre><code>data = [[1.565888, 2.073744], [2.073744, 2.962492], [2.962492, 4.52838], [4.52838, 5.417127], [5.4... | <h2>Update</h2>
<p>This isn't as clean looking, but now all integer pairs are output, even if they aren't in the original data. On the other hand, now it's implemented with a recursive generator, which I think is kinda slick :)</p>
<hr>
<p>This might do what you want. <code>int_split</code> is a generator which scan... | python|list|numpy|insert|split | 0 |
2,127 | 8,638,156 | How to add differently shaped numpy arrays? | <p>I have 2 numpy arrays.
One is a 2*2 array.</p>
<pre><code>a = [[1,2],[3,4]]
</code></pre>
<p>The other is a 2*2*4 array.</p>
<pre><code>b = [[[0,0,0,0],[0,0,0,0]],[[0,0,0,0],[0,0,0,0]]]
</code></pre>
<p>I want to add them so that I have a 2*2*4 array, c.</p>
<pre><code>c = [[[1,0,0,0],[2,0,0,0]],[[3,0,0,0],[4,0... | <p>Not sure whether you can do the sum in one single steps. Here it is in two steps:</p>
<pre><code>c = b.copy()
c[...,0] += a
</code></pre> | python|multidimensional-array|numpy | 0 |
2,128 | 8,685,994 | Python, hstack column numpy arrays (column vectors) of different types | <p>I currently have a numpy multi-dimensional array (of type float) and a numpy column array (of type int). I want to combine the two into a mutli-dimensional numpy array. </p>
<pre><code>import numpy
>> dates.shape
(1251,)
>> data.shape
(1251,10)
>> test = numpy.hstack((dates, data))
ValueError: ... | <pre><code>import numpy as np
np.column_stack((dates, data))
</code></pre>
<p>The types are cast automatically to the most precise, so your int array will be converted to float.</p> | python|numpy | 11 |
2,129 | 55,287,289 | Modifying a tensorflow graph to output an intermediate value, after training | <p>I'm really new to TF, and so this is my disclaimer that what I'm asking might not make much sense. I'd appreciate any corrections to my understanding. I'm happy to provide more code / information if necessary.</p>
<p>I'm working from the following tutorial: <a href="https://www.oreilly.com/learning/perform-sentimen... | <p>The argument of <code>sess.run</code> is always a reference to a node on the graph (i.e. what you have provided an image of). </p>
<p>Tensorflow is written such that it only needs the values of upstream values in order to compute the value at some node--not <em>all</em> possible inputs. Your question appears to be ... | tensorflow|tensorboard | 1 |
2,130 | 55,336,944 | How to add a list to new column in pandas? | <p>I would like to add a new column with lists by iterating over every row in pandas</p>
<p>I have tried to use df.at but it gives me a value error</p>
<pre><code>
import pandas as pd
df = pd.DataFrame({'A': [1, 2, 3], 'B': ['x', 'y', 'z']})
for index, row in df.iterrows():
df.at[index,'new_col']... | <p>Try:</p>
<p><code>df['new_col'] = [['m', 'n']] * df.shape[0]</code></p> | python-3.x|pandas | 0 |
2,131 | 55,273,385 | Unable to add two layers in Keras of Tensorflow | <p>I have a simple regression model as below. The layers <code>layer_abc</code> and <code>layer_efg</code> both have <code>(None, 5)</code> as output, so their output have same dimension and can be added. Thus I want to unhide the code <code>#keras.layers.Add()(['layer_abc', 'layer_efg'])</code>. But whenever I do this... | <p>You can use the functional API like this to do the Add, for single output between 0 and 1, use the sigmoid activation for the output:</p>
<pre><code>input = keras.layers.Input((3,1))
x1 = keras.layers.Dense(5, activation=tf.nn.relu, name='layer_abc')(input)
x2 = keras.layers.Dense(5, activation=tf.nn.relu, name='... | python|tensorflow|keras|neural-network|deep-learning | 1 |
2,132 | 56,693,554 | GroupBy Method Changing DataType | <p>Using Python3 and Anaconda, I have pandas and os imported on ipython. I have an extremely large csv file. After using read_csv on the file, I try to use .groupby() on two columns, but it changes the data type from DataFrame to DataFrameGroupBy, and I can no longer run data frame methods on it.</p>
<p>I can't think ... | <p>If you look at the <a href="https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.groupby.html" rel="nofollow noreferrer">Pandas groupby documentation</a> you'll see that it returns a <code>DataFrameGroupBy</code> or <code>SeriesGroupBy</code> object, depending on whether you called <code>.grou... | pandas|pandas-groupby | 1 |
2,133 | 56,719,315 | extracting data from numpy array in python3 | <p>I imported my <code>csv</code> file into a python using <code>numpy.txt</code> and the results look like this:</p>
<pre><code>>>> print(FH)
array([['Probe_Name', '', 'A2M', ..., 'POS_D', 'POS_E', 'POS_F'],
['Accession', '', 'NM_000014.4', ..., 'ERCC_00092.1',
'ERCC_00035.1', 'ERCC_00034.1'],... | <p>One simple way to do this is with pandas dataframes. When you read the csv file using a pandas dataframe, you essentially get a collection of 'columns' (called series in pandas).</p>
<pre><code>import pandas as pd
df = pd.read_csv("your filename.csv")
df
Probe_Name Accession
0 A2m MD_9999
1 POS... | python-3.x|csv|numpy | 0 |
2,134 | 56,709,469 | How would I make these slices within an aggregate group by more programmatic? | <p>I had to set up 3 different functions for the slices I wanted to incorporate alongside the count, mean, median aggregate calls. Is there an easier way?</p>
<pre class="lang-py prettyprint-override"><code>def from_0_up_to_6(x):
return (x < 6).sum()
def from_6_up_to_12(y):
return ((y >= 6) & (y <... | <pre><code>from functools import partial
bounds = [0, 6, 12, float('inf')]
def agg(lower, upper, x):
return ((lower <= x) & (x < upper)).sum()
aggs = [
partial(agg, lower, upper)
for lower, upper in zip(bounds, bounds[1:])
]
print(aggs)
# [functools.partial(<function agg at 0x10afad7b8>... | python|pandas|function | 0 |
2,135 | 56,640,164 | More efficient way to import from CSV | <p>I'd like to import from a CSV to an object. For ease, we'll say it's a city and I have a CSV like so:</p>
<pre><code>Seattle,WA,600,000,Seahawks,Starbucks
</code></pre>
<p>What is the best way to import that into a class? Right now I import CSV, and do something like the following:</p>
<pre class="lang-py prettyp... | <p>TRY:-</p>
<pre><code>import pandas as pd
df = pd.read_csv("/path/to/XXX.csv")
for idx, row in df:
city_name=row[0]
state = row[1]
</code></pre> | python|pandas | -1 |
2,136 | 56,782,935 | How to re-write using numpy | <p>I'm wondering how I can re-write this using vectorization with numpy, assuming I change all lists to numpy arrays.</p>
<pre><code># dcdw1 = m x m array
# a1 = len(x) x m array
# a2 = len(x) x 1 array
# w2 = m x 1 array
# x = len(x) x m array
# y = len(x) x 1 array
for i in range(len(x)):
for j in range(m):... | <pre><code># dcdw1 = m x m array
# a1 = len(x) x m array
# a2 = len(x) x 1 array
# w2 = m x 1 array
# x = len(x) x m array
# y = len(x) x 1 array
import numpy as np
m = 10
lx = 4 # len(x)
dcdw1 = np.zeros([lx, m, m])
dcdw2 = np.zeros_like(dcdw1)
a1 = np.ones([lx, m]) * 0.5
a2 = np.ones([lx, 1]) * 2
w2 = np.ones([m, 1... | python|numpy | 1 |
2,137 | 66,862,832 | Barchart with dummies | <p>I have a dataset with the following explicit dummy variables: "Kidhome" and "Teenhome". Of course, for each row where both "Kidhome" and "Teenhome" = 0 that implies an implicit variable that is neither "Teen nor kids at home".</p>
<p>I also have another variable (cat... | <ol>
<li>Create the implicit column <code>Neitherhome</code>:</li>
</ol>
<pre><code>df['Neitherhome'] = (df.Kidhome.eq(0) & df.Teenhome.eq(0)).astype(int)
</code></pre>
<ol start="2">
<li>Aggregate the grouped sums:</li>
</ol>
<pre><code>data = df.groupby('Marital_Status').sum().reset_index()
</code></pre>
<ol star... | python|pandas|seaborn | 2 |
2,138 | 66,892,641 | How to save a df in many excel files? | <p>I have this df called result:</p>
<pre><code> CODE YEAR MONTH DAY TMAX TMIN PP
9984 000130 1991 1 1 32.6 23.4 0.0
9985 000130 1991 1 2 31.2 22.4 0.0
9986 000130 1991 1 3 32.0 NaN 0.0
9987 000130 1991 1 4 32.2 23.0 0.0
9988 000130 1991 1 5 30.5 ... | <p>You're not closing the files; ExcelWriter is a <code>contextmanager</code>, so you should be using it with a with clause (so that the file is closed).</p>
<pre class="lang-py prettyprint-override"><code>for code, data in result.groupby('CODE'):
name="/PATH/TO/FILES/station"+str(code)+".xlsx"
... | pandas | 1 |
2,139 | 67,180,716 | How to create a column containing whitespace using assign() method in Pandas | <p><strong>Sample Data:</strong></p>
<pre><code>import pandas as pd
df1=pd.DataFrame({'Original City': {'Daimler': 'Chicago',
'Mitsubishi': 'LA',
'Tesla': 'Vienna',
'Toyota': 'Zurich',
'Renault': 'Sydney',
'Ford': 'Toronto'}})
df2=pd.DataFrame({'Current City': {'Tesla': 'Amsterdam',
'Renault': 'Paris',
... | <p>You can use unpack dictionary:</p>
<pre><code>d = {'Original City':df2['Current City']}
df1.assign(**d)
</code></pre>
<p>Or unpack a dataframe:</p>
<pre><code>df1.assign(**df2[['Current City']].rename({'Current City': 'Original City'}))
</code></pre> | python|pandas | 5 |
2,140 | 67,127,637 | Given a pandas dataframe that contains multiple dates and multiple times per date how can I select the times for each date? | <p>I've tried:</p>
<pre><code>start_date = '2019-12-02'
end_date = '2019-12-02'
day_df = df[(df['timestamp'] >= start_date) & (df['timestamp'] <= end_date)]
</code></pre>
<p>which returns an empty Dataframe</p>
<p>I've also tried:</p>
<pre><code>start_date = '2019-12-02' + ' 00:00:00'
end_date = '2019-12-02' ... | <p>Based on your comments this might work:</p>
<pre><code>df['timestamp'] = pd.to_datetime(df.timestamp)
df.set_index('timestamp', inplace=True) # a DateTimeIndex is necessary to use between_time
start_time = '00:00:00'
end_time = '23:59:59'
df.between_time(start_time, end_time).resample('D').mean()
</code></pre> | python|pandas|dataframe | 0 |
2,141 | 67,178,061 | How to solve "OOM when allocating tensor with shape[XXX]" in tensorflow (when training a GCN) | <p>So... I have checked a few posts on this issue (there should be many that I haven't checked but I think it's reasonable to seek help with a question now), but I haven't found any solution that might suit my situation.</p>
<p>This OOM error message always emerge (with no single exception) in the second round of a wh... | <p>You can make use of distributed strategies in tensorflow to make sure that your multi-GPU set up is being used appropriately:</p>
<pre><code>mirrored_strategy = tf.distribute.MirroredStrategy()
with mirrored_strategy.scope():
for test_indel in range(1,11):
<etc>
</code></pre>
<p>See the docs <a hr... | tensorflow|keras|graph|neural-network|conv-neural-network | 1 |
2,142 | 47,228,807 | Set array to NAN if less than x amount of data points are in a datetime | <p>I have a dataframe output like the following. </p>
<pre><code>dateparse = lambda x: dt.datetime.strptime(x, "%d:%m:%Y %H:%M:%S")
df = pd.read_csv('somefile', skiprows = 6, na_values = ['-999.000000'], parse_dates={'times':[0,1]}, date_parser=dateparse)
df = df.set_index('times')
print(df)
times... | <p>Create a mask with <code>groupby</code> and then assign with <code>loc</code>:</p>
<pre><code>m = df.set_index('times')\
.groupby(pd.TimeGrouper(freq='D')).A.transform(len).lt(30)
df.loc[m.values, ['A', 'B', 'C', 'D']] = np.nan
</code></pre> | python|pandas|date|datetime | 1 |
2,143 | 68,127,249 | Keras-Tuner: Is it possible to use test/validation set in the objective/metric function? | <p>Is it possible to score/evaluate the model performance, using <code>keras-tuner</code>, based on the test set instead of the training set? I'm asking this, because as of now, my understanding is that the metric function used as objective in the <code>tuner.search()</code> uses only <code>y_true</code> and <code>y_pr... | <p>Short answer: you cannot, neither should you, use test data metrics during hyper-parameter tuning. <a href="https://www.tensorflow.org/tutorials/keras/keras_tuner?hl=uk" rel="nofollow noreferrer">KerasTuner</a> allows you to use validation data metrics as the objective, which I encourage. However, the final test s... | python|keras|tensorflow2.0|keras-tuner | 1 |
2,144 | 68,083,426 | How to merge two dataframe with some row values equal? | <p>I have two dataframes which I want to merge into one. The first one has as its columns the ID, while the second has the same values but in the column named id_number. I tried the below code, but in the end the final_df has both ID and the id_number columns and their values. How can I keep only one column for the ids... | <p>try selecting required columns after merge</p>
<pre><code>final_df = df.merge(
df2,
left_on='ID',
right_on='id_number',
how='inner')[['ID', 'col1', 'col2']]
</code></pre>
<p>or drop the column after merge</p>
<pre><code>final_df = df.merge(
df2,
left_on='ID',
right_on='id_number',
how... | python|pandas|dataframe|inner-join | 0 |
2,145 | 59,275,959 | How to visualize RNN/LSTM weights in Keras/TensorFlow? | <p>I've come across research publications and Q&A's discussing a need for inspecting RNN weights; some related answers are in the right direction, suggesting <code>get_weights()</code> - but how do I actually visualize the weights <em>meaningfully</em>? Namely, LSTMs and GRUs have <em>gates</em>, and all RNNs have ... | <p>Keras/TF build RNN weights in a well-defined order, which can be inspected from the source code or via <code>layer.__dict__</code> directly - then to be used to fetch <em>per-kernel</em> and <em>per-gate</em> weights; <em>per-channel</em> treatment can then be employed given a tensor's shape. Below code & explan... | python|tensorflow|keras|visualization|recurrent-neural-network | 7 |
2,146 | 59,207,257 | Can we alter pandas cross tabulation? | <p>I have loaded raw_data from MySQL using sqlalchemy and pymysql</p>
<p><code>engine = create_engine('mysql+pymysql://[user]:[passwd]@[host]:[port]/[database]')</code></p>
<p><code>df = pd.read_sql_table('data', engine)</code></p>
<p>df is something like this</p>
<pre><code>| Age Category | Category |
|-----... | <p>Both texts are called columns and index names, solution for change them is use <a href="http://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.rename_axis.html" rel="nofollow noreferrer"><code>DataFrame.rename_axis</code></a>:</p>
<pre><code>age = age.rename_axis(index=None, columns='Age Categor... | python|pandas | 1 |
2,147 | 14,224,172 | Equality in Pandas DataFrames - Column Order Matters? | <p>As part of a unit test, I need to test two DataFrames for equality. The order of the columns in the DataFrames is not important to me. However, it seems to matter to Pandas:</p>
<pre><code>import pandas
df1 = pandas.DataFrame(index = [1,2,3,4])
df2 = pandas.DataFrame(index = [1,2,3,4])
df1['A'] = [1,2,3,4]
df1['B... | <p>The most common intent is handled like this:</p>
<pre><code>def assertFrameEqual(df1, df2, **kwds ):
""" Assert that two dataframes are equal, ignoring ordering of columns"""
from pandas.util.testing import assert_frame_equal
return assert_frame_equal(df1.sort_index(axis=1), df2.sort_index(axis=1), chec... | python|pandas | 40 |
2,148 | 44,988,573 | 'No gradients provided for any variable' while training convolutional autoencoder | <p>I was trying to create a convolutional autoencoder but I've ran into a problem
Here's the code:</p>
<pre><code>import tensorflow as tf
import numpy as np
import matplotlib.image as mpimg
import matplotlib.pyplot as plt
img = mpimg.imread('data.jpg')
x = (img-np.mean(img))/np.std(img)
y = img
epochs = 500
def au... | <p>Your code does not even run as is, but with some rewriting you get this that actually runs.</p>
<pre><code>import tensorflow as tf
import numpy as np
import matplotlib.image as mpimg
import matplotlib.pyplot as plt
import scipy
img = scipy.misc.imresize(scipy.misc.face(), [200, 152])[None, :]
x = (img-np.mean(im... | python|tensorflow|neural-network|autoencoder | 0 |
2,149 | 57,081,116 | How do I calculate number of words and number of unique words contained within a list of a column across all rows of my dataframe? | <p>I generated a column <code>df['adjectives']</code> in my pandas dataframe that has a list of all the adjectives from another column, <code>df['reviews']</code>.</p>
<p>The values of <code>df['adjectives']</code> are in this format, for example: </p>
<blockquote>
<p><code>['excellent', 'better', 'big', 'unexpecte... | <p>Is this the type of behavior that you are looking for?</p>
<p>Based off of your description I assumed that the values in the <strong>adjectives</strong> column are a string formatted like a list e.g. <strong>"['big','excellent','small']"</strong></p>
<p>The code below converts the strings to a list using <strong>s... | python|pandas | 1 |
2,150 | 56,939,282 | How do you feed a tf.data.Dataset dynamically in eager execution mode where initializable_iterator isn't available? | <p>What is the new approach (under eager execution) to feeding data through a dataset pipeline in a dynamic fashion, when we need to feed it sample by sample? </p>
<p>I have a <code>tf.data.Dataset</code> which performs some preprocessing steps and reads data from a generator, drawing from a large dataset during train... | <p>I just realized that the answer to this question is trivial:</p>
<blockquote>
<p>Just create a new dataset!</p>
</blockquote>
<p>In non-eager mode the code below would have degraded in performance because each dataset operation would have been added to the graph and never released, and in non-eager mode we have ... | python|tensorflow | 1 |
2,151 | 56,918,916 | Finding a value in an equation | <p>i`m looking for an easy way to find the value of a variable depending on the result of another one:</p>
<pre><code>import numpy as np
import matplotlib.pyplot as plt
T = np.arange(0.01, 4.5, 0.0001)
N = (2.63 * 10 ** -16) * ((2.71828 ** (6.93 * T)) - 1) + ((4.05 * 10 ** -6) * T)
plt.plot(N,T)
plt.axis(xmin=-0.001... | <p>You can loop over values of T, calculate N, and compare it with the number you are looking for (0.00006762), and return the closest one you find:</p>
<pre class="lang-py prettyprint-override"><code>target = 0.00006762
smallest_diff = 1000
best_answer = 'NA'
for T in np.arange(0.01, 4.5, 0.0001):
N = (2.63 * 10 *... | python|numpy|matplotlib | -1 |
2,152 | 57,063,456 | Numpy arange function produces variable of a different length than the variable it depends on | <p>I am trying to make a pyplot graph, but my x and y values are of different length. </p>
<p>I am using numpy's arange function to create the range of x values based on the length of my list of y values.</p>
<pre><code>def event_editor(EventDatabase, ConcatenatedEvents, ConcatenatedFits):
for i in list(EventDat... | <p>This is due to <code>float</code> approximation in Python / NumPy.
The inconsistent behavior is documented also in its official <a href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.arange.html" rel="nofollow noreferrer">docs</a>.</p>
<p>A more robust approach is to use: <code>np.linspace()</code> e.g... | python|numpy | 1 |
2,153 | 57,101,758 | How to mask a dataframe given a list of values or indices in the dataframe | <p>I have a dataframe that has a column 'rel_max' that has a list of all the values of local maxima (if relevant or more useful I also have a column of the indices of these local extrema). I would like to take this list of values or indices and mask the dataframe so that I have a maxima in its correct spot and NaN or 0... | <p>You could try something like this:</p>
<pre><code>pd.concat([df.iloc[:, :-1].where(df.apply(lambda x: x[:-1].isin(x.iloc[-1]), axis=1), 0),
df.iloc[:, -1]], axis=1)
</code></pre>
<p>Output:</p>
<pre><code> 123 124 412 516 129 rel_max
2015-01-10 20.908 0.0000 0.000... | python|pandas|dataframe | 1 |
2,154 | 45,902,080 | Incorrect results when using "in" operator with Pandas series? | <p>I have two dataframes df1 contains 100K rows and df2 contains 6 million rows. I want to fix values for 'SoftDel???' column in df1 when 'id' matches in df2. code is working but results are wrong. </p>
<p>I have completed this task using merge and results are satisfactory but want to know why below is producing wrong... | <p><code>y['id']</code> is a float. But, <code>df2['id']</code> is a series. The <code>in</code> operator is not designed to work with a series as one of the arguments.</p> | python|pandas|series | 2 |
2,155 | 45,900,740 | Upgrading to Tensorflow 1.3 Error: DLL load failed: The specified module could not be found | <p>I have installed tensorflow 1.3.0 as seen below and I have included cudnn64_6.dll in my %PATH%, along with installed CUDA 8.0, but I still get an error message when importing tensorflow. The error message is after the installation message below:</p>
<pre><code>(tensorflow) C:\Users\alexz>pip install --ignore-ins... | <p>I got the same issue while installing Tensorflow 1.3 a month ago.
I fixed it by installing CudNN 5.1 instead of 6.</p>
<p>NB : I just saw that latest version is 7 now, maybe it works (I haven't tried).</p>
<p>I hope it helps,</p> | tensorflow | 0 |
2,156 | 45,780,190 | Split an array in all possible combinations (not regular splitting) | <p>Suppose I have an array,</p>
<pre><code>>>> import numpy as np
>>> array = np.linspace(1,4,4, dtype=np.int)
>>> array
array([1, 2, 3, 4])
</code></pre>
<p>I want a function that will split this array in all possible parts, such that,</p>
<p>No split :</p>
<pre><code>([1,2,3,4])
</code></p... | <p>You could use <a href="https://docs.python.org/library/itertools.html" rel="noreferrer"><code>itertools.combinations</code></a> to generate the indices where to split inside a loop over the number of splits:</p>
<pre><code>>>> from itertools import combinations
>>> [np.split(array, idx)
... for ... | python|arrays|python-3.x|numpy|split | 6 |
2,157 | 45,825,701 | What is wrong with my cost function in numpy? | <p>I was trying to implement a cost function for a Programming assignment in Andrew Ng Deep Learning course which requires my own, original work. I am also not allowed to reproduce the assignment code without permission, but am doing so anyway in this question.</p>
<p>The expected result for the cost = 6.0000647731922... | <p>There is an error in your sigmoid function. You are supposed to calculate negative of <code>np.dot(np.transpose(w), X) + b)</code>.</p>
<p>Here is the one I have used</p>
<pre><code>A = 1 / (1 + np.exp(-(np.dot(np.transpose(w), X) + b)))
</code></pre> | python|numpy|machine-learning|deep-learning | 2 |
2,158 | 45,795,645 | Groupby to Dataframe in Pandas | <p>Basically, i use an excel file that contains thousands of data and I'm using pandas to read in the file.</p>
<pre><code>import pandas as pd
agg = pd.read_csv('Station.csv', sep = ',')
</code></pre>
<p>Then what i did was i grouped the data accordingly to these categories,</p>
<pre><code>month_station = agg.groupb... | <p>The nature of groupby is so that you can derive an aggregate calculation, such as mean or count or sum or etc. If you are merely trying to see on of each pair of month and station name, try this:</p>
<pre><code>month_station = agg.groupby(['month','StationName'],as_index=False).count()
month_station = month_station... | python|pandas|dataframe|group-by | 0 |
2,159 | 23,198,053 | How do you shift Pandas DataFrame with a multiindex? | <p>With the following DataFrame, how can I shift the "beyer" column based on the index without having Pandas assign the shifted value to a different index value?</p>
<pre><code> line_date line_race beyer
horse
Last Gunfighter 2013-09-28 10 99
Last... | <p>Use <code>groupby/shift</code> to apply the shift to each group individually: (Thanks to Jeff for pointing out this simplification.)</p>
<pre><code>In [60]: df['beyer_shifted'] = df.groupby(level=0)['beyer'].shift(1); df
Out[61]:
line_date line_race beyer beyer_shifted
Last Gunfighter 2013-09... | python|pandas | 53 |
2,160 | 35,754,638 | Getting the monthly maximum of a daily dataframe with the corresponding index value | <p>I have dowloaded daily data from yahoo finance </p>
<pre><code> Open High Low Close Volume \
Date
2016-01-04 10485.809570 10485.910156 10248.580078 10283.440430 116249000
2016-01-05... | <p>You can get the max value per month using <code>TimeGrouper</code> together with <code>groupby</code>:</p>
<pre><code>from pandas.io.data import DataReader
aapl = DataReader('AAPL', data_source='yahoo', start='2015-6-1')
>>> aapl.groupby(pd.TimeGrouper('M')).Close.max()
Date
2015-06-30 130.539993
2015-... | python|pandas|group-by|max|time-series | 9 |
2,161 | 35,431,447 | How to summarise data by percentages in pandas | <p>This code:</p>
<pre><code> #Missing analysis for actions - which action is missing the most action_types?
grouped_missing_analysis = pd.crosstab(clean_sessions.action_type, clean_sessions.action, margins=True).unstack()
grouped_unknown = grouped_missing_analysis.loc(axis=0)[slice(None), ['Missing', 'Unknow... | <p>First you can find value of <code>Multindex</code> with key <code>All</code> by <a href="http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.xs.html" rel="nofollow"><code>xs</code></a> and then you can try it by original <code>Series</code>. Last you can <a href="http://pandas.pydata.org/pandas-do... | pandas|group-by|aggregate|pivot-table|crosstab | 1 |
2,162 | 28,393,292 | Daily schedule as an index in Pandas | <p>I want to represent a daily schedule, given originally as a CSV file, as a Pandas DataFrame. The key to each row in the schedule is an hourly range in a day. The ranges are not overlapping. For example:</p>
<pre><code>00:00, 01:00, some data
01:00, 03:00, some more data
03:00, 04:30, some other data
</code></pre>
... | <p>Starting from your example dataframe (put column names on it):</p>
<pre><code>In [78]: df
Out[78]:
start end other
0 00:00 01:00 some data
1 01:00 03:00 some more data
2 03:00 04:30 some other data
</code></pre>
<p>Assuming start and end are strings, we can convert it to a datetim... | python|datetime|pandas|dataframe|period | 0 |
2,163 | 50,712,636 | How to remove duplicates in a data frame using Python | <p>So the data frame is</p>
<pre><code>Product Price Weight Range Count
A 40 20 1-3 20
A 40 20 4-7 23
B 20 73 1-3 54
B 20 73 4-7 43
B 20 73 8-15 34
B 20 73 >=16 12
... | <p>Fulfilling the second output makes more sense than the first. Use <code>set_index</code>, followed by <code>unstack</code>.</p>
<pre><code>(df.set_index(['Product', 'Price', 'Weight', 'Range'])
.Count
.unstack(fill_value=0)
.reset_index()
)
Range Product Price Weight 1-3 4-7 8-15 >=16
0 A ... | python|python-3.x|pandas|duplicates | 3 |
2,164 | 51,087,820 | issues storing and extracting arrays in numpy file | <p>Trying to store an array in numpy file however, while trying to extract it, and use it, getting an error message as trying to apply array to a sequence.</p>
<p>These are the two arrays, unsure which one is causing the issue.</p>
<pre><code>X = [[1,2,3],[4,5,6],[7,8,9]]
y = [0,1,2,3,4,5,6....]
</code></pre>
<p>whi... | <pre><code>array(list[1,2,3],list[4,5,6],list[7,8,9])
</code></pre>
<p>is a 1d object dtype array. To get that from</p>
<pre><code>[[1,2,3],[4,5,6],[7,8,9]]
</code></pre>
<p>requires more than <code>np.array([[1,2,3],[4,5,6],[7,8,9]])</code>; either the list elements have to vary in size, or you have to initialize ... | python-3.x|numpy|numpy-ndarray | 0 |
2,165 | 9,537,543 | Replace NaN's in NumPy array with closest non-NaN value | <p>I have a NumPy array <code>a</code> like the following:</p>
<pre><code>>>> str(a)
'[ nan nan nan 1.44955726 1.44628034 1.44409573\n 1.4408188 1.43657094 1.43171624 1.42649744 1.42200684 1.42117704\n 1.42040255 1.41922908 nan nan nan nan\n ... | <p>As an alternate solution (this will linearly interpolate for arrays <code>NaN</code>s in the middle, as well):</p>
<pre><code>import numpy as np
# Generate data...
data = np.random.random(10)
data[:2] = np.nan
data[-1] = np.nan
data[4:6] = np.nan
print data
# Fill in NaN's...
mask = np.isnan(data)
data[mask] = n... | python|arrays|numpy|nan | 59 |
2,166 | 5,761,642 | Python/Numpy - Get Index into Main Array from Subset | <p>Say I have a 100 element numpy array. I perform some calculation on a subset of this array - maybe 20 elements where some condition is met. Then I pick an index in this subset, how can I (efficiently) recover the index in the first array? I don't want to perform the calculation on all values in a because it is ex... | <p>I am not sure if I understand your question. So, correct me if I am wrong.</p>
<p>Let's say you have something like</p>
<pre><code>a = np.arange(100)
condition = (a % 5 == 0) & (a % 7 == 0)
b = a[condition]
index = np.argmax(b)
# The following should do what you want
a[condition][index]
</code></pre>
<p>Or i... | python|indexing|numpy | 2 |
2,167 | 66,348,482 | Count the number of field having value populated except NULL using lambda function throughout all rows | <p>Thanks for having a look at this question. I am creating a logic using lambda, that runs through all the rows and counts the number of the field having value except NA. As you can see in the given example.</p>
<pre><code>Input :
project_id project_a project_b project_c project_d project_e
1 ... | <p>You are overcomplicating it, you can count non-null values of your dataframe and populate a new column using, <code>count</code>, and perform operation along rows (<code>axis=1</code>).</p>
<p><code>filter(like='project')</code> will consider only columns with 'project' in case you have more columns in your actual <... | python|pandas | 3 |
2,168 | 66,394,218 | Applying .get() function On a Pandas series | <p>I am working on sample dataset to retrieve location information from address(some details are changed for identification purpose);</p>
<pre><code>temp2=pd.DataFrame({'USER_ID':[1268,12345,4204,4208], 'IP_ADDR':['142.176.00.83','24.000.63.230','187.178.252.99','187.178.250.99']})
</code></pre>
<p>My goal is to get La... | <p>The error is raised by ip2geotools, not pandas, because the IP format is improper. Code works for me after changing IP's to have only single 0's in each part.</p>
<p>i.e. change <code>'24.000.63.230'</code> to <code>'24.0.63.230'</code></p>
<p>You can apply this fix to your dataframe using:</p>
<pre><code>temp2['IP_... | python|pandas|geolocation | 0 |
2,169 | 57,541,947 | Keras LSTM TensorFlow Error: 'Shapes must be equal rank, but are 1 and 0' | <p>I'm trying to create a Keras LSTM (Please note that I am new to LSTMs and RNNs in Keras). The neural network is supposed to take an input of 4116 values, and output 4116 values. This is to be done for 288 timesteps. I have 27 such timesteps (I realize this will likely lead to overfitting; I have a larger dataset, bu... | <p>You probably want to repeat the output of first LSTM layer as much as the number of timesteps in model's output sequence (i.e. <code>y</code>). Therefore, it should be:</p>
<pre><code>model.add(RepeatVector(y.shape[1]))
</code></pre> | python|tensorflow|keras|lstm|recurrent-neural-network | 0 |
2,170 | 57,404,679 | Subset a df using an if statement - Pandas | <p>I am hoping to create and return a subsetted <code>df</code> using an <code>if</code> statement. Specifically, for the code below, I have two different sets of values. The <code>df</code> I want to return will vary based on one of these values. </p>
<p>Using the code below, the specific value will be within <code>n... | <p>To check if an object is <em>in</em> something rather than check if it <em>equal to</em> something, use <code>in</code>.</p>
<pre><code>if place in different:
</code></pre>
<p>and similarly</p>
<pre><code>elif place in normal:
</code></pre>
<hr>
<p><strong>EDIT:</strong></p>
<p>Here is how it should look if yo... | python|pandas|if-statement | 1 |
2,171 | 57,465,747 | Strange behavior with pandas timestamp to posix conversion | <p>I do the following operations:</p>
<ol>
<li>Convert string datetime in pandas dataframe to python datetime via <code>apply(strptime)</code></li>
<li>Convert <code>datetime</code> to posix timestamp via <code>.timestamp()</code> method</li>
<li>If I revert posix back to <code>datetime</code> with <code>.fromtimestam... | <p>First, I suggest using the <code>np.timedelta64</code> dtype when working with <code>pandas</code>. In this case it makes the reciprocity simple.</p>
<pre><code>pd.to_datetime('2018-03-03 14:30:00').value
#1520087400000000000
pd.to_datetime(pd.to_datetime('2018-03-03 14:30:00').value)
#Timestamp('2018-03-03 14:30:... | python|pandas|datetime|timezone | 1 |
2,172 | 57,715,881 | How to compare 2 columns of 2 different dataframes pandas, and sum the result pandas | <p>I have 2 dataframes with the same length, but different number of columns. </p>
<p>I'd like to compare 2 specific columns from those dataframes and if the values are even, the counter is added by 1, like so:</p>
<p>df1:</p>
<pre><code>count = o
num
0 0
1 1
2 0
3 0
4 1
</... | <p>You can check by performing an <em>elementwise</em> comparison between the two:</p>
<pre><code>>>> (df1['num'] == df2['outcome']).sum()
3
</code></pre> | pandas|compare | 0 |
2,173 | 57,429,648 | Query within multiple csv files for get the suitable data-set based on given conditions on pandas columns | <p>I have approximately 25 csv datasets. Where every csv file has many common column names. Now these all csv file are for speech recognition domain where you can work on text to speech projects. Choosing a dataset for specific kind of project needs to see all 25 datasets and choose the preferred one. </p>
<p>Such as,... | <p>You can iterate over each row, and if all of the key words in your query are somewhere in that row, you have a match. You can use a list comprehension where you check 'if all items in the query are in the row i'm looking at, consider it a match'. In this approach we're actually capturing those rows, into a new dat... | python|pandas|csv|numpy | 0 |
2,174 | 24,236,079 | As of June 2014, what tools should one consider for improving Python code performance? | <p>I have written a small scientific experiment in Python, and I now need to consider optimizing this code. After profiling, what tools should I consider in order to improve performance. From my understanding, the following wouldn't work:</p>
<p><strong>Psyco</strong>: out of date (doesn't support Python 2.7)</p>
<p>... | <p>You can use Cython to compile the bottlenecks to C. This is very effective for numerical code where you have tight loops. Python loops add quite a lot of overhead, that is non-existent if you can translate things to pure C. In general, you can get very good performance for any statically typed code (that is, your ty... | python|numpy | 5 |
2,175 | 43,765,031 | How to plot lines based on the existence of continuous data | <p>I have a dataset that looks like the below:</p>
<pre><code>+------------+--------+
| trend_name | date |
+------------+--------+
| dogs | 5/3/17 |
| cats | 5/3/17 |
| owls | 5/3/17 |
| dogs | 5/4/17 |
| cats | 5/4/17 |
| tigers | 5/4/17 |
| cats | 5/5/17 |
| bears | 5/... | <p>It's possible that this is far from the most elegant solution, especially since I'm not very familiar with pandas. But anyway, here's a solution which creates an auxiliary dataframe for your plot limits (this is inevitable if you want to ignore data points which are not represented in your current time window):</p>
... | python|pandas|matplotlib|plot | 3 |
2,176 | 73,027,326 | How to import a module once I have installed the module on a virtual environment - TensorFlow | <p>I am very new to this virtual environment concept. So if you could also explain that, it would be great.</p>
<p>Anyways, I am using Anaconda3. Here are the steps that I took to try to use TensorFlow.</p>
<ol>
<li>From "base" anaconda I tried to install, which gave me the below error.</li>
</ol>
<pre><code>... | <p>Please run the following command to see if Tensorflow is installed. It will either state that the package is not installed or display a bunch of information about it.</p>
<pre><code>pip show tensorflow
</code></pre>
<p>If the Tensorflow package is not already installed, please try installing it in the environment wh... | python|tensorflow|virtual-environment | 0 |
2,177 | 10,377,096 | Multiple conditions using 'or' in numpy array | <p>So I have these conditions:</p>
<blockquote>
<p>A = 0 to 10 <strong>OR</strong> 40 to 60</p>
<p>B = 20 to 50</p>
</blockquote>
<p>and I have this code:</p>
<pre><code>area1 = N.where((A>0) & (A<10)),1,0)
area2 = N.where((B>20) & (B<50)),1,0)
</code></pre>
<p>My question is: how do I do '<strong>O... | <p>If numpy overloads <code>&</code> for boolean <code>and</code> you can safely assume that <code>|</code> is boolean <code>or</code>.</p>
<pre><code>area1 = N.where(((A>0) & (A<10)) | ((A>40) & (A<60))),1,0)
</code></pre> | python|numpy | 48 |
2,178 | 10,601,041 | Pandas: where's the memory leak here? | <p>I face the problem of memory leaks using <strong><code>pandas</code></strong> library in <strong>python</strong>. I create <code>pandas.dataframe</code> objects in my class and I have method, that change dataframe size according my conditions. After changing dataframe size and creating new pandas object I rewrite or... | <p>A couple things to point out:</p>
<ol>
<li><p>In "Check memory after changing size", you haven't deleted the original DataFrame yet, so this will be using strictly more memory</p></li>
<li><p>The Python interpreter is a bit greedy about holding onto OS memory.</p></li>
</ol>
<p>I looked into this and can ... | python|pandas | 26 |
2,179 | 70,685,858 | Can I use pad_sequence with transformer in Pytorch? | <p>I'm trying to use transformer to process some image data (not NLP data), e.g. 480 x 640 images with different sequence length, an example would be [6, 480, 640], [7, 480, 640], [8, 480, 640]. And I would like to put these three sequences into one batch.</p>
<p>However, most tutorials I saw use torchtext to deal with... | <p>Let's say we have 03 images with different dimensions. Applying <code>pad_sequence</code> function on them will result as follow:</p>
<pre class="lang-py prettyprint-override"><code>import torch
from torch.nn.utils.rnn import pad_sequence
image_1 = torch.ones(25, 30)
image_2 = torch.ones(32, 30)
image_3 = torch.ones... | deep-learning|pytorch|transformer-model | 0 |
2,180 | 70,683,969 | Writing Pyspark Dataframe to TFrecords file | <p>I have a dataframe with schema, and want to convert this into tfRecords</p>
<pre><code>root
|-- col1: string (nullable = true)
|-- col2: array (nullable = true)
| |-- element: string (containsNull = true)
|-- col3: array (nullable = true)
| |-- element: string (containsNull = true)
|-- col4: array (nulla... | <p>The most probable cause (judging from <a href="https://mvnrepository.com/artifact/org.tensorflow/spark-tensorflow-connector" rel="nofollow noreferrer">Maven Central information</a>) is that you're using connector compiled for Scala 2.11 on the Databricks runtime that uses Scala 2.12.</p>
<p>Either you need to use DB... | tensorflow|apache-spark|pyspark|databricks | 2 |
2,181 | 70,462,851 | why is np.exp(x) not equal to np.exp(1)**x | <p>Why is why is np.exp(x) not equal to np.exp(1)**x?</p>
<p>For example:</p>
<pre><code>np.exp(400)
>>>5.221469689764144e+173
np.exp(1)**400
>>>5.221469689764033e+173
np.exp(400)-np.exp(1)**400
>>>1.1093513018771065e+160
</code></pre> | <p>It looks like a rounding issue. In the first case it's internally using a very precise value of <code>e</code>, while in the second you get a less precise value, which when multiplied 400 times the precision issues become more apparent.</p>
<p>The actual result when using the Windows calculator is <code>5.2214696897... | python-3.x|numpy|exponential | 2 |
2,182 | 70,405,675 | How to convert Excel to JSON and append it to existing JSON file? | <p>I have Excel file like this:</p>
<pre><code>-------------------------
| myValue | myValue2 | myValue3 |
--------+-------+--------
| 1 | A | AA|
| 2 | B | BB|
| 4 | C | CC |
| 5 | D | DD |
| 6 | E | EE|
| 7 | F | FF |
| 8 | G | GG |
-----------... | <p><strong>This works</strong></p>
<pre><code># Importing dependencies
import pandas
import json
# Reading xlsx into pandas dataframe
df = pandas.read_excel('../Data/18-12-21.xlsx')
# Encoding/decoding a Dataframe using 'columns' formatted JSON
jsonfile = df.to_json(orient='columns')
# Print out the result
print('E... | python|json|excel|pandas | 2 |
2,183 | 42,663,400 | How to group by the partial value of the column in pandas? | <p>I have some data in the <code>pandas data frame</code> as following where I converted the <code>currency</code> and the <code>value</code> earlier to the <code>USD</code> from <code>CYN</code> <code>(Chinese Yuan)</code></p>
<pre><code> currency port supplier_id value
0 USD CNAQG 35 ... | <p>I think you need <a href="http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.pivot.html" rel="nofollow noreferrer"><code>pivot</code></a> and then plot by <a href="http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.plot.bar.html" rel="nofollow noreferrer"><code>plot.bar</code>... | python|pandas | 1 |
2,184 | 42,846,345 | Sklearn: Categorical Imputer? | <p>Is there a way to impute categorical values using a sklearn.preprocessing object? I would like to ultimatly create a preprocessing object which I can apply to new data and have it transformed the same way as old data. </p>
<p>I am looking for a way to do it so that I can use it <a href="https://github.com/paulgb/sk... | <p>Yes, it is possible. For example, you can use <code>sklearn.preprocessing.Imputer</code> with parameter <code>strategy = 'most_frequent'</code>. </p>
<p>Use <code>fit_transform</code> method to apply it to old data (train set) and then <code>transform</code> on new data (test set).</p> | machine-learning|tensorflow|scikit-learn|sklearn-pandas|imputation | 2 |
2,185 | 14,665,828 | How can I select a certain value based on 2(or more) other values in a pandas dataframe | <p>I've been trying to find out how to select a certain value based on multiple other values in the same tuple of a dataframe. The data looks like this(copied from the current dataframe)</p>
<pre><code> DealID PropId LoanId ServicerId ServicerPropId
0 BAC98765 15 000015 30220144 010-002... | <pre><code>columns = ['DealID', 'PropId', 'LoanId', 'ServicerId', 'ServicerPropId']
d = [('A', [ 'BAC98765', '15', '000015', '30220144', '010-002-001']),
('B', [ 'BAC98765', '16', '000016', '30220092', '010-003-001']),
('C', [ 'BAC98765', '45', '000045', '30220155', '010-045-001']),
('D', [ 'BAC98765', ... | python|pandas | 2 |
2,186 | 14,847,551 | Pandas: DataFrame.sum() or DataFrame().as_matrix.sum() | <p>I am writing a function that computes conditional probability all columns in a pd.DataFrame that has ~800 columns. I wrote a few versions of the function and found a very big difference in compute time over two primary options:</p>
<pre><code>col_sums = data.sum() #Simple Column Sum over 800 x 800 DataFrame
</cod... | <p>While reading the documentation I came across:</p>
<blockquote>
<p><strong>Section 7.1.1 Fast scalar value getting and setting</strong> Since indexing with [] must handle a lot of cases (single-label access, slicing,
boolean indexing, etc.), it has a bit of overhead in order to figure
out what you’re asking fo... | python|pandas | 1 |
2,187 | 26,472,653 | Computing the mean square displacement of a 2d random walk in Python | <p>I'm simulating a 2-dimensional random walk, with direction 0 < θ < 2π and T=1000 steps. I already have a code which simulates a single walk, repeats it 12 times, and saves each run into sequentially named text files:</p>
<pre><code>a=np.zeros((1000,2), dtype=np.float)
print a ... | <p>Here is a quick snipet to compute the mean square displacement (MSD).
Where path is made of points equally spaced in time, as it seems to be the case
for your randwalk. You can just place in the 12-walk for loop and compute it for each a[i,:] </p>
<pre><code>#input path =[ [x1,y1], ... ,[xn,yn] ].
def compute_MSD... | python|arrays|numpy|random-walk | 4 |
2,188 | 39,398,251 | Create unique MultiIndex from Non-unique Index Python Pandas | <p>I have a pandas DataFrame with a non-unique index:</p>
<pre><code>index = [1,1,1,1,2,2,2,3]
df = pd.DataFrame(data = {'col1': [1,3,7,6,2,4,3,4]}, index=index)
df
Out[12]:
col1
1 1
1 3
1 7
1 6
2 2
2 4
2 3
3 4
</code></pre>
<p>I'd like to turn this into unique MultiIndex and pre... | <p>You can do a <a href="http://pandas.pydata.org/pandas-docs/stable/generated/pandas.core.groupby.GroupBy.cumcount.html" rel="noreferrer"><code>groupby.cumcount</code></a> on the index, and then append it as a new level to the index using <a href="http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.... | python|pandas | 6 |
2,189 | 39,398,933 | Error setting dtypes of an array | <p>I was attempting to make a 1x5 numpy array with the following code</p>
<pre><code>testArray = np.array([19010913, "Hershey", "Bar", "Birthday", 12.34])
</code></pre>
<p>but encountered the unwanted result that</p>
<pre><code>testArray.dtype
dtype("<U8")
</code></pre>
<p>I want each column to be a specific dat... | <p>First off, I am not sure if <code>f10</code> is something known. </p>
<p>Note that structured arrays need to be defined as "list of tuples". Try the following:</p>
<pre><code>testArray = np.array([(19010913, "Hershey", "Bar", "Birthday", 12.34)],
dtype=[('f0','<i8'),('f1','<U64'),('f2','<U64'),('f3','<... | python|arrays|numpy | 2 |
2,190 | 39,254,947 | Python Special Colon Inquiry | <pre><code>sortedWinnerIndices = winnerIndices[-numActive:][::-1]
</code></pre>
<p>Can someone tell me what is going on here? </p>
<p><code>WinnerIndices</code> is 2048 ints long, Numpy array. I read somewhere that <code>[::-1]</code> reverses the result but I still can't figure out how this function selects a subset... | <pre><code>winnerIndices[-numActive:]
</code></pre>
<p>Above takes a slice from <code>-numActive</code> index to the end of the original list</p>
<pre><code>x[::-1]
</code></pre>
<p>This reverses x</p> | python|numpy|operator-keyword|colon | 1 |
2,191 | 39,358,775 | Receving an error when trying to use the pandas read_html function | <p>I'm really new to python and pandas so I could be making a simple mistake.</p>
<p>I'm trying to run the code below:</p>
<pre><code>import quandl
import pandas as pd
df3 = pd.read_html('https://simple.wikipedia.org/wiki/List_of_U.S._states')
print(df3)
</code></pre>
<p>I have installed pandas as well quandl throu... | <p>I fixed the problem. I moved the file that I wanted to install from <code>Downloads</code> to <code>LocalDisk/Users/My_name</code>. Inside the right directory, <code>PIP</code> was able to locate and install it for some reason. Thanks for the responses.</p> | python|windows|python-2.7|pandas|pip | 0 |
2,192 | 19,344,663 | ndarray that updates its data on demand | <p>I would like to have a system, where I have a "Data class" that has some arrays and a "Selection class" that has the same array names whose data are just a mere view on a subset of the arrays from the Data class. which ones should be determined by the instance of the selection class. If one changes something in the ... | <p>If you want an expression like</p>
<pre><code>SObj1.X = 10
</code></pre>
<p>to change values of some distant sources, you should override <code>__setattr__</code> method in your <code>SelObj</code> class. Like this:</p>
<pre><code>class SelObj():
def __init__(self, DataObj, selA, selB):
self.selA = se... | python|arrays|numpy | 0 |
2,193 | 29,070,850 | How to convert json response into Python list | <p>I get the JSON response by <code>requests.get</code></p>
<pre><code>req = requests.get(SAMPLE_SCHEDULE_API)
</code></pre>
<p>and convert it into dictionary</p>
<p><code>data = json.loads(req.text)["data"]</code></p>
<p>When I tried to convert the string into Python dict,</p>
<p>I got <code>ValueError: malforme... | <p>You have encoded the <code>data</code> twice (which would strictly not be necessary). You just need to decode the <code>data</code> again with <code>json.loads</code>:</p>
<pre><code>def schedules(cls, start_date=None, end_date=None):
req = requests.get(SAMPLE_SCHEDULE_API)
data_json = json.loads(req.text)[... | python|python-3.x|pandas | 3 |
2,194 | 33,792,332 | Pandas: Getting a rolling sum while grouping by a column | <p>I have a pandas dataframe that looks like</p>
<pre><code>Name Date Value
Sarah 11-01-2015 3
Sarah 11-02-2015 2
Sarah 11-03-2015 27
Bill 11-01-2015 42
Bill 11-02-2015 5
Bill 11-03-2015 15
.... (a couple hundred rows)
</code></pre>
<p>Ho... | <p>Figured it out using the grigri group_resample function.</p>
<pre><code>df = group_resample(df,date_column='Date',groupby=group_by,value_column='Value',how='sum',freq='d')
df = df.unstack(group_by).fillna(0)
result = pd.rolling_mean(df,30)
</code></pre> | python|pandas|dataframe|rolling-sum | 1 |
2,195 | 23,483,655 | datetime range indexing: datetimes that may not be in the index? | <p>I have a dataframe indexed by <code>datetime</code> objects: </p>
<pre><code>In <10>: all_data.head().index
Out<10>:
Index([2014-04-23, 2014-04-13, 2014-04-15, 2014-04-30, 2014-04-06], dtype='object')
</code></pre>
<p>and two timestamps:</p>
<pre><code>In <11>: d1
Out<11>: datetime.dateti... | <p>Well, if you make the index a <code>DateTimeIndex</code>, partial string indexing should work:</p>
<pre><code>print df
print df.index
x1 x2
date
2014-04-23 1 2
2014-04-13 2 4
2014-04-15 3 6
2014-04-30 4 8
2014-04-06 5 10
[5 rows x 2 columns]
<class 'pandas.tseries... | python|datetime|pandas | 3 |
2,196 | 23,688,307 | SettingWithCopyWarning, even when using loc (?) | <p>I get <code>SettingWithCopyWarning</code> errors in cases where I would not expect them:</p>
<pre><code>N.In <38>: # Column B does not exist yet
N.In <39>: df['B'] = df['A']/25
N.In <40>: df['B'] = df['A']/50
/Users/josh/anaconda/envs/py27/lib/python2.7/site-packages/pandas/core/indexing.py:389: ... | <p>In case 1, <code>df['A']</code> creates a copy of <code>df</code>. As explained by the <a href="http://pandas.pydata.org/pandas-docs/stable/indexing.html#returning-a-view-versus-a-copy">Pandas documentation</a>, this can lead to unexpected results when chaining, thus a warning is raised. Case 2 looks correct, but fa... | python|pandas | 19 |
2,197 | 22,543,745 | Can't import numpy | <p>When I try to import numpy on Python, it says:</p>
<blockquote>
<p>ImportError: No module named numpy</p>
</blockquote>
<p>If I try to install numpy, it says it has already been installed. It seems like it's been installed, but in a wrong place? I don't know where it should be though. </p>
<p>Python version is ... | <p>You can ask Python if numpy is installed, by searching through <code>sys.path</code>: </p>
<pre><code>>>> import os
>>> import sys
>>> for p in sys.path:
... if os.path.exists(os.path.join(p, 'numpy')):
... print p
... break
... else:
... print "Numpy not found"
/usr/lib/python2.7/d... | python|numpy | 3 |
2,198 | 15,283,872 | How do I boolean mask an array using chained comparisons? | <p>How can I filter a numpy array using a pair of inequalities, such as:</p>
<pre><code>>>> a = np.arange(10)
>>> a[a <= 6]
array([0, 1, 2, 3, 4, 5, 6])
>>> a[3 < a]
array([4, 5, 6, 7, 8, 9])
>>>
>>> a[3 < a <= 6]
Traceback (most recent call last):
File "<s... | <p>You need to do:</p>
<pre><code>a[(3 < a) & (a <= 6)]
</code></pre>
<p>It's a "wart" in python. In python <code>(3 < a <=6)</code> is translated to <code>((3 < a) and (a <= 6))</code>. However numpy arrays don't work with the <code>and</code> operation because python doesn't allow overloading ... | python|numpy | 6 |
2,199 | 15,466,274 | Maximum recursion depth exceeded when using a numpy.bytes_ object in string formatting | <p>The code should speak for itself:</p>
<pre><code>$ python
Python 3.3.0 (default, Dec 22 2012, 21:02:07)
[GCC 4.7.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy as np
>>> '{}'.format(np.bytes_(b'Hello'))
Traceback (most recent call last):
File... | <p>The behaviour of <code>{}</code> is to call <code>np.bytes_(b'Hello').__format__()</code>. It seems there is a bug where <code>__format__</code> is calling itself. See this <a href="https://github.com/numpy/numpy/issues/385" rel="nofollow">related ticket</a></p>
<p>Here is a workaround.</p>
<pre><code>Python 3.2.3... | python|numpy|python-3.x | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.