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 |
|---|---|---|---|---|---|---|
368,800 | 67,204,047 | Integrating a histogram in a bootstrap simulation graph | <p>I have a dataframe with 1000 simulations of a portfolio's returns. I am able to graph the simulations and do the respective histogram separately, but I have absolutely no idea how to merge them in order to resemble the following image:</p>
<p><a href="https://i.stack.imgur.com/oQxO8.png" rel="nofollow noreferrer"><i... | <p>To color the curves via their last value, they can be drawn one-by-one. With a colormap and a norm, the value can be converted to the appropriate color. Using some transparency (<code>alpha</code>), the most visited positions will be colored stronger.</p>
<p>In a second subplot, a vertical histogram can be drawn, wi... | python|pandas|matplotlib|histogram|simulation | 2 |
368,801 | 67,316,078 | Reading Tensorflow Dataset changes bahaviour of `take()` and `skip()` | <p>I am trying to inspect the labels inside my tensorflow dataset. However, the values of the labels change to something unexpected after using <code>take()</code> and <code>skip()</code>, depending on whether I inspect the data or not. (It looks like within the labels some ones changed to zeros.) I do not see any way ... | <p>When the dataset is exhausted (i.e, after you iterated through it once), it will redo all the operations. In your case, because you are shuffling, the shuffle for the first epoch will be different than the shuffling for the second.</p>
<p>What it means is that your training set and testing set are actually <strong>n... | python|tensorflow|tensorflow-datasets | 1 |
368,802 | 67,533,039 | Tensorflow / Keras : Input 0 of layer lstm is incompatible with the layer: expected ndim=3, found ndim=2 | <p>I'm trying to implement a Federated training Keras / Tensorflow model for <em>detecting fake news in text articles</em>, but I have trouble with the model. When I try to run the code I get the following error:</p>
<pre><code> ValueError: Input 0 of layer lstm is incompatible with the layer: expected ndim=3, found nd... | <p>The dataset format is saying the shape of the input <code>x</code> is <code>(None,)</code> (ndim/rank, = 1) and dtype <code>tf.string)</code>. The <code>None</code> comes from the fact that the dataset may yield batches that aren't "full", so in practice the first dimension is in the range <code>[1, BATCH_... | python|tensorflow|machine-learning|keras|tensorflow-federated | 2 |
368,803 | 67,197,725 | How to multiply a single layer of a neural network by a real number? | <p>The question's pretty straightforward. I want to multiply a single layer in my neural network by a number.</p>
<p>This number is <code>n = max(abs(input))</code>, so that the actual input will be <code>input/n</code>, while the output will be <code>output*n</code>. I want to know if there's a way to insert these cal... | <p>If I got it correctly, you want to multiply the output of a layer by a scalar quantity <code>n</code>. You can use a custom model:</p>
<pre><code>class MyModel(tf.keras.Model):
def __init__(self):
super(MyModel, self).__init__()
self.dense1 = Dense(10)
self.dense2 = Dense(20)
def ca... | python|tensorflow|neural-network | 1 |
368,804 | 67,450,931 | Sorting method not comparing single digits Python | <p>I'm trying to do a sort by descending order using pandas in python with the percentage column, unfortunately, it's not comparing 1 digit with 2 digit floats.</p>
<p>This is my code:</p>
<pre><code>col = ['Amino Acid', 'Frequency', 'Percentage']
Pdf = pd.DataFrame(Ptable, columns=col)
Pdf = Pdf.sort_values('Percenta... | <p>This has to be problem with the datatype, I suggest you to check the dtype of the column:</p>
<pre><code>df.dtypes
</code></pre>
<p>And typecast the column and then try again if its not float:</p>
<pre><code>df['Percentage'] = df['Percentage'].astype(float)
</code></pre> | python|pandas|dataframe|sorting | 3 |
368,805 | 67,512,435 | Remove all the duplicated values for each list that is into de DataFrame column | <p>I have the following dataframe, and i want to remove all the duplicated values for each list that is into de DataFrame column num_ent.</p>
<p>I would like that the return value will be the column num_ent but without repeated values for each list.</p>
<pre><code>import pandas as pd
data = {'id': [287, 3345, 3967, 70... | <p>A simple solution to this is to cast your list as a set, then back to a list.</p>
<pre><code>df['num_ent'] = df.apply(lambda x: list(set(x['num_ent'])), axis=1)
</code></pre>
<p>Output</p>
<pre><code> id num_ent
0 287 [0, 1, 2, 3, 4, 5, 6, 7]
1 ... | python|pandas|dataframe | 0 |
368,806 | 67,448,057 | Pandas interpolate missing values based on other columns criteria | <p>I have the current dataframe:</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th>Date</th>
<th>Source</th>
<th>Type</th>
<th>Visits</th>
<th>Sales</th>
</tr>
</thead>
<tbody>
<tr>
<td>01/01/2020</td>
<td>Source1</td>
<td>Type1</td>
<td>100</td>
<td>10</td>
</tr>
<tr>
<td>01/01/2020</td>
<td... | <p>One idea is change the NAN - of median or mean.</p>
<pre><code>df['visits'].fillna(df['visits'].median(), inplace=True)
df.fillna(df.mean())
</code></pre>
<p><a href="https://i.stack.imgur.com/GAhOz.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/GAhOz.png" alt="enter image description here" /></a... | python|pandas|interpolation|missing-data | 0 |
368,807 | 67,362,795 | Numpy: compare two arrays and create a mask | <p>I have to np.arrays, say <code>[1, 2, 3, 4]</code> and <code>[1, 2]</code>. I want to create a mask for the first one, such that for every element in the first array, if it is also in the second array, then the value is 1, else 0. Sample outputs:</p>
<pre class="lang-py prettyprint-override"><code>a = [1, 2, 3, 4]
b... | <p>Numpy has a built in function to do exactly this : <code>np.isin</code></p>
<p>example:</p>
<pre><code>>>> import numpy as np
>>> x = np.array([1,2,3,4])
>>> y = np.array([1,2])
>>> np.isin(x,y)
array([ True, True, False, False])
</code></pre>
<p>if for whatever reason you had li... | python|numpy | 1 |
368,808 | 67,350,545 | Ordering arrays creation for two arrays with different arranged-arguments of arrays to apply on one of them to convert its orderings as another | <p>I need to rearrange each arrays (<em><code>type = numpy.ma.core.MaskedArray</code></em>) inside 'array1' (<em><code>type = numpy.ma.core.MaskedArray</code></em>) based on argument's order of each arrays (<em><code>type = numpy.ndarray</code></em>) of 'array2' (<em><code>type = numpy.ndarray</code></em>). Arrays by s... | <p>Your 2 arrays:</p>
<pre><code>In [189]: array1
Out[189]:
masked_array(
data=[[20, 30, 35],
[5, 6, 10],
[11, 4, 7]],
mask=[[False, False, False],
[False, False, False],
[False, False, False]],
fill_value=999999)
In [190]: array2
Out[190]:
array([[35, 20, 30],
[10, 6, 5... | python|arrays|python-3.x|numpy|numpy-ndarray | 0 |
368,809 | 67,570,742 | What is the best way to find mid points of 1s groups in a python array consist of ones and zeros? | <p>I have arrays which contain zeros and ones. I want to find the indexes of middle points of each consecutive 1s groups.
eg:
<code>array = [0,0,0,1,1,1,0,0,1,1,1,1,1,0,0]</code></p>
<p>Then from each consecutive 1s group, the indexes of middle 1s are <br>
<code>4 -> from first group</code><br>
<code>10 -> from s... | <p>Here is a numpy solution for improved speed:</p>
<pre><code>import numpy as np
array = [1,0,0,0,1,1,1,0,0,1,1,1,1,1,1,0,0,1]
#padding the array with 0 to ensure that first and last elements are not neglected
arr = np.asarray([0] + array + [0])
#finding borders between 0 and 1
arr_diff = np.diff(arr)
#finding index... | python|arrays|numpy | 2 |
368,810 | 67,294,409 | Left shift with condition in pandas | <p>I have some problems with a csv file, I have tried several solutions through the pandas library but none has worked for me, I want to make a left shift to 3 columns in case that in one of them appears a certain code (in this case 11 or 22), for example, this would be my input:</p>
<div class="s-table-container">
<ta... | <p>Do you want this?</p>
<pre><code>mask = df['code'].isin([11,22])
df.loc[mask] = df.loc[mask].shift(-3,axis=1)
</code></pre>
<p><strong>Output -</strong></p>
<pre><code> code name % code 2 name 2 % 2 code 3 name 3 % 3
0 44.0 Rob 23.0 33.0 Peter 15.0 NaN NaN NaN
1 33.0 Peter 45.0... | python|pandas|database|csv|data-science | 3 |
368,811 | 67,565,136 | Pandas calculate manually for variance | <p>1.For a unique location, iterate through the dataset once to calculate the mean of the Kilometers_Driven.</p>
<p>2.For the same unique location, iterate through the dataset once more to calculate the variance of the Kilometers_Driven.</p>
<p>3.Repeat for all of the unique locations. Iteratively, calculate the mean a... | <p>Try this</p>
<pre><code>import pandas as pd
data = pd.read_csv('train-data.csv', header=0)
data.groupby('Location')['Kilometers_Driven'].mean()
data.groupby('Location')['Kilometers_Driven'].var()
</code></pre> | python|pandas|dataframe|var | 0 |
368,812 | 67,469,654 | Update categories in two Series / Columns for comparison | <p>If I try to compare two Series with different categories I get an error:</p>
<pre><code>a = pd.Categorical([1, 2, 3])
b = pd.Categorical([4, 5, 3])
df = pd.DataFrame([a, b], columns=['a', 'b'])
a b
0 1 4
1 2 5
2 3 3
df.a == df.b
# TypeError: Categoricals can only be compared if 'categories' are the same... | <p>One idea with <code>union_categoricals</code>:</p>
<pre><code>from pandas.api.types import union_categoricals
union = union_categoricals([df.a, df.b]).categories
df['a'] = df.a.cat.set_categories(union)
df['b'] = df.b.cat.set_categories(union)
print (df.a == df.b)
0 False
1 False
2 True
dtype: bool
</cod... | pandas|numpy|categorical-data | 2 |
368,813 | 67,393,421 | Is there any nicer way to aggregate multiple columns on same grouped pandas dataframe? | <p>I am trying to figure out how should I manipulate my data so I can aggregate on multiple columns but for same grouped pandas data. The reason why I am doing this because, I need to get stacked line chart which take data from different aggregation on same grouped data. How can we do this some compact way? can anyone ... | <p>This answer builds on the one by Andreas who has already answered the main question of how to produce aggregate variables of multiple columns in a compact way. The goal here is to implement that solution specifically to your case and to give an example of how to produce a single figure from the aggregated data. Here... | python|pandas|matplotlib | 1 |
368,814 | 67,492,189 | How to sort aggregated numpy array? | <p>My first post on stackoverflow + am very new to programming. Apologies in advance for any poor formatting and missing information. :)</p>
<p>I aggregated two columns in a csv file (one column of seller names, the other of transactional amounts) to find how much each seller has made in total:</p>
<pre><code>seller_gr... | <p>Try <a href="https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.sort_values.html#pandas-dataframe-sort-values" rel="nofollow noreferrer"><code>.sort_values()</code></a>:</p>
<pre class="lang-py prettyprint-override"><code>df_out = seller_group.aggregate({'price_paid':np.sum}).sort_values(by=... | python|dataframe|numpy|aggregate | 1 |
368,815 | 67,505,400 | Identity index for NumPy array | <p>Suppose I have a flat NumPy array <code>a</code> and want to define an index array <code>i</code> to index <code>a</code> with and thus obtain <code>a</code> again by <code>a[i]</code>.</p>
<p>I tried</p>
<pre><code>import numpy as np
a = np.array([1,2]).reshape(-1)
i = True
</code></pre>
<p>But this does not preser... | <p>Numpy can not preserve the shape of a boolean masked result because it may be ragged. When you pass in a single boolean scalar, things get special-case weird.</p>
<p>You must therefore use a fancy index. With a fancy index, the shape of the result is exactly the shape of the index. For a 1-D array the following is f... | python|arrays|numpy | 1 |
368,816 | 67,252,411 | Get Index of data point in training set with shortest distance to input matrix with Numpy | <p>I would like to build a function npbatch(U,X) which compares data points in an input matrix (U) with data points in a training matrix (X) and gets me the index of X with the shortest euclidean distance to the data point in U.
I would like to avoid any loops to increase the performance and I would like to use the fun... | <p>With <code>scipy.spatial.distance.cdist</code> you already chose a well-suited function for the task. To get the indices, we just have to apply <a href="https://numpy.org/doc/stable/reference/generated/numpy.argmin.html" rel="nofollow noreferrer"><code>numpy.argmin</code></a> along the axis 0 (or axis 1 for <code>cd... | python|numpy|scipy|euclidean-distance | 0 |
368,817 | 67,268,050 | Test Train Dataframe for multiple columns | <p>I have a csv file</p>
<pre><code>Date,Open,High,Low,Close,Adj Close,Volume,Cash EPS,Book Value,Div/share,Net profit/share,NPM,ROE,ROCE,ROA,DEBT/EQ,ATR,CR
2004-04-26,82.924217,82.924217,82.924217,82.924217,60.026066,0,221.24,488.21,129.5,186.6,26.11,38.22,38.22,24.2,0,92.67,1.65
2004-04-27,82.778122,82.778122,79.7656... | <p>If I understand the question, you're looking for a multi-variate time-series model. In other words, it take multiple variable inputs for each time step in order to make forward looking predictions. Here's a link to some examples:</p>
<p><a href="https://www.relataly.com/stock-market-prediction-with-multivariate-ti... | python|pandas|numpy|scikit-learn|data-science | 1 |
368,818 | 34,795,032 | Wrong dtype for a feed to the placeholder x-input TensorFlow | <p>I want to implement a simple logistic regression on MNIST with TF that I just installed and want to monitor the progress of the minibatch-SGD with TensorBoard. </p>
<p>I first did without tensorboard it compiled and got 0.9166 accuracy on testset.</p>
<p>However when I added tensorboard to see what was going on I... | <p>It turns out you cannot run the same script over and over when I reopened a new spyder and launched the program it worked !!!
Mind=blown</p> | tensorflow|mnist|tensorboard | 0 |
368,819 | 34,598,752 | Avoid Pandas implicit conversion of None to NaN in column tuple | <p>I have a Pandas DataFrame whose columns are labeled with Python tuples. </p>
<p>These column labeling tuples can have None in them.</p>
<p>When I attempt to add columns to a data frame using either of the following approaches, the None in the labeling tuples are implicitly converted to a numpy.nan.</p>
<p>Approa... | <p>DataFrame columns and rows are different. DataFrame columns can be accessed by header name, so without more context it might not make sense to not use None, i.e. see how the 'foo' column is accessed below. There is also a optional index. If the index is left out it becomes consecutive integers. </p>
<pre><code>im... | python|pandas | 0 |
368,820 | 34,568,874 | Pandas: How do I split multiple lists in columns into multiple rows? | <p>I have a pandas <code>DataFrame</code> that looks like the following:</p>
<pre><code> bus_uid bus_type type obj_uid \
0 biomass: DEB31 biomass output Simple_139804698384200
0 biomass: DEB31 biomass other duals
0 biomass: DEB31 ... | <p>You can extract from columns <code>values</code> and <code>datetime</code> new <code>Series</code> and then merge them with original dataframe <code>df</code> by <a href="http://pandas.pydata.org/pandas-docs/stable/generated/pandas.concat.html" rel="nofollow"><code>concat</code></a>:</p>
<pre><code>s1 = df['values'... | python|list|pandas|dataframe | 2 |
368,821 | 34,699,641 | How do I set cell values in `np.array()` based on condition? | <p>I have a <code>numpy</code> array and a list of valid values in that array:</p>
<pre><code>import numpy as np
arr = np.array([[1,2,0], [2,2,0], [4,1,0], [4,1,0], [3,2,0], ... ])
valid = [1,4]
</code></pre>
<p>Is there a nice pythonic way to <strong>set all array values to zero, that are not in the list</strong> of... | <p>You can use <a href="http://docs.scipy.org/doc/numpy-1.10.1/reference/generated/numpy.place.html" rel="nofollow"><code>np.place</code></a> for an <code>in-situ</code> update -</p>
<pre><code>np.place(arr,~np.in1d(arr,valid),0)
</code></pre>
<p>Sample run -</p>
<pre><code>In [66]: arr
Out[66]:
array([[1, 2, 0],
... | python|arrays|numpy | 3 |
368,822 | 34,783,030 | Saving image files in Tensorflow | <p>I'm just starting with Tensorflow and I have a newbie question.</p>
<p>I know that Tensorflow is all about neural nets but I'm starting with just the mechanics of it. I'm trying to get it to load, resize, flip, and save two images. Should be a simple operation, right, and it gets me started with the basics.</p>
<p... | <p>This warning is perfectly normal. As stated in the <a href="https://www.tensorflow.org/versions/master/api_docs/python/io_ops.html#string_input_producer" rel="noreferrer">TensorFlow API</a></p>
<blockquote>
<p>num_epochs: An integer (optional). If specified, string_input_producer
produces each string from strin... | tensorflow | 9 |
368,823 | 34,737,724 | get only numeric columns in python blaze object | <p>I have a <code>blaze</code> data object like this</p>
<pre><code>import blaze as bz
bdata = bz.Data([(1, 'Alice', 100.9),
(2, 'Bob', 200.6),
(3, 'Charlie', 300.45),
(5, 'Edith', 400)],
fields=['id', 'name', 'amount'])
bdata
| id | name | amount
----------------------... | <p>There could be an easier way. Here's one way to accomplish it</p>
<pre><code>In [75]:
def get_numeric_cols(dshape):
shape = dshape.parameters[-1].dict
cols = []
for k in shape:
type = str(shape[k])
if type.startswith("int") or type.startswith("float"):
cols.append(k)
retu... | python|python-3.x|pandas|blaze | 0 |
368,824 | 34,750,268 | Extracting the top-k value-indices from a 1-D Tensor | <p>Given a 1-D tensor in Torch (<code>torch.Tensor</code>), containing values which can be compared (say floating point), how can we extract the indices of the top-<em>k</em> values in that tensor?</p>
<p>Apart from the brute-force method, I am looking for some API call, that Torch/lua provides, which can perform this ... | <p>As of pull request <a href="https://github.com/torch/torch7/pull/496" rel="noreferrer">#496</a> Torch now includes a built-in API named <a href="https://github.com/torch/torch7/blob/03c04c6/doc/maths.md#torchtopkresval-resind-x-k-dim-dir-sort" rel="noreferrer"><code>torch.topk</code></a>. Example:</p>
<pre><code>&g... | python|lua|pytorch|torch | 7 |
368,825 | 34,768,082 | numpy array to a file, np.savetxt | <p>What is the best way to save more than one numpy array to a file, when I use np.savetxt(´file.txt´, (arr1,arr2,arr3))
The arrays are saved column-wise and not row-wise, making it difficult to import into excel.
How to a save the array in a more standard way?</p>
<p>Thanks </p> | <p>I have almost direct answer to this is outlined here <a href="http://rinocloud.github.io/rinocloud-tutorials/saving-data-with-numpy" rel="nofollow">http://rinocloud.github.io/rinocloud-tutorials/saving-data-with-numpy</a> </p>
<p>Using vstack</p>
<h2>Saving multiple arrays from numpy with vstack</h2>
<p>Say we ha... | python|numpy | 4 |
368,826 | 34,535,540 | Python Pandas Compare 2 Large DataFrames of Text for Similarity | <p>I have two large dataframes I want to compare. I want a comparison result capable of a column and / or row wise comparison of similarities by percent. <em>This part is simple.</em> However, I want to be able to make the comparison ignore differences based upon value criteria. A small example is below.</p>
<pre><co... | <p>Below, I'm interpreting <em>"when one is '--' basically always be true"</em> to mean that any comparison against <code>'--'</code> (no matter what the other value is) should return True. In that case, you could use</p>
<pre><code>mask = (df1=='--') | (df2=='--')
</code></pre>
<p>to find every location where either... | python|pandas|dataframe | 1 |
368,827 | 34,489,141 | How to use group by and return rows with null values | <p>I have a data set like below on emails and purchases. </p>
<pre><code>Email Purchaser order_id amount
a@gmail.com a@gmail.com 1 5
b@gmail.com
c@gmail.com c@gmail.com 2 10
c@gmail.com c@gmail.com 3 5
</code></pre>
<p>I want to find the total number ... | <p>It is not implemented in pandas now - <a href="https://github.com/pydata/pandas/issues/3729" rel="nofollow">see</a>.</p>
<p>So one awful solution is replace <code>NaN</code> to some string and after <code>agg</code> replace back to <code>NaN</code>:</p>
<pre><code>table['Purchaser'] = table['Purchaser'].replace(np... | python|numpy|pandas|dataframe|missing-data | 4 |
368,828 | 34,545,025 | How to change both negative and Nan column value to Zero in Pandas | <p>My Data frame is like :</p>
<pre><code> A B
10 AAA 0.0333
20 BBB -67
30 CCC -0.98
40 DDD NaN
</code></pre>
<p>How do I change the column B values (only negative and NaN to 0)</p>
<p>So far I tried Like :</p>
<pre><code>df[df< 0 ] = 0
df.fillna(0, inplace=True)
</code></pre>
<p>But is there a ef... | <p>You can use <a href="http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.loc.html" rel="noreferrer"><code>loc</code></a> and <a href="http://pandas.pydata.org/pandas-docs/stable/generated/pandas.Series.isnull.html" rel="noreferrer"><code>isnull</code></a>:</p>
<pre><code>df.loc[(df['B'] < 0) |... | python|pandas|dataframe | 6 |
368,829 | 34,479,475 | Using Pandas DataFrame to Generate Trading Signals | <p>I have two DataFrames with the following layouts:</p>
<p>QUOTES DataFrame</p>
<pre><code>DATE PRICE SMA
2008-06-25 107.505122 106.480321
2008-06-26 107.138449 103.531552
2008-06-27 106.737588 102.608466
2008-06-30 106.360232 101.309296
2008-07-01 105.993987 101.941783
2008-07-02 1... | <p>Here's a sketch of how you could track the balance of your entry/exit signals so you only signal exit when there's a previous entry not yet canceled by subsequent exit:</p>
<p>Starting with:</p>
<pre><code> date entry exit
0 2008-06-25 0 0
1 2008-06-26 0 1
2 2008-06-27 1 0
3 200... | python|pandas|quantitative-finance | 1 |
368,830 | 34,598,632 | Python Numpy - Square Values Issue | <p>I'm trying to square all the elements in a numpy array but the results are not what I'm expecting (ie some are negative numbers and none are the actual square values). Can anyone please explain what I'm doing wrong and/or whats going on?</p>
<pre><code>import numpy as np
import math
f = 'file.bin'
frameNum = 25600
... | <p>It is because of the <code>dtype=np.int16</code>. You are allowing only 16 bits to represent the numbers, and <code>-5302**2</code> is larger than the maximum value (32767) that a signed 16-bit integer can take. So you're seeing only the lowest 16 bits of the result, the first of which is interpreted (or, from yo... | python|numpy | 4 |
368,831 | 60,273,737 | 'tensorflow' has no attribute 'Session' | <p>I am trying to convert a Tensor to a numpy array.
The tensor i have has a shape as below</p>
<pre><code>LastDenseLayer.output.shape
TensorShape([None, 128])
</code></pre>
<p>When i am running the code as below, </p>
<pre><code>with tf.Session() as sess:
LastLayer = LastDenseLayer.output.eval()
</code></pre>
... | <p>TensorFlow 2.x removed <code>tf.Session</code> because eager execution is now a default. Please refer to the <a href="https://www.tensorflow.org/guide/migrate#1_replace_v1sessionrun_calls" rel="nofollow noreferrer">TensorFlow migration guide</a> for more information.</p> | python|tensorflow|keras | 1 |
368,832 | 60,076,405 | How to do the following entry gathering? | <p>I want <code>out[b,i,j,c]:=params[indices[b,i,j,c],b,i,j,c]</code>. I am aware of <a href="https://www.tensorflow.org/api_docs/python/tf/gather" rel="nofollow noreferrer"><code>tf.gather</code></a> and <a href="https://www.tensorflow.org/api_docs/python/tf/gather_nd" rel="nofollow noreferrer"><code>tf.gather_nd</cod... | <p>You can do that like this:</p>
<pre><code>import tensorflow as tf
# 5D or more tensor
params = tf.placeholder(tf.float32, [2, 3, 4, 5, 6])
# 4D tensor
indices = tf.placeholder(tf.int32, [5, 4, 3, 2])
# We assume the number of dimensions of indices is statically known
# Otherwise you would need to use tf.while_loop... | python-3.x|tensorflow | 1 |
368,833 | 59,948,932 | Select rows in a dataframe based on number of columns equal to True | <p>I'd like to identify all rows, where 4 from 5 columns are True i.e. </p>
<pre><code> df = pd.DataFrame(
[
[0, 0, 0, 0, 0],
[1, 1, 1, 1, 1],
[1, 1, 1, 1, 0],
[0, 0, 0, 0, 0],
[1, 1, 1, 0, 1],
],
index=["abc", "def", "ghi", "jkl", ... | <p>Use <code>sum</code> of columns and compare by number of values, here <code>4</code> with <a href="http://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.Series.eq.html" rel="nofollow noreferrer"><code>Series.eq</code></a> and filter by <a href="http://pandas.pydata.org/pandas-docs/stable/user_guide/indexi... | python|pandas|dataframe | 3 |
368,834 | 60,287,578 | Groupby mutate equivalent in pandas/python using tidydata principles | <p>My dataframe resembles the following:</p>
<pre><code>group_var1 = ['A1','A1', 'A1', 'A1', 'A1', 'A1', 'A1', 'A1', 'A2', 'A2', 'A2', 'A2', 'A2', 'A2', 'A2', 'A2']
group_var2 = ['B1', 'B1', 'B1', 'B1', 'B2', 'B2', 'B2', 'B2', 'B1', 'B1', 'B1', 'B1', 'B2', 'B2', 'B2', 'B2']
group_var3 = ['C1', 'C2', 'C1', 'C2', 'C1', ... | <p>Use <code>transform</code> and <code>assign</code>:</p>
<pre><code>ex_df.assign(
mean_val =
ex_df
.groupby(["group_var1", "group_var2", "group_var3"])
.value
.transform('mean')
)
group_var1 group_var2 group_var3 value mean_val
0 A1 B1 C1 0 1
1 ... | python|r|pandas|dplyr | 1 |
368,835 | 60,070,732 | how to create your own list of punctuation to be removed in python | <p>I want to remove punctuation from different kind of scripts, English, Arabic and so on if I used the normal way using pandas when reading the dataframe, for the English part it works fine but when there is script change, it will remove all the punctuation and anything which is not letters which I don't want, so is t... | <p>Here is necessary espace some special regex characters like <code>.</code> or <code>?</code>:</p>
<pre><code>dataframe['columnname'] = dataframe['columnname'].str.replace("[,\?!\.:;']", '')
</code></pre>
<p>Or use <code>re.escape</code>:</p>
<pre><code>import re
pat = '[' + re.escape(",?!.:;'") + ']'
print (pat)... | python|pandas|dataframe|punctuation | 2 |
368,836 | 60,183,643 | Machine Generation of Art Patterns in Vector Fields | <p>I am trying to rewrite this article:<a href="https://proglib.io/p/risuem-programmiruya-mashinnaya-generaciya-hudozhestvennyh-uzorov-v-vektornyh-polyah-2020-02-06" rel="nofollow noreferrer">We draw, programming. Machine-generated generation of artistic patterns in vector fields</a> (Russian language) from pseudo-code... | <p>I believe you need to take a look at meshgrid from numpy</p>
<p>from the meshgrid documentation examples:</p>
<pre><code>x = np.arange(-5, 5, 0.1)
y = np.arange(-5, 5, 0.1)
xx, yy = np.meshgrid(x, y, sparse=True)
z = np.sin(xx**2 + yy**2) / (xx**2 + yy**2)
h = plt.contourf(x,y,z)
</code></pre>
<p>Edit. After seei... | python|numpy|matplotlib|machine-learning|massive | 1 |
368,837 | 60,066,814 | Tensorflow2.0 MultiWorkerMirroredStrategy example hangs | <p>I followed the example from official tensorflow website.<br>
<a href="https://www.tensorflow.org/tutorials/distribute/multi_worker_with_keras" rel="nofollow noreferrer">https://www.tensorflow.org/tutorials/distribute/multi_worker_with_keras</a> </p>
<p>Here is my spec<br>
WSL<br>
Ubuntu 16.04.6 LTS<br>
Tensorflow2... | <p>Are you running the tfexample.py on two sessions with the correct TFconfig. I haven't tried two instances on the same machine </p> | tensorflow2.0 | 1 |
368,838 | 60,044,177 | Multiplying two multiindex dataframes with different but similar indices and columns | <p>Please consider these two dataframes.</p>
<pre><code>import pandas as pd
cols = ['F', 'D']
s_ind = pd.MultiIndex.from_arrays([['A', 'A', 'A'], ['B', 'B', 'B'], ['C', 'C', 'C'], ['D', 'E', 'F']],
names=('cat1', 'cat2', 'cat3', 'cat4'))
s = pd.DataFrame(data=[[1,4], [2,5], [3,6]], c... | <p>you can try <a href="https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.unstack.html" rel="nofollow noreferrer"><code>unstack</code></a> for <code>s</code> and <a href="https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.mul.html" rel="nofollow noreferrer"><code>multi... | python|pandas|dataframe|multi-index | 4 |
368,839 | 60,091,890 | BertForNextSentencePrediction - Converting logits into boolean values? | <p>I am trying to use the Next Sentence Prediction model that is pre-trained in BERT.</p>
<p>I'm using the example in the class <code>TFBertForNextSequencePrediction</code>. I understand that the seq_relationship_score returns the logits that point out if the next sentence belongs to previous context or not. I tried w... | <p>Invert the logits to get back probabilities. Then rank the probabilities in reverse to get the nearest sentences. You don't need to use the softmax here as you're looking at similarity.</p> | python|tensorflow|keras | 0 |
368,840 | 60,243,181 | Multiple Categorical Variables in a Column & The Prep | <p>I have a survey data, with text answers, categorical variables, and numeric.</p>
<p>Converted into a dataframe in pandas, but the problem is multiple-choice columns, sometimes have more than 1 categorical variables, because the survey was designed as "choose all applies".</p>
<p>For example:</p>
<pre><code>ID Ca... | <p>We could use <code>cSplit_e</code> from <code>splitstackshape</code> in <code>R</code></p>
<pre><code>library(splitstackshape)
cSplit_e(df1, "Category", type = "character", fill = 0, sep=",\\s*", fixed = FALSE)
# ID Category Num1 Num2 Num3 Category_A Category_B Category_C Category_D
#1 1 A, B, C 1 1 1... | python|r|excel|pandas|statistics | 1 |
368,841 | 60,194,755 | OpenCV read images from pyspark and pass to a Keras model | <p>This is a follow-up question to the answer posted <a href="https://stackoverflow.com/a/52274419/554481">here</a>. I'm using PySpark 2.4.4. I have a bunch of images (some .png some .jpeg) stored on Google Cloud Storage (GCS) that I need to pass to a Tensorflow model. I'm getting my images like this.</p>
<pre><code>i... | <p>Not sure if this is what you are looking for, but I was able to achieve by converting PIL images to cv2 image.</p>
<p><strong>Spark loading :</strong>
<div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html pret... | python|numpy|apache-spark|opencv|pyspark | 0 |
368,842 | 59,980,909 | Pandas replace nan with first non-nan value based on another column | <p>I have a dataframe of the following form: (many more columns than just these - removed for brevity)</p>
<pre><code>import pandas as pd
headers = ['A','B','C']
data = [['p1','','v1'],
['p2','','ba'],
['p3',9,'fg'],
['p1',1,'fg'],
['p2',45,'af'],
['p3',1,'fg'],
['p1',1... | <p>First replace empty strings to missing values and then use <a href="http://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.core.groupby.GroupBy.transform.html" rel="nofollow noreferrer"><code>GroupBy.transform</code></a> with <a href="http://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.core.gr... | python|pandas|dataframe|for-loop | 1 |
368,843 | 60,213,893 | Reconstruct original signal with FFT in python | <p>I have an analitically generated spectrum, where x axis represents angular frequency, y represents intensity. The spectrum is centered around some frequency value, which is often called central frequency of the signal (blue graph on the picture).
I want to perform IFFT on the data to time domain, cut its useful part... | <p>I think that <code>fftfreq</code> does not do what you think it does. The <code>xf</code> for <code>fft(ifft(y)</code> is identical to <code>x</code>, you should not try to re-compute it. The x-axis doesn't change when going to another domain and then back again.</p>
<p>Also, do note that <code>fftfreq</code> retur... | python|numpy|scipy|fft | 2 |
368,844 | 60,058,552 | When i log transform pandas column i get NaNs should i replace these with 0? | <p>I cannot find a similar question. But i have a df with some columns highly skewed. I then plan to log transform these columns then standardize. However when i log transform i then get NaNs, should i replace these with 0;s? </p>
<pre><code>log_train[skew_cols]=np.log2(featuresdf[skew_cols]
</code></pre>
<p>error i ... | <p>You shouldn't replace with 0's, because np.log(1) is equal to 0. So then both 1, and 0 will be 0 in your log data.</p>
<p>Instead, just +1 your data prior to the log. Therefore log2(1) becomes 0, log2(2) (which was 1) is still 1, then log2(3) (which was 2) is now 1.58)</p>
<p>So the code would be:</p>
<pre><code>... | pandas|normalization|logarithm | 3 |
368,845 | 59,993,625 | Log messages classification/grouping and finding human readable pattern for each group | <p>As new to data science and machine learning I would like to ask the following questions about the problem explained below:</p>
<ul>
<li>Is machine learning good for such problem or is it overkill?</li>
<li>Could this problem be related with another classical problem that has already published papers so I can choose... | <p>As you have pointed out, it sounds like we can separate this problem into two distinct steps.<br></p>
<ol>
<li>Group together similar messages, and</li>
<li>Label each group.
<br>
<br>
<strong>Step 1:</strong></li>
</ol>
<p>While I am not too familiar with Tensorflow JS, I do not believe it is overkill to use Mac... | tensorflow|machine-learning|classification|cluster-analysis|data-mining | 3 |
368,846 | 60,295,702 | Pandas combine Hour and Minute column to time | <p>I'm trying to combine Hour column and Minute column into HH:MM format </p>
<p>I tried the following </p>
<pre><code>time = pd.to_timedelta(df['HOUR'],unit='h') + pd.to_timedelta(df['MINUTE'],unit ='m')
time = pd.to_datetime(report_time).dt.time
</code></pre>
<p>This is working, however it shows</p>
<pre><code>... | <p>Convert both columns to strings, add separator and use <a href="http://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.to_datetime.html" rel="nofollow noreferrer"><code>to_datetime</code></a> with <code>format</code> parameter:</p>
<pre><code>time = (pd.to_datetime(df['Hour'].astype(str) + ':' + df['Minut... | python|pandas | 3 |
368,847 | 59,937,113 | Indexing stock price returns to 100 at start date | <p>I have a dataset that contains daily percentage returns for different stock industries. The full dataset is too big to show here but here's a dummy dataframe with more or less the same structure: </p>
<pre><code>df = pd.DataFrame(np.array([['01/01/2020', 'energy', 0.25], ['01/02/2020', 'energy', -2], ['01/01/2020',... | <p>Use <a href="https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.core.groupby.DataFrameGroupBy.cumsum.html" rel="nofollow noreferrer"><code>GroupBy.cumsum</code></a> setting the first value of <code>return</code> for each industry with <a href="https://pandas.pydata.org/pandas-docs/stable/reference/api... | python|pandas|numpy | 1 |
368,848 | 60,065,428 | How to define an embedding column in tensorflow 2.0? | <p>I'm new to Tensorflow and I was following this tutorial using my csv data from local drive <a href="https://www.tensorflow.org/tutorials/structured_data/feature_columns" rel="nofollow noreferrer">https://www.tensorflow.org/tutorials/structured_data/feature_columns</a>, I could load the csv file and print column head... | <p>According to Tensorflow documentation about Embedding columns: </p>
<blockquote>
<p>Suppose instead of having just a few possible strings, we have
thousands (or more) values per category. For a number of reasons, as
the number of categories grow large, it becomes infeasible to train a
neural network using o... | csv|dataset|tensorflow2.0 | 1 |
368,849 | 59,905,497 | How do I get an array to work from a Series object that was converted from a dataframe object? | <p>I have this dataframe object that is converted into a Series object and then getting an array from it. However, the array output does not have anything in it. I have included a similar example to help with the problem. Why is the array showing none in it?</p>
<pre><code>compensation1 = compensation.assign(
Tot... | <p>your code is trying to get the range (np.arange) between 950000 and 950000. Which is an empty array.
Try this instead:</p>
<pre><code>compensation1['Total_Cash_Dollars'].values
</code></pre> | python|pandas | 0 |
368,850 | 60,020,648 | Select distinct values groupby column in pandas | <p>I have the following code <code>df1 = df.groupby(['ID_Customer', 'ID_product']).size()</code>
for calculation of number of rows for each product for each customer. There is one single row for each product for each customer in dataset. The result is the following df1 (part of)</p>
<pre><code> ID cust ID prod ... | <p>try this below code:</p>
<pre><code>df.groupby('ID_Customer')['ID_product'].count()
</code></pre>
<p>let me know if this works for you or not.</p>
<p>Thanks</p> | python|pandas | 0 |
368,851 | 60,284,571 | Last layer of CNN with SVM in the loss function | <p>How are you? I am trying to implement an SVM within of the keras cost function using
sklearn.svm. However, I always get errors. I believe the problem is to convert the y_true and y_pred tensor into a numpy array to be used in sklearn.svm. Then I need to convert the predicted results to tensor to be used in the cost ... | <p>Try this</p>
<pre><code>y_test = np.argmax(y_test , axis=1)
y_pred = np.argmax(y_pred , axis=1)
</code></pre> | tensorflow|keras|scikit-learn|svm|hinge-loss | 0 |
368,852 | 60,294,634 | Select first row when there are multiple rows with repeated values in a column | <p>I want to select the first row when there are multiple rows with repeated values in a column.</p>
<p>For example:</p>
<pre><code>import pandas as pd
df = pd.DataFrame({'col1':['one', 'one', 'one', 'one', 'one', 'one', 'one', 'one'],
'col2':['ID=ABCD1234', 'ID=ABCD1234', 'ID=ABCD1234', 'ID=ABCD5... | <p>You can use:</p>
<pre><code>df.drop_duplicates(subset = ['col2'], keep = 'first', inplace = True)
</code></pre> | python|pandas|dataframe | 10 |
368,853 | 60,123,626 | In python, how do I make a matrix of the number of times(how many rows) each value in one column occurs with values in another column? | <p>I have a filtered data frame that changes how many rows it has, depending on how the user filters it. I need to count how many times a value in one column matches with a value in another column for each row. for example: Lets say my DF is:
<a href="https://i.stack.imgur.com/khYmv.png" rel="nofollow noreferrer">samp... | <p>I was able to achieve your desired output like this:</p>
<pre><code>from collections import Counter
import pandas as pd
df = pd.DataFrame({'A':[500,500,300,400,400,300],'B':[10,10,20,10,20,30]})
inp = df.groupby('A')['B'].agg(Counter).to_frame()
out = pd.DataFrame.from_records(inp['B'].tolist(), index=inp.index).f... | python|pandas|numpy|dataframe|matrix | 0 |
368,854 | 60,269,154 | How to calculate the difference between two cumsum columns using Pandas | <p>I have the following data frame:</p>
<pre><code> duid start_date end_date
0 b2919f1eb 2019-08-26 2019-09-05
1 e372dedd4 2019-08-26 NaT
2 ba8147ce9 2019-09-09 2019-11-05
3 902c56036 2019-09-13 2019-10-01
4 16ec096a7 2019-09-17 2019-10-02
5 1faac1a15 2019-09-17 NaT
6 319fb59f5 20... | <p>You'll probably find it easier to leave the grouping key as a datetime like object and then just reformat it at the end so sorting works correctly. (So pd.Grouper with a freq or .to_period(...) etc...)</p>
<p>Start with getting your initial aggregate figures and sort by the grouped index so your data is guaranteed ... | python|pandas | 2 |
368,855 | 59,987,704 | Converting to Markdown why not working properly without print() function pandas 1.0 | <p>I am trying this example <a href="https://pandas.pydata.org/pandas-docs/version/1.0.0/whatsnew/v1.0.0.html#converting-to-markdown" rel="nofollow noreferrer">Converting to Markdown</a>. Table markdown not formatting properly without <code>print()</code> function.</p>
<pre class="lang-py prettyprint-override"><code>&... | <p>to_markdown() function returns a string, it does not print it</p> | python|pandas|pandas-1.0 | 5 |
368,856 | 60,156,650 | How to concat several Multiindex Dfs to one df | <p>So, I have the following two Multiindex-Dfs:</p>
<pre><code>data = {('California', 0): 'LA',
('California', 1): 'SF',
('Texas', 0): 'HO',
('New York', 0): 'BX',
('New York', 1): 'NY'}
df= pd.Series(data)
df = pd.DataFrame(df)
df
#needs column name
df.index.names = ['state', 'Idx']
... | <p>You could use:</p>
<pre><code>(pd.concat([df.unstack('state'),
df2.unstack('state').rename(columns = {0:1}).reset_index(drop=True)]
,axis=1)
.stack().swaplevel().sort_index(level =0))
</code></pre>
<p>or</p>
<pre><code>df.join(df2.reset_index().drop(columns = 'X')
.set_index('st... | pandas|concatenation|multi-index | 1 |
368,857 | 60,062,831 | Create Forecasts Looping over SKUs and Export to CSV using Facebook Prophet | <p>I am new to Python so please bear with me.</p>
<p>I am trying to convert what I think may be a nested dictionary into a csv that I can export. Below is my code:</p>
<pre><code>import pandas as pd
import os
from fbprophet import Prophet
# Read in File
df1 = pd.read_csv('File_Path.csv')
#Create Loop to Forecast M... | <p>The following code should help flattening <code>df2</code> (dictionary of dataframes if I understand correctly).</p>
<pre><code>def flatten(dict_of_df):
# insert column 'item'
for key, value in dict_of_df.items():
value['item'] = key
# return vertically concatenated dataframe with all the items... | python|pandas|loops|facebook-prophet | 3 |
368,858 | 60,027,564 | Combine/Merge time interval rows in a sorted pandas dataframe | <p>I have a sorted pandas dataframe which looks like the following one:</p>
<pre><code>SessionNumber Timestamp_start Timestamp_complete Activity ColB ColC
2 2018-02-11 14:17:00 2018-02-11 14:21:00 "A" 3 4
2 2018-02-11 14:21:00 2018-02-11 14:22:30 "A" ... | <h3>Updated per comment and question change:</h3>
<p>Try this:</p>
<pre><code>Activitygrp = (df['Activity'] != df['Activity'].shift().bfill()).cumsum().rename('ActivityGroup')
df_m = (df.groupby(['SessionNumber', 'Activity', Activitygrp, 'ColB', 'ColC'])[['Timestamp_start', 'Timestamp_complete']]
.agg(Time_st... | python|pandas|dataframe|timestamp|timedelta | 1 |
368,859 | 60,316,162 | How to calculate an average number of an action per week having logins of users and time and date of the action using pandas? | <p>I have a dataset with logins and date and time of users' posts. </p>
<pre><code>posts = {'Login':['User1', 'User2', 'User2', 'User1', 'User2', 'User1', 'User2', 'User2'], 'Posted':['17.02.2020 12:32', '19.02.2020 10:11', '21.02.2020 07:08', '22.02.2020 14:00', '23.02.2020 11:02', '25.02.2020 18:19', '27.02.2020 00:... | <p>Try:</p>
<pre><code>df_posts.Posted = pd.to_datetime(df_posts.Posted)
(df_posts.groupby(['Login', pd.Grouper(key='Posted',freq='W')]).size()
.groupby('Login').mean()
.reset_index(name ='Avg_posts_per_week'))
Login Avg_posts_per_week
0 User1 1.5
1 User2 2.5
</... | python|pandas|pandas-groupby | 0 |
368,860 | 60,232,624 | Error message in Jupyter as "UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe9 in position 3" | <p>I am getting following error.</p>
<blockquote>
<p>UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe9 in position 3</p>
</blockquote>
<p><img src="https://i.stack.imgur.com/fdsdf.jpg" alt="enter image description here"></p> | <p>Try calling <code>read_csv</code> with <code>encoding='latin1'</code>, <code>encoding='iso-8859-1'</code> or <code>encoding='cp1252'</code></p>
<p>Source : <a href="https://stackoverflow.com/questions/30462807/encoding-error-in-panda-read-csv">here</a></p> | python|pandas|character-encoding | 0 |
368,861 | 59,925,405 | Pass a string to Python function and use that string as column name in dataframe | <p>I am trying to create a dataframe by using the string that I pass as python function attribute. The string is used to feed parameters to scrape some data into a dataframe. I want to rename the dataframe using the string and also rename one of the column names with the string. I am attaching the code below in case it... | <p>Not sure to understand your goal, but to rename a dataframes,
But if you want to use 'GLD' to create a variable GLD, I'm afraid than it's not possible according to comment in <a href="https://stackoverflow.com/q/8028708/12744275">Dynamically set local variable</a></p>
<p>Nota: the name of a variable define in def ... | python|pandas|function|arguments|parameter-passing | 1 |
368,862 | 60,105,439 | How to calculate the number of edges in a polygon using PIL/numpy | <p><a href="https://i.stack.imgur.com/BO62R.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/BO62R.jpg" alt="enter image description here"></a></p>
<p><strong>Question</strong></p>
<p>Given a black/white polygon, what is the most efficient method of calculating the number of edges?</p>
<p>For examp... | <p>To calculate the number of edges, you can use contour approximation. The idea is that a curve can be approximated by a <em>series of short line segments</em>. This leads to a resulting approximated curve that consists of a subset of points defined by the original curve. </p>
<p>Here's a solution using OpenCV. Conto... | python|image|numpy|image-processing|python-imaging-library | 1 |
368,863 | 59,999,783 | Trying to find a good interpolation technique | <p>I am currently attempting to interpolate a large set of X and Y values using Python. The arrays are quite long (6 million values), and I am trying to extend that to 10 million values. Given my problem, the interpolation should not go above or below the minimum/maximum values of Y. So to do this, I wrote a function t... | <p>If the input data is sorted in increasing order of <code>x</code>, you can do the "10 nearest points" step <em>much</em> more efficiently. Before the loop initialize <code>j = 0</code>, then at the top of your <code>i</code> loop body do</p>
<pre><code>while j < len(x) - 10 and abs(x[j+10] - i) < abs(x[j] - i... | python|pandas|numpy|interpolation|smoothing | 1 |
368,864 | 59,971,703 | numpy array slicing index | <pre><code>import numpy as np
a=np.array([ [1,2,3],[4,5,6],[7,8,9]])
</code></pre>
<ul>
<li><p>How can I get zeroth index column? Expecting output <code>[[1],[2],[3]]</code> <code>a[...,0]</code> gives 1D array. Maybe next question answers this question. </p></li>
<li><p>How to get last 2 columns of <code>a</code>? <c... | <p><code>numpy</code> indexing is built on <code>python</code> list conventions, but extended to multi-dimensions and multi-element indexing. It is powerful, but complex, but sooner or later you should read a full <code>indexing</code> documentation, one that distinguishes between 'basic' and 'advanced' indexing.</p>
... | python|numpy|numpy-ndarray | 1 |
368,865 | 60,289,832 | Only load segment of text file using numpy and itertools | <p>I have a piece of code that initially decodes a .dat file into a .txt file using a binary chipher cycle style decoder. It results in an over 500 line text file of data points with lines 0-65 being titles and other display features and the last few lines, starting from 586, being wrongly decoded text that looks somet... | <p>I have solved the issue using the solution posted here: <a href="https://stackoverflow.com/a/31113251/10475989">https://stackoverflow.com/a/31113251/10475989</a></p>
<p>My final code is:</p>
<pre><code>types_of_encoding = ["utf8", "cp1252"]
for encoding_type in types_of_encoding:
with open (file, 'r', encoding... | python-3.x|numpy | 0 |
368,866 | 59,935,654 | Pandas: how to sum dynamically varying columns | <p>I want to add a new column where each row is the sum of the row values in the chosen columns. Please note that the number of columns are not fixed. It varies dynamically.
Say I have this dataframe and a list where I specify the columns to be added:
(The actual number of columns are much higher)</p>
<pre><code>df
... | <p>Sum along the columns</p>
<pre><code>add = ['col1', 'col4']
df['Sum'] = df[add].sum(axis=1)
</code></pre>
<pre><code> col1 col2 col3 col4 sum
0 56 22 320 300 356
1 34 25 220 220 254
2 45 27 120 120 165
3 78 35 830 83 161
</code></pre> | python|pandas | 1 |
368,867 | 60,310,195 | Iterate over list to get values in a specified sequence | <p>I had an initial tuple, over which I was trying to iterate to perform further calculations. However, I end up having an error "<code>too many values to unpack</code>" which was solved by following suggestions from this question asked previously(<a href="https://stackoverflow.com/questions/32128095/python-too-many-va... | <p>The tuple is inside a list. You're just iterating over the list, but not over the tuple elements. You need nested loops.</p>
<pre><code>for t in Z:
for data, label in t:
x = data.reshape(4,)
y.append(int(label))
</code></pre>
<p>You don't need the nested loops if you get rid of the list.</p>
<... | python|python-3.x|list|numpy|tuples | 2 |
368,868 | 59,924,516 | Unquoted date in first column pf CSV for Python/Pandas read_csv | <p>Incoming CSV from American Express download looks like below. (I would prefer each field has quotes around it, but it doesn't. It is treating the quoted long number in the second CSV column as the first column in the Pandas data frame, i.e. 320193480240275508 as my "Date" column: </p>
<blockquote>
<p>12/13/19,... | <p>IIUC, the problem seems to be <code>name=colnames</code>, it sets new names for your columns being read from csv file, as you are trying to read specific columns from csv file, you can use <code>usecol</code></p>
<pre><code>df = pd.read_csv(filenameIn,usecols=colnames, header=0, delimiter=",")
</code></pre> | python-3.x|pandas | 1 |
368,869 | 59,905,986 | Problem installing tensorflow in virtual environment | <p>This issue in some form has come up before, however I am having a variant of this issue.</p>
<p>I had <strong>python 3.8</strong> installed. Tensorflow does not have a version for this python.</p>
<p>I therefore <strong>installed python 3.7</strong> and set up a virtual environment using <strong>virtualenv</strong... | <p>I ended up using Anaconda with Python 3.6, it seems tensorflow would not work for 3.7 on windows.</p> | python|visual-studio|tensorflow | 0 |
368,870 | 60,198,296 | Unable to change value of dataframe at specific location | <p>So I'm trying to go through my dataframe in pandas and if the value of two columns is equal to something, then I change a value in that location, here is a simplified version of the loop I've been using (I changed the values of the if/else function because the original used regex and stuff and was quite complicated)... | <p>To be honest, I've never used <code>df.at</code> - but try using <code>df.loc</code> instead:</p>
<pre><code>df_sample.loc[index, "Functionality"] = "unknown"
</code></pre> | python|pandas|dataframe | 2 |
368,871 | 60,254,046 | Cannot feed image data of DICOM into image data generator | <p>So i have preprocessed some dicom images to feed a neural network, and in image augmentation step, the image data generator expects a 4d input while my data is 3d (200, 420, 420) </p>
<p>i tried reshaping the array and expanding dimensions, but in both cases i cannot plot the individual images in the array (expects... | <p>You are correct in adding an extra dimension to represent channels. That part seems fine. The problem is with plotting. For that, you can use:</p>
<pre><code>plt.matshow(x[..., 0]).
</code></pre>
<p>where <code>x</code> is the 3D array. The syntax <code>x[..., 0]</code> means take index 0 of the last dimension of ... | python|arrays|numpy|rgb|dicom | 2 |
368,872 | 60,168,092 | how to compare values between two pandas dataframes, one with list and one with single value, efficiently? | <p>I have two dataframes, df1 and df2 as follows:</p>
<pre><code>#TWO DFs
df1 = {'uuids': [[01, 03], [02], [02,03]}
df2 = {'uuid':[01, 02, 03]}
</code></pre>
<p>These are instances of originals. My question is how to efficiently (speedwise) print <code>df2</code> if it finds a value <code>01</code> present in <code... | <p>If using <code>pandas>=0.25</code>, you can use <code>explode</code> and compare the values:</p>
<pre class="lang-py prettyprint-override"><code>df2['uuid'].isin(df1.explode('uuids')['uuids'].values)
Out[1]:
0 True
1 True
2 True
</code></pre> | python|pandas|dataframe | 0 |
368,873 | 60,148,398 | how to find the count within a given range using pandas | <p><strong>My data table in excel:</strong></p>
<pre><code> HC No. Domain Education mark -Q1 Education mark -Q2 \
0 1 Domain A 1.469754 1.969754
1 2 Domain A 0.428562 0.928562
2 3 Domain A 1.130643 1.630643
3 ... | <p>using <code>pd.cut</code> </p>
<pre><code>bins = [0, 0.5, 1, 1.5, 2, 2.5, 3, 3.5]
df['Q1Bin'] = pd.cut(df['Education_mark_Q1'],
bins,right=False)
df['Q2Bin'] = pd.cut(df['Education_mark_Q2'],
bins,right=False)
new_df = (
pd.melt(df, id_vars=["Domain... | pandas|plotly | 1 |
368,874 | 60,081,195 | how to get a numpy array from frequency and indices | <p>I have a numpy array like this:</p>
<pre><code>nparr = np.asarray([[u'fals', u'nazi', u'increas', u'technolog', u'equip', u'princeton',
u'realiti', u'civilian', u'credit', u'ten'],
[u'million', u'thousand', u'nazi', u'stick', u'visibl', u'realiti',
u'w... | <p>You need to use <code>return_inverse</code> rather than <code>return_index</code>:</p>
<pre><code>_, i, c = np.unique(nparr, return_inverse=True, return_counts=True)
</code></pre>
<p><code>_</code> is a convention to denote discarded return values. You don't need the unique values to know where the counts go.</p>
... | python|arrays|numpy | 2 |
368,875 | 59,968,513 | Is there a way to set a number to equal a date in python? | <p>I have a few files that have a randomly generated number that corresponds with a date:</p>
<pre><code>736815 = 01/05/2018
</code></pre>
<p>I need to create a function or process that applies logic to sequential numbers so that the next number equals the next calendar date.</p>
<p>Ideally i would need it in a key:... | <p>I think <code>origin</code> parameter is possible use here, also add <code>unit='D'</code> to <a href="http://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.to_datetime.html" rel="nofollow noreferrer"><code>to_datetime</code></a>:</p>
<pre><code>df = pd.DataFrame({'col':[5678, 5679, 5680]})
df['date'] =... | python|pandas|datetime | 2 |
368,876 | 60,040,966 | Python Pandas Histogram odd/even sorting | <p>I have function that plots some hists (data is in range 1...15)</p>
<pre class="lang-py prettyprint-override"><code> def show_hist(filename):
df = pd.read_csv(filename, delimiter=',', header=None)
plt.figure(figsize=(10, 6))
df[1].value_counts()[:15].plot(kind='bar')
plt.savefig('... | <p>So, you are trying to do a histogram using value_counts, and the issue here is that pandas index isn't sorted.
Please, try the following code:</p>
<pre><code>aux = df[4].value_counts()
aux.sort_index().plot(kind='bar')
</code></pre> | python|pandas|matplotlib|histogram | 0 |
368,877 | 65,375,086 | Condition in tensorflow 2.x code reports error | <p>migrating to <code>tensorflow 2.x.</code> Win 10, tf version is 2.3.1. Basically,</p>
<pre><code>import tensorflow as tf
def do_nothing(x, y):
m, n = x.shape
if m==n:
return x, y
else:
raise Exception('should never arrive here')
xys = [[tf.eye(2), tf.eye(3)],
[tf.eye(4), tf.eye(... | <p>I think the reason is because tf returns a Tensor of type bool, not a simple Bool. <a href="http://tensorflow.biotecan.com/python/Python_1.8/tensorflow.google.cn/api_docs/python/tf/equal.html" rel="nofollow noreferrer">http://tensorflow.biotecan.com/python/Python_1.8/tensorflow.google.cn/api_docs/python/tf/equal.htm... | python|tensorflow | 0 |
368,878 | 65,096,691 | Find L3 norm of two arrays efficiently in Python | <p>Suppose I have two arrays. A has size n by d, and B has size t by d. Suppose I want to output an array C, where C[i, j] gives the cubed L3 norm between A[i] and B[j] (both of these have size d). i.e.</p>
<pre><code>C[i, j] = |A[i, 0]-B[j, 0]|**3 + |A[i, 1]-B[j, 1]|**3 + ... + |A[i, d-1]-B[j, d-1]|**3
</code></pre>
<... | <p>There may be a few optimizations to speed this up, but the performance isn't going to be anywhere near specialized math packages. Those packages are using blas and lapack to vectorize the operations. They also avoid a lot of type checking overhead by enforcing types at the time you set a value. If performance is imp... | python|arrays|numpy|norm | 1 |
368,879 | 65,066,902 | create rows with specific values from another column after particular cells_python | <p>I have a df like this</p>
<p><a href="https://i.stack.imgur.com/FIBCp.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/FIBCp.png" alt="enter image description here" /></a></p>
<p>The goal is to create new rows in this format</p>
<p><a href="https://i.stack.imgur.com/qgbQN.png" rel="nofollow norefer... | <p>Try with <code>stack</code> the <code>split</code> and <code>explode</code></p>
<pre><code>s = df.stack()
s = s.str.split(' ').explode()
</code></pre> | python|pandas|row | 0 |
368,880 | 65,399,928 | Rename column by position pandas | <p>I am trying to rename a column by position in a pandas dataframe.</p>
<p>I tried:</p>
<pre><code>df.rename(columns={ df.columns[0]: "Line Items" }, inplace=True) #replace name
</code></pre>
<p>But this code replaces all columns which has have the same name as column[0] with "Line Items" irrespect... | <p>Let us convert to <code>series</code> then change the value by <code>.iloc</code> and assign it back</p>
<pre><code>s = df.columns.to_series()
s.iloc[0] = 'something'
df.columns = s
</code></pre> | pandas|replace | 3 |
368,881 | 65,438,751 | Combine two dataframes of dfiferent size into one | <p>I am looking to append two dataframes together that are different in size. I have tried append, merge, concat - I know I am close but missing something fairly easy. I am new to Python learning on my own.</p>
<pre><code>import pandas as pd
data1 = [['lj', 22.72, 37, 9.8], ['nc', 13.24, 30.9, 4.4],['bm', 13.77, 26.... | <p>You can use <code>merge</code>. But you would need a common column to join both the dataframes. Since you don't have any common column, one way is to create a temporary column just for join and then drop it. Something like below.</p>
<pre><code>import pandas as pd
data1 = [['lj', 22.72, 37, 9.8], ['nc', 13.24, 30.9... | pandas|merge|append|concatenation|union | 1 |
368,882 | 65,285,508 | How to do retrain a linear regression model with a new subset using tensorflow or keras? | <p>I have 100 Gb of data and divided it into small subsets. I want to train the model in an incremental way using a new subset until all the algorithm is trained on all the subsets. How I can achieve this TensorFlow or sklearn?</p> | <p>Some <code>scikit-learn</code> models do support incremental learning through the <code>partial_fit</code> method. A popular choice is the Stochastic Gradient Descent, which minimizes a loss function looking at one data sample at a time. Here is an example, assuming you have two chunks of data that you can load succ... | python|tensorflow|machine-learning|scikit-learn|regression | 1 |
368,883 | 65,414,373 | Using Pandas DataFrames is there a way to break a row into multiple rows based on if each column contains a value? | <p>Given a dataframe with columns A B C D E F and 3 rows:</p>
<pre><code>[1,100,null,100,null,"cat"]
[2,null,50,null,50,"dog"]
[3,100,null,null,100,"cow"]
</code></pre>
<p>I am needing to find a way to go through each row and based on if there is a value in columns B C D E, break each valu... | <p>IIUC, one way:</p>
<pre><code>df.melt(['A','F'])\
.dropna()\
.reset_index()\
.pivot(index=['index','A','F'], columns='variable', values='value')\
.reset_index()\
.drop(['index'], axis=1)
</code></pre>
<p>Output:</p>
<pre><code>variable A F B C D E
0 1 cat 100.0 NaN Na... | python|pandas|dataframe | 1 |
368,884 | 65,409,589 | Pandas group data until first ocurrence of a pattern | <p>I have a dataframe that contains accidents of cars, they can be 'L' for light or 'S' for strong:</p>
<pre><code>|car_id|type_acc|datetime_acc|
------------------------------
| 1 | L | 2020-01-01 |
| 1 | L | 2020-01-05 |
| 1 | S | 2020-01-07 |
| 1 | L | 2020-01-09 |
| 2 | L | ... | <p>You could use <a href="https://numpy.org/doc/stable/reference/generated/numpy.ptp.html" rel="nofollow noreferrer">np.ptp</a> to compute the <em>max-min</em> difference:</p>
<pre><code># find first by S by car_id
df['eq_s'] = df.groupby('car_id')['type_acc'].transform(lambda x: x.eq('S').cumsum())
# compute stats ba... | python|pandas | 3 |
368,885 | 65,308,154 | How to get new pandas dataframe with max value of k consecutive rows? | <p>I have this pandas dataframe:</p>
<pre><code>ts = pd.Series([2372, 4356, 3034, 1502, 676, 4187, 2634, 1002])
</code></pre>
<p>What I would like to get is a dataframe which exists of the max value of four consecutive rows of the column and keeps index of row 0, 4, 8 etc.</p>
<p>In this case, this means a new datafram... | <p>Use <a href="https://numpy.org/doc/stable/reference/generated/numpy.arange.html" rel="nofollow noreferrer"><code>numpy.arange</code></a> with <a href="https://pandas.pydata.org/pandas-docs/version/0.23.1/generated/pandas.core.groupby.DataFrameGroupBy.agg.html" rel="nofollow noreferrer"><code>Groupby.agg</code></a>:<... | python|python-3.x|pandas|dataframe|series | 2 |
368,886 | 65,205,801 | PyTorch alternative for tf.data.experimental.sample_from_datasets | <p>Suppose I have two datasets, dataset one with 100 items and dataset two with 5000 items.</p>
<p>Now I want that during training my model sees as much items from dataset one as from dataset two.</p>
<p>In Tensorflow I can do:</p>
<pre><code>dataset = tf.data.experimental.sample_from_datasets(
[dataset_one, datase... | <p>I don't think there is a direct equivalent in PyTorch.</p>
<p>However, there's a function called <a href="https://pytorch.org/docs/stable/data.html#torch.utils.data.WeightedRandomSampler" rel="nofollow noreferrer"><code>torch.utils.data.WeightedRandomSampler</code></a> which samples indices based on a list of probab... | tensorflow|pytorch | 2 |
368,887 | 65,221,601 | How to categorize numerical data in numpy array iteratively? | <p>I am currently trying to generate a numpy array with random data <code>normal = np.round(np.random.normal(loc=0.0,scale=1000,size=(size)),1).astype(int)</code>, with <code>seed = np.random.seed(0)</code> and then categorize them in an equidistant way such as:</p>
<pre><code>d=10
data = np.ndarray.flatten(np.asarray(... | <p>You are overwriting the data as you check for the right interval. Introduce a different data array you fill as you go along, leaving the source data untouched:</p>
<pre><code>import numpy as np
import matplotlib.pyplot as plt
size = 1000
seed = np.random.seed(0)
normal = np.round(np.random.normal(loc=0.0, scale=100... | python|arrays|numpy|for-loop | 0 |
368,888 | 65,187,567 | Need to do eval on pandas dataframe at row level | <p>I have a scenario where my pandas data frame have a condition stored as string which I need to execute and store result as different column. Below example will help you understand better;</p>
<p>Existing DataFrame:</p>
<pre><code>ID Val Cond
1 5 >10
1 15 >10
</code></pre>
<p>Expected Dat... | <p>If your conditions are formed from the basic operations (<, <=, ==, !=, >, >=), then we can do this more efficiently using <code>getattr</code>. We use <code>.str.extract</code> to parse the condition and separate the comparison and the value. Using our dictionary we map the comparison to the Series attr... | python|pandas|dataframe|eval | 1 |
368,889 | 65,098,386 | Sorting Out data based on Date and event status with Pandas | <p>I have a dataset from which I want to find out hour wise how many providers were online each day.The dataframe looks like this -</p>
<pre><code> provider_id event_time final_status rank
325 0037dfffff8b03bbdf366a263735e84b 2017-09-04 08:00:19 online 1
326 0037dfffff8b03... | <p>Interesting problem. Here are some thoughts, no complete solution, but maybe parts of it are useful.</p>
<p>I wasn't able to do it without for-looping, which is a shame. My strategy was therefore to reduce the number of loops. To that end I did some preprocessing.</p>
<p>The first step is getting rid of unnecessary ... | python|python-3.x|pandas|numpy|dataframe | 0 |
368,890 | 65,420,231 | Pandas dataframe OrderedDict extract data | <p>I've a <a href="https://i.stack.imgur.com/QtggZ.png" rel="nofollow noreferrer">Database</a>.csv file with one column and 3 rows, those are data exported from salesforce with simple-salesforce, I try to get the 'Name' Value from the OrderedDict cell data('Name', 'Demand').</p>
<p>Dataframe</p>
<pre><code>Type__c
... | <p>Welcome to the SO-community Pamuk!</p>
<p>Rather than iterating through the rows of a dataframe, it is much more efficient to "apply" a particular function to an entire column (or even subset of a dataframe). That way, pandas will handle performance for you, and it is usually more readable (since you don't... | python|pandas|dataframe|salesforce|ordereddict | 0 |
368,891 | 65,270,244 | Python: replace values of a categorical variable to something else in a data frame | <p>i have a pandas data frame in which there's a column named label of categorical type having three categories as <strong>('>5' , '<30' , 'NO')</strong>. I want to change <strong>('>5' , '<30')</strong> these two categories to <strong>'yes'</strong> and i can't seem to figure out how.
I want to do this wit... | <p>You can use <code>replace()</code> and pass a list with the values to be replaced and then the parameter with replacement, it's a bit tidier when you want to replace multiple values with a unique one:</p>
<pre><code>to_replace = [">5","<30"]
bp = bp.replace(to_replace,"Yes")
</cod... | python|pandas|dataframe|encoding|categorical-data | 1 |
368,892 | 65,426,962 | Installing tensorflow without success | <p>I'd like to use tensorflow, tried to install it, and I recieve this error message when I import it. I even uninstalled the version 3.9 of python and installed the 3.8, which is the version it was designed for, but the same problem happens. Do you know why ?</p>
<p>PS C:\Users\Elève\Desktop\Python\Sudoku> & &q... | <p>You need to install the C++ redist libraries
<a href="https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads" rel="nofollow noreferrer">C++ Redist lib</a></p> | python|tensorflow | 0 |
368,893 | 65,144,224 | Pandas: Exclude items from an array column if that item is in another column | <p>I have two dataframes as the follwoing below:</p>
<pre><code>import pandas as pd
df = pd.DataFrame({'USER':[1,2,3,1,1,2],
'ANTENNA_ID': ['SJDR1', 'LD', 'LD', 'LD', 'TR', 'SVM']})
df2 = pd.DataFrame({'USER': [1,2,3,4,5],
'PRESUMED_RESIDENCE': ['SJDR1', 'LD'... | <p>One idea with list comprehension:</p>
<pre><code>grouped['ANTENNA_ID'] = [[z for z in x if z != y]
for x,y in zip(grouped['ANTENNA_ID'],
grouped['PRESUMED_RESIDENCE'])]
print (grouped)
USER PRESUMED_RESIDENCE ANTENNA_ID
0 1 SJDR1... | python|pandas|dataframe | 2 |
368,894 | 65,381,859 | How can I crop away a tensor’s constant value padding (padding height and width are the same) with an unknown value and size? | <p>How can I crop away a tensor’s constant value padding (padding height and width are the same) with an unknown value and size?</p>
<p>I would think that because the padding surrounding my tensor has a constant value, and the same height / width, that it should be possible to know where to crop the tensor to remove th... | <p>You can get an idea of the content of a feature map by taking its middle row and measure the padding by looking for the first element change:</p>
<pre><code>midrow = b[0, 0, b.shape[3]//2, :]
pad = (midrow[:-1] == midrow[:1])[:midrow.shape[0]//2].sum()
</code></pre>
<p>Alternatively you could substract one of the fe... | python|numpy|pytorch|padding|crop | 2 |
368,895 | 65,181,397 | Selecting one normal from a tensor based on another random variable in TensorFlow Probability | <p>I'm attempting to select a single sample from a range of Normal distributions based upon the output of a categorical distribution, however can't seem to come up with quite the right way to do it. Using something along the lines of:</p>
<pre><code>tfp.distributions.JointDistributionSequential([
tfp.distributi... | <p>There's another <a href="https://www.tensorflow.org/probability/api_docs/python/tfp/distributions/MixtureSameFamily?version=nightly" rel="nofollow noreferrer">distribution</a> for that:</p>
<pre class="lang-py prettyprint-override"><code>tfd.MixtureSameFamily(
mixture_distribution=tfd.Categorical(probs=[0, 0, .5, ... | python|tensorflow|data-science|probability|tensorflow-probability | 0 |
368,896 | 65,155,928 | why autoencoder tutorial of pytorch changes the view of embedding layer output? | <p>As shown <a href="https://pytorch.org/tutorials/intermediate/seq2seq_translation_tutorial.html" rel="nofollow noreferrer">here in PyTorch tutorials</a> the code for an autoencoder model is like this:</p>
<pre><code>class EncoderRNN(nn.Module):
def __init__(self, input_size, hidden_size):
super(EncoderRNN... | <p>The <a href="https://pytorch.org/docs/stable/tensors.html#torch.Tensor.view" rel="nofollow noreferrer">view</a> function added extra dimension to given input shape to match expected input shape. In the function <code>initHidden</code> the hidden shape is initialized to <code>(1, 1, 256)</code>.</p>
<pre><code>def in... | python|pytorch|autoencoder | 2 |
368,897 | 65,197,193 | Backpropagation across two parallel layers in Keras | <p>I want to create a network with two parallel layers (same input is given to two different layers and output of them is combined with some mathematical operations). Having said that, I am not sure the back-propagation will be done by Keras automatically. As a simple example of custom <code>RNN</code> cell,</p>
<pre c... | <p>Check the answer by <a href="https://stackoverflow.com/a/47417083/13509540">Daniel Möller</a></p>
<p>Back-propagation will be taken care by Keras as long as all calculation is linked by tensor object, i.e don't cast tensor to another type like array, so don't worry about it.</p>
<p>For example of gradient tape, you ... | tensorflow|keras|keras-layer | 0 |
368,898 | 65,327,675 | Making a dataframe from a list of files with different target class columns | <p>I have a list of text files:</p>
<pre><code>['datasets/Autobiography.txt',
'datasets/CoralReefs.txt',
'datasets/DescentofMan.txt',
'datasets/DifferentFormsofFlowers.txt',
'datasets/EffectsCrossSelfFertilization.txt']
</code></pre>
<p>They all have 'text' and 'labels' columns, with 'labels' having 2 classes (yes/... | <p>Seems like you've got most of the solution already. Thanks for writing such a good question!</p>
<blockquote>
<p>I also want to put label class (yes/no) into different columns along with the file names.</p>
</blockquote>
<p>You can do this with <a href="https://pandas.pydata.org/pandas-docs/stable/reference/api/pand... | python|pandas|dataframe|text | 1 |
368,899 | 65,346,324 | Unable to load .h5 file made in Google Colab to Jupyter Notebook | <p>I tried a code for Face mask detect and alert system and I am getting an error regarding the same. I trained the model in Google Collaboratory and ran the following code in Jupyter Notebook. The code is as follows:</p>
<pre><code># Import necessary libraries
from keras.models import load_model
import cv2
import nump... | <p>Seems the issue is similar as mentioned in this <a href="https://stackoverflow.com/questions/58878421/unexpected-keyword-argument-ragged-in-keras">stackoverflow question.</a> already.</p>
<p>As the accepted answer here mentions that the exported model may be from tf.keras and not keras directly :</p>
<blockquote>
<p... | python|tensorflow|keras|jupyter-notebook|google-colaboratory | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.