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 |
|---|---|---|---|---|---|---|
16,900 | 57,794,598 | Best method to add noise on tf.dataset images "on the fly" | <p>After training a model (image classification) I would like to see how it performs differently when I evaluate a proper image and various noised versions of it.</p>
<p>The type of noise I'm thinking is a random change in pixels value, I tried with this approach:</p>
<pre class="lang-py prettyprint-override"><code>#... | <p>The biggest overhead here is pixel operations (double for loop). Vectorizing it should result in substantial speedup:</p>
<pre><code>noise_magnitude = 10
...
img_max_value = img_to_numpy.max() * np.ones(img_to_numpy.shape)
for _ in range (0, 5):
# depending on range of values, you might want to adju... | python|tensorflow | 1 |
16,901 | 57,842,595 | How can I read a text file with binary values, where each row is a binary vector itself using Numpy? | <p>The idea is that the text file has 150 rows where each row is a string of 1024 bits (a representation of a 32x32 image).</p>
<p>What i want to achieve is to have an array of 150 elements where every element is an array of size 1024.</p>
<p>By trying the code below i get an array of 150 elements with inf value.
Is... | <p>If each line is exactly the same length and contains only the characters <code>0</code> and <code>1</code>, you can use <a href="https://numpy.org/doc/1.17/reference/generated/numpy.genfromtxt.html" rel="nofollow noreferrer"><code>numpy.genfromtxt</code></a>, with <code>delimiter=1</code>. When the argument <code>d... | arrays|python-3.x|numpy | 1 |
16,902 | 34,157,811 | Filter a pandas dataframe using values from a dict | <p>I need to filter a data frame with a dict, constructed with the key being the column name and the value being the value that I want to filter:</p>
<pre><code>filter_v = {'A':1, 'B':0, 'C':'This is right'}
# this would be the normal approach
df[(df['A'] == 1) & (df['B'] ==0)& (df['C'] == 'This is right')]
</... | <p>IIUC, you should be able to do something like this:</p>
<pre><code>>>> df1.loc[(df1[list(filter_v)] == pd.Series(filter_v)).all(axis=1)]
A B C D
3 1 0 right 3
</code></pre>
<hr>
<p>This works by making a Series to compare against:</p>
<pre><code>>>> pd.Series(filter_v)
A 1
... | python|pandas | 85 |
16,903 | 54,701,821 | How make a vectorized approach for calculating pair-wise Manhattan/L1 distance between multi-dimensional arrays? | <p>Let's say that I have two arrays of size (4000, 3). What I'd like to do in a vectorized fashion is to calculate the L1/Manhattan distance from each vector of the first array to every vector in the second array, so that I'd end up with a (4000, 4000) array. </p>
<p>My current approach is based on splitting up the (4... | <p>You can do the whole thing using broadcasting (if I'm understanding what you are trying to do correctly). First compute the pairwise differences of the vectors (result is shape <code>N,N,k</code>), then compute the sum of the absolute values of each of these vectors.</p>
<pre><code>N = 4000
k = 4
X = np.random.ran... | python|numpy | 1 |
16,904 | 54,970,708 | Markup dataset for MASK-RCNN: only well-viewed objects? | <p>I'm going to use mark-rcnn (based on tensorflow) to detect some cars and gasoline canisters.
Images, what I have now, contains both cars and canisters. But I'm not shure about masks:</p>
<ol>
<li>Is it necessary to mark the object in image completely, or some of its parts are better not to allocate (if it concerns ... | <p>1)I recommend that you just mark the object you need to detect, if it overlaps that part do not mark it, use <strong>polygon shape</strong> for your annotation!!!!!</p>
<p>2)The best would be to try to mark the whole car in each of your annotations, no matter how small or large it looks.</p>
<p>3)Python, use of li... | tensorflow|dataset|mask | 2 |
16,905 | 55,013,771 | How to use the DataArray where() function to assign value from another DataArray based on conditions | <p>I am working with xarray to create a new Dataset based on the conditions of values from another Dataset.</p>
<p>The input Dataset object <code>ds_season</code> is by seasons and has three dimensions as below.</p>
<pre><code> <xarray.Dataset>
Dimensions: (latitude: 106, longitude: 193, se... | <p>I agree with Andrea that creating a dataset with 3653 unique days which only replicates 4 different seasonal values is in general inefficient. If you give more information about your broader goals for doing this, perhaps we can suggest an alternative solution.</p>
<p>Assuming you really do want to do this, the quic... | python|numpy|python-xarray | 0 |
16,906 | 55,005,915 | How to resize image to put into tf.train.Example | <p>I have an image (JPEG or PNG) as a byte buffer (read from the internet), and this is the way I was putting it in a <code>tf.train.Example</code> before:</p>
<pre><code>record = tf.train.Example(features=tf.train.Features(feature={
'image/encoded': dataset_util.bytes_feature(image_bytes)
# there are more fea... | <p>You can resize prior to encoding. </p>
<pre><code>def int64_feature(value):
return tf.train.Feature(int64_list=tf.train.Int64List(value=[value]))
def bytes_feature(value):
return tf.train.Feature(bytes_list=tf.train.BytesList(value=[value]))
</code></pre>
<p>Convert from string and resize </p>
<pre><code... | python|tensorflow | 2 |
16,907 | 49,757,899 | Calculating means for multiple columns, in different rows in pandas | <p>I have a csv file like this:</p>
<pre><code>-Species- -Strain- -A- -B- -C- -D-
Species1 Strain1.1 0.2 0.1 0.1 0.4
Species1 Strain1.1 0.2 0.7 0.2 0.2
Species1 Strain1.2 0.1 0.6 0.1 0.3
Species1 St... | <p>IIUC, you simply need to call</p>
<pre><code>df.groupby(['Species', 'Strain']).mean()
A B C D
Species Strain
Species1 Strain1.1 0.2 0.466667 0.166667 0.4
Strain1.2 0.1 0.600000 0.100000 0.3
Species2 Strain2.1 0.3 0.300... | python|pandas | 1 |
16,908 | 27,983,271 | saving array in pandas | <pre><code>import pandas as pd
import datetime
</code></pre>
<p>so i have got these three arrays </p>
<pre><code>a = ['1','2','3','5']
b = ['a','b','c','d']
c = ['asdf','23f23','234234','234231sxd']
df = pd.DataFrame(columns = ['NameA','NameB','NameC'])
df = df.append({'NameA':a,'NameB':b,'NameC':c},ignore_inde... | <p>This can be achieved without the call to df.append as per the <a href="http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.html#pandas.DataFrame" rel="nofollow">DataFrame</a> constructor. </p>
<pre><code>df = pd.DataFrame({'NameA':a,'NameB':b,'NameC':c})
</code></pre> | python|arrays|csv|pandas | 0 |
16,909 | 73,288,610 | How to read only the last lines by the time ID of an excel file in Pandas to perform calculations for them and write them to a separate file | <p>I am constantly downloading data from the DDE server of another program, which is then transferred to my Python application.</p>
<p>The DEE server transfers them to an excel file</p>
<p>They look something like this:</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th style="text-align: left... | <pre><code>def Read_Ex():
Exel = pd.DataFrame(pd.read_excel(Ex))
Exel['Time'] = pd.to_datetime(Exel['Time']).dt.time
A = Exel[Exel['Time'] == Exel['Time'].max()]
A.to_csv (Ex_Csv,
index = False,
header=True)
</code></pre> | python|pandas | 0 |
16,910 | 73,303,136 | WARNING:tensorflow:Ignoring detection with image id 1016176252 since it was previously added | <p>Hy,I work with faster_rcnn_resnet101_v1_1024x1024_coco17_tpu-8 pretrained model. I have problems when evaluating the model. The training went without any problems. I start the evaluation of the model with the command:</p>
<pre><code>python model_main_tf2.py --pipeline_config_path=./training_outlook_action_ctx/traini... | <p>guys. I found a solution for how I used the script to create images and annotations. More precisely, I used a script that will crop my first-level annotations and create new XML files for cropped images. The filename and path were not good for me in the XML files (wrong path when programming the script).</p>
<p>Afte... | tensorflow|tensorflow2.0|object-detection-api | 0 |
16,911 | 73,373,477 | Rounding off automatically in pandas | <p>I have two seperate dataframes ticket_id and id on one and ticket_id and value on other when I left join these two dataframes in python on ticket_id my id column is rounding off itself and I'm getting something like this</p>
<p><a href="https://i.stack.imgur.com/hvWI0.png" rel="nofollow noreferrer"><img src="https:/... | <p>Try the following:</p>
<pre><code>df_1.assign(ticket_id=df_1.ticket_id.astype(str)).merge(
df_2.assign(ticket_id=df_2.ticket_id.astype(str)),
how="left", on="ticket_id"
)
</code></pre> | python|pandas | -1 |
16,912 | 73,261,221 | set month, day year the same format | <p>when I extracted the date column from dataframe it looks like this:</p>
<pre><code>10/30/2016
10/30/2016
10/30/2016
10/30/2016
9/4/2017 1
9/4/2017 1
9/4/2017 1
9/4/2017 1
9/4/2017 1
</code></pre>
<p>I need to set the dates with the same digits format to get rid of the extra 1 from the right.
the format shoul... | <p>We can do the following with a regex capture</p>
<pre><code>import re
import datetime
bad_date = "9/4/2017 1"
new_date = re.sub("(\d{,2}/\d{,2}/\d{,4})(\s.*\d+)","\\1", bad_date)
</code></pre>
<p>Finally with <code>datetime</code></p>
<pre><code>print(datetime.datetime.strptime(new_dat... | python|pandas|dataframe | 0 |
16,913 | 73,423,486 | Create a Dataframe in Dask | <p>I'm just starting using Dask as a possible replacement (?) of pandas. The first think that hit me is that i can't seem to find a way to create a dataframe from a couple lists/arrays.</p>
<p>In regular pandas i just do: <code>pd.DataFrame({'a':a,'b':b,...})</code> but i can't find an equivalent way to do it in Dask, ... | <p>There is a fairly recent feature by @MrPowers that allows creating <code>dask.DataFrame</code> using <a href="https://docs.dask.org/en/stable/generated/dask.dataframe.DataFrame.from_dict.html" rel="nofollow noreferrer"><code>from_dict</code> method</a>:</p>
<pre class="lang-py prettyprint-override"><code>from dask.d... | python|pandas|dataframe|dask|dask-dataframe | 1 |
16,914 | 67,379,440 | How to execute an script within an conditional statement using python | <p>I am looking to execute the script within an conditional statement, I have also tried to use the script within an function but its not working</p>
<p>ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().</p>
<pre><code>df1 = pd.read_excel(open(r'input.xlsx', 'rb')... | <p>In <code>if df1['id_number'] != NaN:</code> you are comparing a series to a single value (scalar) of <code>NaN</code>. This will create a boolean array of <code>True</code>/<code>False</code> values. You need to specify whether you want any of those values to be <code>True</code>, or all of the values:</p>
<pre><cod... | python|pandas | 0 |
16,915 | 67,509,559 | How to import Excel xlsx files into pandas | <p>I need to import .XLSX Excel file into pandas it is now unsupported and gives the error</p>
<pre><code>XLRDError: Excel xlsx file; not supported
</code></pre>
<p>I need an alternative for:</p>
<pre><code>import pandas as pd
df = pd.read_excel("Challenger track/Data Sets/extract-text-1.xlsx", index_col=0)
... | <p>This is the workaround for pandas not supporting xlsx files. Install openpyxl and specify it as the engine when reading an xlsx file as below:</p>
<pre><code>xlfile = pd.ExcelFile('sample.xlsx', engine='openpyxl')
df = xlfile.parse('sheet_name')
</code></pre> | pandas | 2 |
16,916 | 34,826,736 | Running TensorFlow on a Slurm Cluster? | <p>I could get access to a computing cluster, specifically one node with two 12-Core CPUs, which is running with <a href="https://en.wikipedia.org/wiki/Slurm_Workload_Manager" rel="noreferrer">Slurm Workload Manager</a>.</p>
<p>I would like to run <a href="https://en.wikipedia.org/wiki/TensorFlow" rel="noreferrer">Ten... | <p>It's relatively simple.</p>
<p>Under the simplifying assumptions that you request one process per host, slurm will provide you with all the information you need in environment variables, specifically SLURM_PROCID, SLURM_NPROCS and SLURM_NODELIST.</p>
<p>For example, you can initialize your task index, the number o... | python|python-2.7|cluster-computing|tensorflow|slurm | 26 |
16,917 | 65,359,329 | Convolutional Neural Networks batch size | <p>Question1.</p>
<p>Let us say the image have a shape of (batchsize=100,height=28,width=28,channel=1)</p>
<p>and if we put this image in the model CNN underneath,</p>
<pre><code>class CNN(torch.nn.Module):
def __init__(self):
super().__init__()
# ImgIn shape=(100, 28, 2... | <p><strong>Q1</strong></p>
<p><code>self.fc</code> is just a single linear layer. The key line here is <code>out.view(out.size(0), -1)</code> which is nothing but <a href="https://pytorch.org/docs/stable/generated/torch.flatten.html" rel="nofollow noreferrer">flatten</a> (reshape in NumPy), where <code>out.size(0)</cod... | python|machine-learning|deep-learning|pytorch|conv-neural-network | 0 |
16,918 | 49,862,105 | Custom loss for coordinate/landmark prediction | <p>I am currently trying to get a landmark predictor running and thought about the loss function.</p>
<p>Currently the last (dense) layer has 32 values with the 16 coordinates encoded as x1,y1,x2,y2,...</p>
<p>Up until now I was just fiddling with Mean Squared Error or Mean Absolute Error losses but thought the dista... | <p>The same calculation expressed as tensor operations in Keras, without separating the X and Y coordinates, because that's basically unnecessary:</p>
<pre><code># get all the squared difference in coordinates
sq_distances = K.square( y_true - y_pred )
# then take the sum of each pair
sum_pool = 2 * K.AveragePooling1... | tensorflow|keras | 2 |
16,919 | 64,121,883 | Pandas pivot_table force column structure? | <p>I have a dataframe I want to summarize and send in an email, is there any way to explicitly pass the columns IN THE ORDER I want them displayed?</p>
<pre><code>df.pivot_table(index='Owner', values=['Matches', 'W', 'D', 'L', 'Pts'], aggfunc=sum)
</code></pre>
<p>returns this column order (index, sorted value columns ... | <p>You can do it with pivot_table adding reindex at the end:</p>
<pre><code>result = pd.pivot_table(df, index='Owner', values=values_cols, aggfunc=sum).reindex(columns=values_cols)
</code></pre> | python|pandas|pivot-table | 1 |
16,920 | 63,909,501 | merge multiple dataframes by using for loop in pandas | <p>i have multiple (approximately 11) dataframes looks like:</p>
<pre><code> Energy
Date
2020-09-14 42
2020-09-11 0
2020-09-10 0
2020-09-09 11
2020-09-08 0
2020-09-04 23
2020-09-03 11
2020-09-02 11
2020-09-01 19
2020-08-31 23
2020-08-28 69 ... | <p>I would do something like the following, assuming that you want to have one unique date per row, with all the other data as columns:</p>
<pre><code>dataframes = [df1, df2] # create list with all dataframes you are interested in
pd.concat([df.set_index('Date') for df in dataframes], ignore_index=False, axis=1)
</code... | python|pandas|dataframe | 2 |
16,921 | 47,002,832 | Concatenate multiple pandas columns with carriage return and blank rows | <p>I am attempting to concatenate multiple columns, all strings, in a pandas DataFrame; forming a new column. I am using .str.cat so that I can include a carriage return between columns to concatenate.</p>
<p>However, if any column in a row is blank or NaN I get NaN as the full result for that row.</p>
<p>I have look... | <p>I think you need <a href="http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.apply.html" rel="nofollow noreferrer"><code>apply</code></a> with <code>axis=1</code> for process by rows with <a href="http://pandas.pydata.org/pandas-docs/stable/generated/pandas.Series.dropna.html" rel="nofollow noref... | python|string|pandas | 1 |
16,922 | 47,057,789 | matplotlib - wrap text in legend | <p>I am currently trying to plot some <code>pandas</code> data via <code>matplotlib</code>/<code>seaborn</code>, however one of my column titles is particularly long and stretches out the plot. Consider the following example:</p>
<pre><code>import random
import pandas as pd
import matplotlib.pyplot as plt
import seab... | <p>You can use <code>textwrap.wrap</code> in order to adjust your legend entries (found in <a href="https://stackoverflow.com/questions/15740682/wrapping-long-y-labels-in-matplotlib-tight-layout-using-setp">this answer</a>), then update them in the call to <code>ax.legend()</code>.</p>
<pre><code>import random
import ... | python|pandas|matplotlib | 12 |
16,923 | 46,866,208 | How to use an autoencoder to visualize dimensionality reduction? (Python | TensorFlow) | <p>I'm trying to adapt <a href="https://github.com/aymericdamien/TensorFlow-Examples/blob/master/examples/3_NeuralNetworks/autoencoder.py" rel="nofollow noreferrer">Aymeric Damien's code</a> to visualize the dimensionality reduction performed by an autoencoder implemented in <code>TensorFlow</code>. All of the example... | <p>Your embedding is accessible with <code>h = encoder(X)</code>. Then, for each batch you can get the value as follow: </p>
<pre><code>_, l, embedding = sess.run([optimizer, loss, h], feed_dict={X: batch_x})
</code></pre>
<p>There is an even nicer solution with TensorBoard using Embeddings Visualization (<a href="ht... | python|tensorflow|neural-network|embedding|autoencoder | 1 |
16,924 | 62,946,666 | given row value, find the corresponding row index in Pandas Dataframe | <p>I have the following dataframe:</p>
<pre><code> cut_0 cut_1 cut_2 cut_3 waste picks
0 5 0 0 0 2 1
1 1 2 0 0 2 5
2 1 0 2 0 0 9
3 1 1 0 1 0 10
</code></pre>
<p>I want to write a general functio... | <p>You can use <a href="https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.eq.html" rel="nofollow noreferrer"><code>df.eq</code></a> and <a href="https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.all.html" rel="nofollow noreferrer"><code>df.all</code></a> with <code>ax... | python|pandas|dataframe | 2 |
16,925 | 63,271,841 | Deep Learning with Python code no longer working. "TypeError: An op outside of the function building code is being passed a "Graph" tensor." | <p>I'm implementing a Tensorflow Variational Autoencoder, copying the code exactly from the book "Deep Learning with Python". Up until a few days ago, the code was working perfectly but as of yesterday it has stopped working (I have not changed the code).</p>
<p>The code is for a generative model which can re... | <p>The custom layer you have defined to compute the loss, i.e. <code>CustomVariationalLayer</code>, is accessing tensors of the model which have not been passed to it directly. This is not allowed since eager mode is enabled but the function in the layer is by default executed in graph mode. To resolve this issue, you ... | python|tensorflow|machine-learning|keras|autoencoder | 2 |
16,926 | 63,198,413 | delete rows based on data frame year and month | <p>I know this question has probably been asked in someway, but new to python and still having trouble. I had an incomplete data pull from April 2020 and now I'm trying to delete the April 2020 data from the data frame and/or create a new data frame without April 2020 included.</p>
<p>I converted the date time to year ... | <p>Here is one way:</p>
<p>First, I created a test data frame, with dates in March, April and May.</p>
<pre><code>import pandas as pd
invoice_date = pd.date_range(start='2020-03-01', end='2020-05-15', freq='14d')
amt = [100 + i for i in range(len(invoice_date))]
df = pd.DataFrame({'invoice_date': invoice_date, 'amt': ... | python|pandas | 0 |
16,927 | 63,141,887 | Index an array with a ragged indexing list and perform sum/mean reductions | <p>I have some 2D data where the first axis is time and the second axis is person's ID. Thus the data entries are the persons' property values over time.</p>
<p>What I want to do is to group the persons and average the properties in each group at all time frames. Here is a sample of 6 time points and 5 persons with 2 g... | <p><strong>Approach #1 : Generic case</strong></p>
<p>Here's an almost vectorized approach making use of <a href="https://numpy.org/doc/stable/reference/generated/numpy.ufunc.reduceat.html" rel="nofollow noreferrer"><code>np.add.reduceat</code></a> -</p>
<pre><code>g = np.concatenate(groups)
lens = list(map(len, groups... | python|numpy|loops | 0 |
16,928 | 63,098,732 | Using zero_grad() after loss.backward(), but still receives RuntimeError: "Trying to backward through the graph a second time..." | <p>Below is my implementation of a2c using PyTorch. Upon learning about backpropagation in PyTorch, I have known to zero_grad() the optimizer after each update iteration. However, there is still a RunTime error on second-time backpropagation.</p>
<pre><code>def torchworker(number, model):
worker_env = gym.make("... | <p>SOLVED: I forgot to clear the history of probabilities, action-values and rewards after iterations. It is clear why that would cause the issue, as the older elements would cause propagating through old dcgs.</p> | neural-network|pytorch|reinforcement-learning|backpropagation | 0 |
16,929 | 67,917,419 | How to update PyTorch model parameters (tensors) after averaging them? | <p>I'm currently working on a distributed federated learning infrastructure and am trying to implement PyTorch. For this I also need federated averaging which averages the retrieved parameters from all the nodes and then passes those to a next training round.</p>
<p>The gathering of the parameters looks like this:</p>
... | <p>I think the most convenient way to work with parameters (outside the SGD context) is using the <a href="https://pytorch.org/docs/stable/generated/torch.nn.Module.html#torch.nn.Module.state_dict" rel="nofollow noreferrer"><code>state_dict</code></a> of the model.</p>
<pre class="lang-py prettyprint-override"><code>
n... | pytorch | 0 |
16,930 | 67,763,994 | Losing results from a triple for loop | <p>I' m trying to do some matches between an np.array and some folders/images I have.
I' m positive that i have created a 1 to 1 match for all my data.
So I' m guessing I lose results from the way my for loops are structured, don't know why though.</p>
<p>My np.array has the following structure (ArtistName, Song, Senti... | <p>i think you lose your data cause you assign a new value</p>
<pre><code>if '/' in artistTrackSentiment[x][1]:
artistTrackSentiment[x][1] = artistTrackSentiment[x][1].replace("/", "_")
</code></pre>
<p>and after them you compare....</p>
<pre><code>if folder == artistTrackSentiment[x][0] and ima... | python|numpy|for-loop | 0 |
16,931 | 67,629,487 | decrease each row by percent of previous row, by group | <p>I have data that looks like this:</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th>season</th>
<th>player</th>
<th>minutes</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>K. Bryant</td>
<td>700</td>
</tr>
<tr>
<td>2</td>
<td>K. Bryant</td>
<td>700</td>
</tr>
<tr>
<td>3</td>
<td>K. Bryant<... | <p>Try creating a series of keep percentages with <a href="https://pandas.pydata.org/docs/reference/api/pandas.core.groupby.DataFrameGroupBy.cumprod.html#pandas-core-groupby-dataframegroupby-cumprod" rel="nofollow noreferrer">groupby cumprod</a></p>
<pre><code>pct = .1
# Create a column with keep percentage as 1 - .1
d... | python|pandas|dataframe | 2 |
16,932 | 67,916,691 | Compare two unequal size numpy arrays and fill the exclusion elements with nan | <p>I need to do an element-by-element match of a 6x3 array with a 2x2 array. Return the bigger array with a True or False in the corresponding elements based on a match or no match. For the elements in the bigger array that cannot be compared e.g. column 3 and rows 3 to 6, I need to fill with NaN.</p>
<p>Here's my pseu... | <p>Here is my solution assuming the first array is always bigger than the second (see comments for general solution, e.g for the second array is bigger on some dimension)</p>
<pre class="lang-py prettyprint-override"><code>import numpy as np
a = np.arange(18).reshape(6, 3) # 6x3 array
b = np.arange(4).reshape(2, 2) ... | python|arrays|numpy | 0 |
16,933 | 67,846,563 | Which one is faster numpy or pandas? | <p>I started learning data science and encountered the two python libraries numpy and pandas can anyone please tell what are the difference between them and which one is faster?</p> | <p>Pandas is an open-source, BSD-licensed library written in Python Language.
Numpy is the fundamental library of python, used to perform scientific computing.
When we have to work on Tabular data, we prefer the pandas module and when we have to work on Numerical data, we prefer the numpy module.
The powerful tools of ... | python|pandas|numpy|data-science | 3 |
16,934 | 31,791,476 | Pandas DataFrame to Numpy Array ValueError | <p>I am trying to convert a single column of a dataframe to a numpy array. Converting the entire dataframe has no issues.</p>
<p>df</p>
<pre><code> viz a1_count a1_mean a1_std
0 0 3 2 0.816497
1 1 0 NaN NaN
2 0 2 51 50.000000
</code></pre>
<p>Both of ... | <p>The problem here is that you're passing just a single element which in this case is just the string title of that column, if you convert this to a list with a single element then it works:</p>
<pre><code>In [97]:
y = df.as_matrix(columns=[df.columns[0]])
y
Out[97]:
array([[0],
[1],
[0]], dtype=int64)... | python|numpy|pandas | 3 |
16,935 | 32,028,979 | Speed up for loop in convolution for numpy 3D array? | <p>Performing convolution along Z vector of a 3d numpy array, then other operations on the results, but it is slow as it is implemented now. Is the for loop what is slowing me down here or is is the convolution? I tried reshaping to a 1d vector and perform the convolution in 1 pass (as I did in Matlab), without the for... | <p>The <code>fftconvolve</code> function you are using is presumably from <a href="http://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.fftconvolve.html" rel="noreferrer">SciPy</a>. If so, be aware that it takes N-dimensional arrays. So a faster way to do your convolution would be to generate the 3d kerne... | python|arrays|for-loop|numpy|convolution | 6 |
16,936 | 41,252,184 | masked softmax in theano | <p>I am wondering if it possible to apply a mask before performing theano.tensor.nnet.softmax?</p>
<p>This is the behavior I am looking for:</p>
<pre><code>>>>a = np.array([[1,2,3,4]])
>>>m = np.array([[1,0,1,0]]) # ignore index 1 and 3
>>>theano.tensor.nnet.softmax(a,m)
array([[ 0.1192029... | <p><a href="http://deeplearning.net/software/theano/library/tensor/basic.html?highlight=switch#theano.tensor.switch" rel="nofollow noreferrer">theano.tensor.switch</a> is one way to do this.</p>
<p>In the computational graph you can do the following:</p>
<pre><code>a_mask = theano.tensor.switch(m, a, np.NINF)
sm = th... | numpy|theano|array-broadcasting|softmax | 0 |
16,937 | 68,478,251 | How to make secondary labels in matplotlib chat? | <p>I need add secondary label to my y axios in matplotlib chat.</p>
<p><img src="https://i.stack.imgur.com/24jX0.png" alt="enter image description here" /></p> | <p>I have sample code I used already.</p>
<pre><code> def annotate_yrange(self, ymin, ymax,
label=None, fontsize=12,
offset=-0.1,
width=-0.1,
text_kwargs={'rotation': 'horizontal'},
ax=None,
... | python|pandas|numpy|matplotlib | 1 |
16,938 | 68,469,352 | Saving a cleaned dataframe python | <p>i'm working on cleaning a huge dataset, i've finished to clean it and want to save it in a new CSV
So i can start a new notebook from the cleaned.CSV
The problem is when i save it into a new CSV i lost a lot of data.
See below my first df.info with 307381 non-null everywhere and Index: 307381 entries, 6 to 999755.</... | <p>Ok i finaly found my answer, as i couldn't found on stackoverflow, i will post it here.</p>
<p>to keep all cleaned (datetime, object .....) we need to use</p>
<pre><code>df.to_pickle("cleaned.csv")
</code></pre>
<p>And to open it later use this:</p>
<pre><code>df_cleaned = pd.read_pickle("cleaned.csv... | python|pandas|database|dataframe | 0 |
16,939 | 68,818,091 | Savvy way of deleting empty rows in Numpy | <p>Is there any better way than looping through an array to check for an empty row and deleting those? I have an array of strings, I want to delete those rows which have no strings, the only way I can think of is looping through.</p>
<p>Eg</p>
<pre><code>a = np.array([[''],
['string1'],
['stri... | <p>If you have an array</p>
<pre><code>a = np.array(['foo', '', 'bar', '', '', 'baf'])
</code></pre>
<p>you could use logical indexing</p>
<pre><code>a[a!=''] # -> array(['foo', 'bar', 'baf'], dtype='<U3')
</code></pre>
<p>If you have a 2D numpy array of strings</p>
<pre><code>b = np.array([[''],
['s... | python|arrays|numpy | 2 |
16,940 | 68,713,249 | Column name of maximum of each row in a dataframe | <p>I have a dataframe and i wanted a column filled with maximum value of each row so i used this :</p>
<pre><code> df_1['Highest_Rew_patch'] = df_1.max(axis=1)
</code></pre>
<p>output:</p>
<pre><code> Patch_0 Patch_1 Patch_2 ... Patch_7 exp_patch Highest_Rew_patch
0 0.0 70.0 70.0 ... 0.0 ... | <p>You can select the columns starting by <code>Patch</code> and then just keep the column names where the value is equal to the max:</p>
<pre><code>>> s = df.iloc[:, df.columns.str.startswith('Patch')].apply(
lambda s: s.index[s.eq(s.max())].tolist(), axis=1)
>> s
0 [Patch_1, Patch_2]
1 [Patch_... | python|python-3.x|pandas|dataframe|max | 1 |
16,941 | 36,676,800 | Repeating values in a "group by" pandas dataframe | <p>I have the following pandas DataFrame:</p>
<pre><code> email cat class_price
0 email1@gmail.com cat1 1
1 email2@gmail.com cat2 2
2 email3@gmail.com cat2 4
3 email1@gmail.com cat2 4
4 email2@gmail.com cat2 1
5 email3@gmail.com cat1 ... | <p>You can just reset the index, putting data in columns.</p>
<pre><code>In [1]: print (test_df2.reset_index(name='maxvalue').to_string(index=False))
email cat maxvalue
email1@gmail.com cat1 2
email1@gmail.com cat2 4
email2@gmail.com cat2 2
email2@gmail.com cat3 ... | python|pandas|dataframe | 8 |
16,942 | 5,224,420 | Differences between python's numpy.ndarray and list datatypes | <p>What are the differences between python's numpy.ndarray and list datatypes? I have vague ideas, but would like to get a definitive answer about:</p>
<ol>
<li>Size in memory</li>
<li>Speed / order of access</li>
<li>Speed / order of modification in place but preserving length</li>
<li>Effects of changing length </li... | <p>There are several differences:</p>
<ul>
<li>You can append elements to a list, but you can't change the size of a
´numpy.ndarray´ without making a full copy.</li>
<li>Lists can containt about everything, in numpy arrays all the
elements must have the same type.</li>
<li>In practice, numpy arrays are faster for vect... | python|arrays|list|performance|numpy | 6 |
16,943 | 53,128,030 | how to know the cell which has the different shape in a given column | <p>How to know the cell which has the different shape in a given column or the whole dataset?</p>
<p>I am encountering a problem that in some places of my data the cell has multiple numbers like (1,2) or [1,2], instead of only one number (only one number is desired. )</p>
<p>For example</p>
<pre><code>df = pd.DataFr... | <p>This will do the trick:</p>
<pre><code>df[df.column1.str.len() > 1]
</code></pre> | python|pandas | 0 |
16,944 | 65,639,035 | in python how to create a vector composed of numbers from 1 to 100 and each number is repeated 100 times | <p>I need to create a vector composed of numbers from 1 to 100 and each number is repeated 100 times.
I was able to come up with this solution, but I need to avoid using i,i,i,i,i,i....,i,i,i</p>
<pre><code>a = np.zeros(0)
for i in range(1,100):
a = np.r_[a,[i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,... | <p>You can do it in one line with <a href="https://numpy.org/doc/stable/reference/generated/numpy.repeat.html" rel="nofollow noreferrer"><code>np.repeat</code></a>:</p>
<pre class="lang-python prettyprint-override"><code>a = np.repeat(np.arange(1, 100), 100)
print(a)
# [ 1, 1, 1, ..., 99, 99, 99]
</code></pre> | python|numpy|loops|vector|jupyter | 5 |
16,945 | 65,795,107 | Is it possible in Keras to use the inputs of a neural network in a following custom layer again? | <p>For a personal Layer at the end of the network I need the inputs of the first Layer again. Is it possible to use the same inputs twice?
In the last final personal Layer I need the inputs of the model which contains the changeable values for
a,b and c to do a final matrix multiplication. The problem is that the matri... | <p>It is possible:</p>
<pre><code>class PersonalLayer(tf.keras.layers.Layer):
def __init__(self):
super(PersonalLayer, self).__init__()
def call(self, input_data): # Calculation of the matrix multiplication
a = input_data[1][0,1]
b = input_data[1][0,2]
c = input_data[1][0,3]
... | python|tensorflow|keras | 1 |
16,946 | 65,489,859 | replace/fill columns base on agg of multiple columns | <p>I have a DF as follows:</p>
<pre><code>| feat1 | feat2 | feat3 | feat4 | label |
|--------:|---------|----------|---------|-------|
| 0.1856 | -0.186 | 1.681 | 0.56781 | 0 |
| 0.78671 | 0.1761 | -0.671 | 0.176 | 0 |
| -1.681 | 0.15689 | -0.18689 | 0.681 | 0 |
</code></pre>
<p>I want... | <p>You can use <a href="https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.filter.html" rel="nofollow noreferrer"><code>df.filter</code></a> to filter all columns containing <code>feat</code> and calculate <code>mean</code> across <code>axis=1</code> , and convert to int after comparison.</p>
<... | python|pandas | 4 |
16,947 | 65,544,713 | Slicing filtered DataFrame or Series (slicing observed results with negative index) | <p>There is a simple DataFrame and I would like to get some last results - I tried to use the negative indexing for this, but faced with an empty result.</p>
<pre><code>import pandas as pd
import numpy as np
dates = pd.date_range('1/1/2000', freq = '3D', periods=8)
df = pd.DataFrame(np.random.randn(8, 4), index=dates,... | <p>i think you need to do if you want to do negative indexing for last two number:</p>
<pre><code>df.D.iloc[-2:]
</code></pre>
<p>if you do <code>df.D.iloc[-1:-2]</code>, it implies that you are trying to start from last index and end at second index (end is not inclusive); but <strong>without specifying step it won't... | pandas|dataframe|indexing|slice | 1 |
16,948 | 3,065,624 | How to speed-up nested loop? | <p>I'm performing a nested loop in python that is included below. This serves as a basic way of searching through existing financial time series and looking for periods in the time series that match certain characteristics. </p>
<p>In this case there are two separate, equally sized, arrays representing the 'close' (... | <p>Update: (almost) completely vectorized version below in "new_function2"... </p>
<p>I'll add comments to explain things in a bit. </p>
<p>It gives a ~50x speedup, and a larger speedup is possible if you're okay with the output being numpy arrays instead of lists. As is:</p>
<pre><code>In [86]: %timeit new_funct... | python|numpy|scipy|finance | 7 |
16,949 | 63,364,301 | pandas add column of different days to datetime column | <p>I have a DataFrame that looks like this.</p>
<pre><code> time daysToExp
0 2020-08-11 13:53:57.083388 0
1 2020-08-11 13:53:57.083388 1
2 2020-08-11 13:53:57.083388 3
3 2020-08-11 13:53:57.083388 4
4 2020-08-11 13:53:57.083388 8
</code></... | <p>You can use <code>pd.to_timedelta</code>:</p>
<pre><code>df['time'] + pd.to_timedelta(df['daysToExp'], unit='D')
</code></pre>
<p>or equivalently:</p>
<pre><code>df['time'] + pd.to_timedelta('1D') * df['daysToExp']
</code></pre> | python|pandas | 2 |
16,950 | 63,598,638 | Applying a function to chunks of the Dataframe | <p>I have a <code>Dataframe (df)</code> (for instance - simplified version)</p>
<pre><code> A B
0 2.0 3.0
1 3.0 4.0
</code></pre>
<p>and generated 20 bootstrap resamples that are all now in the same df but differ in the <em>Resample Nr.</em></p>
<pre><code> ... | <p>Use <a href="https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.assign.html" rel="nofollow noreferrer"><code>DataFrame.assign</code></a> to create two new columns <code>x</code> and <code>y</code> that corresponds to <code>df['A'] * df['B']</code> and <code>df['B']**2</code>, then use <a hre... | python|pandas|dataframe|resampling | 2 |
16,951 | 29,820,294 | pandas long to wide windowing | <p>I'm trying to reshape a data frame by converting 'windows' of row data to column data. For instance, with a window size of 2, given the data frame:</p>
<pre><code> A B
0 a1 b1
1 a2 b2
2 a3 b3
3 a4 b4
</code></pre>
<p>I would like to produce the data frame:</p>
<pre><code> A1 A2 B1 B2
0 a1 a2... | <p>You can view the operation with window size of 2 as shifting the DataFrame upward by one row, concatenating it horizontally with the original DataFrame, and finally some reordering. Thus, without iterating over rows it can be done like this:</p>
<pre><code>res = df.merge(df.shift(-1), left_index=True, right_index=T... | python|pandas | 0 |
16,952 | 30,126,960 | Reading an image in python - experimenting with images | <p>I'm experimenting a little bit working with images in Python for a project I'm working on.</p>
<p>This is the first time ever for me programming in Python and I haven't found a tutorial that deals with the issues I'm facing.</p>
<p>I'm experimenting with different image decompositions, and I want to define some va... | <p>The closest analogue to Matlab's imread is <a href="http://docs.scipy.org/doc/scipy-0.15.1/reference/generated/scipy.misc.imread.html" rel="nofollow">scipy.misc.imread</a>, part of the <a href="http://scipy.org/" rel="nofollow">scipy</a> package. I would write this code as:</p>
<pre><code>import scipy.misc
image_ar... | python|image|opencv|numpy|imread | 1 |
16,953 | 53,661,577 | how to parse individual invalid json obejcts to valid json and make a dataframe in python | <p>how to parse an invalid JSON to valid JSON and make data frame which dynamically selects the keys as columns and values as rows in python. please help me out guys I tried in many different ways but still, I couldn't figure out.</p>
<pre><code>data = c.execute("SELECT FRUITS .........FROM FOREST") #sql query
output... | <p>Unclear as to what exactly you are trying to do, but if your goal is to create a json structure from your sql query, try this:</p>
<pre><code>import pandas as pd
import json
df = pd.read_sql(sql, con)
output = df.to_json()
output = json.loads(output)
print(json.dumps(output, indent=4))
</code></pre>
<p>If you are ... | python|json|pandas|dataframe|key-value | 0 |
16,954 | 53,384,185 | Tensorflow not working right, not sure what is wrong | <p>I use Android Studio to code and in the tensorflowObjectDetection example, I commented out <code>@Disable</code> and added our Vuforia key, and when I run the program it just crashes. I've narrowed it down to this code:</p>
<pre><code>private void initTfod() {
int tfodMonitorViewId = hardwareMap.appContext.get... | <p>Figured it out. The vuforia needed more time to init, so we did this:</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>robot.initVuforia(hardwareMap);
while(robot.vuforiaL... | java|android|android-studio|tensorflow | 0 |
16,955 | 53,471,105 | Creating a Tensorflow Model Based on Hough Lines | <p>So I have a project of creating an autonomous rc car. In order to do virtual training, I have set up a simulator to collect picture data, along with a steering angle. I then use an OpenCV program, using Hough line Detection, to detect the 3 lines on the road. I want to create a model that when images are inputted th... | <p>now is quite late, but I wish this answer could still be useful.</p>
<p>The CNN is a NN with bidimensional input, so is feed with constant length matrices (images for example); however most of their learning capabilities comes from the fact that CNN's are able of learning from correlated data, so it will work bette... | python|pandas|opencv|tensorflow|computer-vision | 0 |
16,956 | 17,596,733 | Filtering rows from pandas dataframe using concatenated strings | <p>I have a pandas dataframe plus a pandas series of identifiers, and would like to filter the rows from the dataframe that correspond to the identifiers in the series. To get the identifiers from the dataframe, I need to concatenate its first two columns. I have tried various things to filter, but none seem to work so... | <p>I think you're asking for something like the following:</p>
<pre><code>In [1]: other_ids = pd.Series(['a', 'b', 'c', 'c'])
In [2]: df = pd.DataFrame({'vals': [1, 2, 3, 4], 'ids': ['a', 'b', 'c', 'f']})
In [3]: df
Out[3]:
ids vals
0 a 1
1 b 2
2 c 3
3 f 4
In [4]: other_ids
Out[4]:
0 ... | python|pandas | 3 |
16,957 | 17,418,108 | Elegant way to perform tuple arithmetic | <p>What is the most elegant and concise way (without creating my own class with operator overloading) to perform tuple arithmetic in Python 2.7?</p>
<p>Lets say I have two tuples:</p>
<pre><code>a = (10, 10)
b = (4, 4)
</code></pre>
<p>My intended result is</p>
<pre><code>c = a - b = (6, 6)
</code></pre>
<p>I curr... | <p>If you're looking for fast, you can use numpy:</p>
<pre><code>>>> import numpy
>>> numpy.subtract((10, 10), (4, 4))
array([6, 6])
</code></pre>
<p>and if you want to keep it in a tuple:</p>
<pre><code>>>> tuple(numpy.subtract((10, 10), (4, 4)))
(6, 6)
</code></pre> | python|python-2.7|numpy|tuples | 88 |
16,958 | 71,969,321 | Tensorflow "decode_png" keeps printing "Cleanup called..." | <p>I'm using tensorflow to open some .png images and every image it opens, an annoying message is printed.</p>
<pre><code>def open_img(path):
img = tf.io.read_file(path)
img = tf.io.decode_png(img)
return tf.image.resize(img, [IMG_HEIGHT, IMG_WIDTH])
</code></pre>
<p>Every time i try to open an image it say... | <p>Updating my TensorFlow installation to version 2.8 fixed the issue for me.</p> | tensorflow|deep-learning|tensorflow2.0|kaggle | 4 |
16,959 | 71,938,751 | How can I update a numpy array with index in another numpy array | <p>I have</p>
<ul>
<li>an numpy.array <strong>a</strong> of shape (n1, n2, n3, n4)</li>
<li>an index array <strong>idx</strong> of shape (n1, n2, i1)</li>
</ul>
<p>what I want to do is like the code below</p>
<pre><code>for i in range(n1):
for j in range(n2):
for k in range(i1):
b[i, j, k, :] = ... | <p>Using as starting point:</p>
<pre><code>import numpy as np
n1, n2, n3, n4, i1 = range(2, 7)
a = np.random.randint(10, size=(n1, n2, n3, n4))
idx = np.random.randint(n3, size=(n1, n2, i1))
b = np.zeros_like(a, shape=(n1, n2, i1, n4))
</code></pre>
<p>In general you can do the following:</p>
<pre><code>I, J, K = np.... | python|numpy | 0 |
16,960 | 71,895,971 | Remove header index in pandas Dataframe | <p>I have the following dataframe :</p>
<pre><code>
0 1 2 ... 630 631 632
0 index MATRICULE ID_UEV ...
1 9936-25-3989-4-000-0000 9936-25-3989-4-000-0000 01045406 ...
2 9739-83-... | <p>You can use</p>
<pre><code>df.columns = df.loc[0]
df = df.drop(0)
</code></pre>
<p>This sets the columns to the items in the first row, then drops the first row.</p> | python|pandas|dataframe|header | 1 |
16,961 | 71,904,078 | Getting the index column in groupby() | <p>I have been using <code>groupybe()</code> to see how many each employee has done projects. It works fine but I would like to extract the employee_id column too, but i can not use it:
<a href="https://i.stack.imgur.com/RuIbn.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/RuIbn.png" alt="enter imag... | <p>The <code>.groupby()</code> function takes a column or columns and sets as the index of the output DataFrame by default. If that's not the desired output, try adding the <code>as_index = False</code> argument into the groupby function. Documentation <a href="https://pandas.pydata.org/docs/reference/api/pandas.DataFr... | python-3.x|pandas|dataframe | 1 |
16,962 | 71,951,008 | Multiindexed columns with missing levels in Pandas | <p>I'm trying to use a column-multiindexed dataframe, but I don't quite get how to handle columns with missing levels. As a MWE, I create a dummy dataframe like this</p>
<pre><code>In [4]: df = pd.DataFrame(
...: np.random.rand(2, 4),
...: columns=pd.MultiIndex.from_product([['A', 'B'], [1, 2]])
...: )... | <p>One hack with replace missing values in columns by empty string:</p>
<pre><code>print (df.rename(columns= lambda x: '' if pd.isna(x) else x)[('C','')])
0 3
1 3
Name: (C, ), dtype: int64
</code></pre> | python|pandas|dataframe | 1 |
16,963 | 71,970,518 | How to convert a ' ' to an int? | <p>I have a dataframe with a column that is objects. When i check for null values the data set says it has no null values but there is one row thats has a ' ' for age.
I want to convert the column from object to int but that 1 value is giving me a hard time.</p>
<p>Here is what i have tried:</p>
<pre><code>df['perpetra... | <p>As I mentioned in my comment, I guess the assingment is missing.</p>
<p>Here is a very basic example with an <code>''</code> string.</p>
<pre><code>import pandas as pd
df = pd.DataFrame({'a':[1,2,3,'',4,5]})
df['a'].replace('',0, inplace=True)
# df['a'] = df['a'].replace('',0) as an equivilant
>>> df.head(... | python|pandas|dataframe|numpy | 1 |
16,964 | 17,116,814 | How to split text in a column into multiple rows | <p>I'm working with a large csv file and the next to last column has a string of text that I want to split by a specific delimiter. I was wondering if there is a simple way to do this using pandas or python?</p>
<pre><code>CustNum CustomerName ItemQty Item Seatblocks ItemExt
32363 McCartney, ... | <p>This splits the Seatblocks by space and gives each its own row.</p>
<pre><code>In [43]: df
Out[43]:
CustNum CustomerName ItemQty Item Seatblocks ItemExt
0 32363 McCartney, Paul 3 F04 2:218:10:4,6 60
1 31316 Lennon, John 25 F01 1:13:36:1,12 1:1... | python|pandas|dataframe | 237 |
16,965 | 18,083,816 | Efficient way to create an array that is a sequence of variable length ranges in numpy | <p>Suppose I have an array</p>
<pre><code>import numpy as np
x=np.array([5,7,2])
</code></pre>
<p>I want to create an array that contains a sequence of ranges stacked together with the
length of each range given by x:</p>
<pre><code>y=np.hstack([np.arange(1,n+1) for n in x])
</code></pre>
<p>Is there some way to d... | <p>You could use accumulation:</p>
<pre><code>def my_sequences(x):
x = x[x != 0] # you can skip this if you do not have 0s in x.
# Create result array, filled with ones:
y = np.cumsum(x, dtype=np.intp)
a = np.ones(y[-1], dtype=np.intp)
# Set all beginnings to - previous length:
a[y[:-1]] -= x... | python|numpy | 5 |
16,966 | 55,229,483 | Identify columns containing dictionaries in pandas | <p>I have a dataset which is similar to:</p>
<pre><code>pd.DataFrame({
'col1': [1,2,3,4,5,6,7],
'col2': ['a','b','c','d','e','f','g'],
'col3': [{'lol':1,'lol2':'a'},{'lol':2,'lol2':'b'},{'lol':4,'lol2':'n'},
{'lol':1,'lol2':'a'},{'lol':1,'lol2':'a'},{'lol':1,'lol2':'a'},
{'lol':1,'lol2':'a'}]})
</code></pre>... | <p>You can use a list comprehension to loop through the columns and check whether the first element in each is a dict. Note, this works for the case given and assumes that any column that contains dicts contains <em>only</em> dicts</p>
<pre><code>[i for i in df.columns if isinstance(df[i][0],dict)]
['col3']
</code></... | python|pandas|dictionary | 3 |
16,967 | 55,291,618 | Sum values across different sheets/files based on a match | <p>I have a list of names, 1 excel file with 10 sheets in it.
I am using pandas with conda 2.7.</p>
<p>The columns in the file (same column names):</p>
<ol>
<li>name</li>
<li>col1</li>
<li>col2</li>
<li>value</li>
</ol>
<p>Each sheet has names which are a subset of the previously mentioned list of names.</p>
<p>Wh... | <p>Update More sheets </p>
<pre><code>l=[df1,df2]
l=[y.set_index('name').add_prefix('sheet'+str(x+1)+'_') for x,y in enumerate(l)]
df=pd.concat(l,axis=1,sort=False)
df['New']=df.filter(like='value').sum(1)
df
Out[485]:
sheet1_value sheet2_value New
Jack 10.0 NaN 10.0
Doe 15.0 ... | python|pandas|dataframe | 1 |
16,968 | 55,170,792 | How to distinguish column datatype in pandas if all columns are assigned object | <p>I am importing a text file with 5 columns of data (of different datatypes). For some reason once the data is imported and cleaned. They are all assigned type Object in pandas so there is no way to distinguish the columns. </p>
<p>My goal is to distinguish the columns by datatype and drop columns that contain a spec... | <p>You can use pandas <code>infer_dtype</code> api to infer the datatype of the columns.</p>
<h3>Example:</h3>
<pre><code>import pandas as pd
df = pd.DataFrame({'c1': [1,2], 'c2': [1.0,2.0], 'c3': ["a","b"]})
for c in df.columns:
print (pd.lib.infer_dtype(df[c]))
</code></pre>
<p>Output:</p>
<p><code>integer
fl... | python|pandas|dataframe | 0 |
16,969 | 55,310,671 | why Automatic differentiation and gradient tape need to use context manager? | <p>Context managers can change two two related operations into one.For example:</p>
<pre><code>with open('some_file', 'w') as opened_file:
opened_file.write('Hola!')
</code></pre>
<p>The above code is equivalent to:</p>
<pre><code>file = open('some_file', 'w')
try:
file.write('Hola!')
finally:
file.close... | <p>I am not a python expert but I think that with is defined by <code>__enter__</code> method and <code>__exit__</code> method (<a href="https://book.pythontips.com/en/latest/context_managers.html" rel="nofollow noreferrer">https://book.pythontips.com/en/latest/context_managers.html</a>).
For tf.GradientTape method <co... | python|tensorflow|automatic-differentiation | 1 |
16,970 | 55,467,898 | Problem with processing large(>1 GB) CSV file | <p>I have a large <strong>CSV file</strong> and I have to sort and write the sorted data to another csv file. The CSV file has <code>10 columns</code>. Here is my code for sorting.</p>
<pre><code>data = [ x.strip().split(',') for x in open(filename+'.csv', 'r').readlines() if x[0] != 'I' ]
data = sorted(data, key=lam... | <p>Here is a <a href="https://www.dataquest.io/blog/pandas-big-data/" rel="nofollow noreferrer">Link</a> to a blog about using pandas for large datasets. In the examples from the link, they are looking at analyzing data from large datasets ~1gb in size.</p>
<p>Simply type the following to import your csv data into pyt... | python-3.x|pandas|csv | 1 |
16,971 | 55,504,932 | Is there a way to append in a 2d array without numpy? | <p>So, my computer won't load <code>numpy</code> and I need to append another row to a 2d array with 7 rows. Is there a way to append another row?</p>
<p>I've already tried <code>a.append</code> but it doesn't work because there are multiple rows.</p>
<pre><code>a = ([['Mon', 18, 20, 22, 17],
['Tue', 11, 18, 21... | <p><code>append</code> should normally work in this case. Try: </p>
<pre><code>a.append(['Avg', 12, 15, 13, 11])
</code></pre>
<p>The problem might be the double bracket <code>[[</code>.</p> | python|arrays|numpy | 1 |
16,972 | 9,652,832 | How to load a tsv file into a Pandas DataFrame? | <p>I'm new to python and pandas. I'm trying to get a <code>tsv</code> file loaded into a pandas <code>DataFrame</code>. </p>
<p>This is what I'm trying and the error I'm getting:</p>
<pre><code>>>> df1 = DataFrame(csv.reader(open('c:/~/trainSetRel3.txt'), delimiter='\t'))
Traceback (most recent call last)... | <p>The <a href="https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.read_csv.html" rel="noreferrer">.read_csv</a> function does what you want:</p>
<pre><code>pd.read_csv('c:/~/trainSetRel3.txt', sep='\t')
</code></pre>
<p>If you have a header, you can pass <code>header=0</code>.</p>
<pre><code>pd.read_csv... | python|pandas|csv | 240 |
16,973 | 56,630,537 | Python - Add OR Operator on DataFrame Apply function | <p>I've this dataframe:</p>
<pre><code>word, string1, string2
SQL, SQL is good, Programming
Java, Programming, Java is good
C#, Programming, Programming
</code></pre>
<p>I've a column that give a boolean if my column word values is present on my column string1:</p>
<pre><code>data['res'] = data.apply(lambda x: x.wor... | <p>You need to check if the string in column 1 is present in any other columns, with <a href="https://pandas.pydata.org/pandas-docs/stable/generated/pandas.Series.any.html" rel="nofollow noreferrer"><code>any()</code></a> over axis=1:</p>
<pre><code>df.apply(lambda x:x.str.contains(x.word),axis=1).iloc[:,1:].any(axis=... | python|pandas|dataframe|apply | 1 |
16,974 | 56,838,558 | Create a new column in pandas using a value of a row | <p>First of all, this is not a duplicate! I have searched in several SO questions as well as the Pandas doc, and I have not found anything conclusive!To create a new column with a row value, like <a href="https://stackoverflow.com/questions/25789445/pandas-make-new-column-from-string-slice-of-another-column">this</a> a... | <p>Thanks to @Erfan , I got to the solution:</p>
<p>Using properly the line of code in the comments and not like I was trying, I managed to:</p>
<p><code>dff=df[df['Area'].str.startswith('Population', na=False)]
dff</code></p>
<p>Which would output: <code>Population and household forecasts, 2016 to 20... NaN NaN Na... | python|pandas|dataframe | 1 |
16,975 | 25,918,149 | Why does Pandas iterate over DataFrame columns by default? | <p>Trying to understand the design rationale behind some of Pandas' features.</p>
<p>If I have a DataFrame with 3560 rows and 18 columns, then</p>
<pre><code>len(frame)
</code></pre>
<p>is 3560, but</p>
<pre><code>len([a for a in frame])
</code></pre>
<p>is 18.</p>
<p>Maybe this feels natural to someone coming fr... | <p>A DataFrame is primarily a column-based data structure.
Under the hood, the data inside the DataFrame is stored in blocks. Roughly speaking there is one block for each dtype.
<em>Each column has one dtype</em>. So accessing a column can be done by selecting the appropriate column from a single block. In contrast, se... | python|pandas | 15 |
16,976 | 25,695,324 | Append Py Pandas Dataframes into a single .csv, iterating by separate list | <p>I'm attempting to use pandas to join content from three separate flat files into a single .csv. One of the output fields, 'StoreID', is based on a separate list of ID values ('Stores.txt'). In essence, I need to publish a merged dataframe as a series of csv rows, while at the same time appending results for each s... | <p>If I understand what you are trying, the problem in your code is that you overwrite the store id with the last value so they'll all have the same store id.</p>
<p>What you appear to want is 3 dfs where you have 3 permutations of store id for each merged items and locations.</p>
<p>My approach would be to merge out... | python|csv|pandas|iteration|dataframe | 0 |
16,977 | 26,201,704 | Stacking images as numpy array | <p>I'm trying to use a for-loop to stack 6 different images one on top of another to create a 3D stack.I'm new to Python...and I am not able to figure this out. How can I create the stack and how can I access each image in the stack later? My code is somewhat like this...</p>
<pre><code>image = data.camera()
noisyIma... | <p>Try this:</p>
<pre><code># reshape array that is (N,M) to one that is (N,M,1) no increase in size happens.
n1=np.reshape(noisyImage,noisyImage.shape+(1,))
if(i==1):
result=n1
else:
# concatenate the N,M,1 version of the array to the stack using the third index (last index) as the axis.
result=np.concate... | python|arrays|image|numpy | 0 |
16,978 | 26,201,839 | average grayscale from rgb image in python | <p>I have a RGB image that I split in its three channels (I also have a plot for each channel). How can I obtain a grayscale image by taking the mean across the three channels?
I did </p>
<pre><code> np.average(my_image)
</code></pre>
<p>and I get the average value back, but if I do</p>
<pre><code> imshow(np.a... | <p>To average over the last axis of <code>my_image</code>, use</p>
<pre><code>np.average(my_image, axis=-1)
</code></pre>
<p>If <code>my_image</code> has shape <code>(H, W, 3)</code>, then <code>np.average(my_image, axis=-1)</code> will return an array of shape <code>(H, W)</code>.</p>
<p>For example,</p>
<pre><cod... | image|python-2.7|image-processing|numpy | 3 |
16,979 | 67,015,000 | Calculate nanmean in groupby and apply this mean to DF column according to subgroup | <p>I am trying to fill in missing values for the user_score column in my DataFrame. The data is currently strings, including <code>'tbd'</code>. I was looking to replace <code>'tbd'</code> values with <code>NaN</code>, then convert the column to float, and then calculate the <code>user_score</code> mean by game genre a... | <p>The <code>user_score</code> is turning null in the first line:</p>
<pre class="lang-py prettyprint-override"><code>games['user_score'] = games['user_score'].replace('tbd', np.nan, inplace=True)
</code></pre>
<p>If you assign <code>user_score</code> <em>and</em> use <code>inplace=True</code> at the same time, that wi... | python|pandas|dataframe|group-by|mean | 0 |
16,980 | 66,771,693 | How to raise the power of each array in a 2d numpy array to a power of each element in a 1d numpy array in Python? | <p>I have a numpy array filled with arrays and I want to raise each array to the power of corresponding elements in another array. To better show what I want to do here's an example:</p>
<pre><code>a = np.array([2,2,2,2])
b = np.array([1,2,3,4])
c = np.ones((4,4))*a
</code></pre>
<p>The output that i'm trying to get i... | <p>You need to be aware of broadcasting rules, which line up dimensions on the right. Two arrays of shapes</p>
<pre><code>4, 4
4
</code></pre>
<p>A do not give what you want. But the following will:</p>
<pre><code>4, 4
4, 1
</code></pre>
<p>You can add a unit dimension like this:</p>
<pre><code>c**b[:, None,]
</code... | python|arrays|numpy | 1 |
16,981 | 66,773,346 | I need to drop all rows in a certain column where there is no value or is "null": Using Python and Pandas | <p>I need to drop all rows in a certain column where there is no value ie where it is "null". But the problem is that I do not know the name of the column. But know that it is the 5th column across so I have tired using some iloc methods like "notna" and "notnull"(see below). I have includ... | <p>Your first two versions have an extra <code>df[]</code>. You can use either:</p>
<pre class="lang-py prettyprint-override"><code>df = df[df.iloc[:, 4].notna()]
</code></pre>
<p>Or:</p>
<pre class="lang-py prettyprint-override"><code>df = df[pd.notnull(df.iloc[:, 4])]
</code></pre>
<hr />
<p>To break it down more exp... | python|pandas|dataframe | 1 |
16,982 | 67,091,181 | Convert dtypes object field in datetime with correct time zone pandas | <p>I load from a PostGre Database the following Pandas DataFrame:</p>
<pre><code>df
Out[162]:
date_time production_mw
0 2019-01-01 00:00:00+01:00 10.000000000000
1 2019-01-01 01:00:00+01:00 10.000000000000
2 2019-01-01 02:00:00+01:00 10.000000000000
3 2019-01-01 03:00:00+01:... | <p>I know that is not exacty what I asked, but I am more interested in keeping the hh:mm:ss the same as in the input than setting the right time zone. So I just removed the time zone information</p>
<p>with the command</p>
<pre><code>df['date_time']=df['date_time'].apply(lambda x: x.replace(tzinfo=None))
</code></pre>
... | python-3.x|pandas|datetime|timezone-offset | 0 |
16,983 | 67,029,120 | Converting a dataframe into a config file | <pre><code>def load_config_report(config_file_path):
config = configparser.ConfigParser()
pharmacy_settings = pd.read_excel(config_file_path,
sheet_name='pharmacy_settings')
for each in pharmacy_settings['facility_name']:
config[each]['facility_alias'] = pharmac... | <p>You need to initialize an empty dictionary for <code>config[each]</code> before completing the data.</p>
<pre><code>for each in pharmacy_settings['facility_name']:
config[each] = {}
config[each]['facility_alias'] = pharmacy_settings['facility_alias']
#...
</code></pre>
<p>That's how the examples in the <... | python|python-3.x|pandas|dataframe|config | 1 |
16,984 | 67,088,314 | How to pop out the error-causing date records using pandas? | <p>I have a dataframe like as shown below</p>
<pre><code>df = pd.DataFrame({'date': ['45:42.7','11/1/2012 0:00','20/1/2012 2:48','15/1/2012 0:00',np.nan]})
</code></pre>
<p>I would like to convert the <code>date</code> column to type <code>datetime</code>.</p>
<p>So, I tried the below</p>
<pre><code>df['date'] = pd.to_... | <p>First if need to see wrong values convert to datetimes and filter missing values like:</p>
<pre><code>print(df[pd.to_datetime(df['date'], format='%d/%m/%Y %H:%M',errors='coerce').isna()])
</code></pre>
<p>I think <code>None</code> is no problem, you need specify column format and for not matched rows are generated <... | python|pandas|dataframe|datetime | 1 |
16,985 | 68,388,922 | How to fill missing data from a dataframe with another dataframe when having a common key | <p>I have two dataframe.As a sample please see the bellow.
How can I fill the df[GrossRate]== 0 with the same value from dfB when having the same ProductID</p>
<p>Basically my GrossRate in df should be
150
40
238
32</p>
<pre><code>dataA = {'date': ['20210101','20210102','20210103','20210104'],
'quanitity': [220... | <p>If same number of rows and same order in column <code>ProductID</code> is not necessary matching by <code>ProductID</code>, so use <a href="https://numpy.org/doc/stable/reference/generated/numpy.where.html" rel="nofollow noreferrer"><code>numpy.where</code></a>:</p>
<pre><code>df['GrossRate'] = np.where(df['GrossRat... | python|pandas|conditional-statements|missing-data | 1 |
16,986 | 68,389,456 | Getting ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all() in pandas | <p>Here is my code:
I have three conditions profit, loss and discount</p>
<pre><code>if df['Condition'] == "Profit":
df["price"]= df["costprice"]- 1.5*df["sp"]
elif df['Condition'] == "Loss":
df["price"]= df["costprice"]- 1.5*df[&quo... | <p>Try this <code>apply</code> call instead:</p>
<pre><code>def func(x):
if x[1] == "Profit":
x[2]= x[3]- 1.5*x[4]
elif x[1] == "Loss":
x[2]= x[3]- 1.5*x[4]
else:
x[2]= x[5]-1.5*x[4]
df = df.apply(func)
print(df)
</code></pre> | python|pandas | 1 |
16,987 | 68,042,503 | Python: Change values in a pandas DataFrame column based on multiple conditions in Python | <p>I have 2 pandas dataframes <strong>df_x</strong> and <strong>df_y</strong> and I want to update a ‘<strong>SCORE</strong>’ column that they both have in common. I want to update the score column with a score of <strong>100</strong> if the following conditions are met:</p>
<ul>
<li>Age <= 45 <strong>AND</strong> c... | <p>Try:</p>
<pre><code>c=(df['AGE']<=45) & df[['BANNED','CHARGEBACK']].ne(1).all(1)
#OR(both conditions are same so choose any one)
c=(((df['BANNED'].ne(1)) & (df['CHARGEBACK'].ne(1)))) & (df['AGE']<=45)
#your condition
#also notice that you need & in place of | in your condition that you posted i... | python|pandas | 1 |
16,988 | 59,156,140 | Count rows in a dataframe column if not some specific values | <p>Hi is have a multi column dataframe and want to print the sum of column rows if those are not <code>nan</code> or <code>-</code> or <code>?</code></p>
<pre><code>Col1 Col2 Col3
this nan 1
that ? 2
those this 5
these that 2
there - 1
</code></pre>
<p>i want the result to be </p... | <p>Chain mask created by <a href="http://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.Series.notna.html" rel="nofollow noreferrer"><code>Series.notna</code></a> with inverted checking membership by <a href="http://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.Series.isin.html" rel="nofollow nor... | python|python-3.x|pandas|dataframe | 2 |
16,989 | 59,460,378 | How to predict correctly in sklearn RandomForestRegressor? | <p>I'm working on a big data project for my school project. My dataset looks like this:
<a href="https://github.com/gindeleo/climate/blob/master/GlobalTemperatures.csv" rel="nofollow noreferrer">https://github.com/gindeleo/climate/blob/master/GlobalTemperatures.csv</a></p>
<p>I'm trying to predict the next values of "... | <p>It's not enought to use only year to predict temperature. Your need to use month data too. Here is a working example for starters:</p>
<pre><code>import pandas as pd
from sklearn.ensemble import RandomForestRegressor
df = pd.read_csv('https://raw.githubusercontent.com/gindeleo/climate/master/GlobalTemperatures.csv'... | python|pandas|bigdata|random-forest|sklearn-pandas | 1 |
16,990 | 59,145,503 | Generate values in a column in a Dataframe, based on a condition and copy paste values down | <p>I would like to create two new columns (AA & BB) in my dataset that get filled based on a condition (is = 1) of the values in A or B as well as a condition in C. AA only looks at A and C and BB only looks at B and C. If a condition is met then the value 1 is printed in column AA or BB until it gets interrupted b... | <pre><code>for index, row in df.iterrows():
AA = 0
BB = 0
# first row only dependent on A/B
if index == 0:
if row['A'] == 1:
AA = 1
if row['B'] == 1:
BB = 1
else: # all other rows dependent on previous value too
if row['A'] == 1 or df.loc[i-1, 'AA'] =... | python|pandas|dataframe | 0 |
16,991 | 59,230,202 | Code is saving separate text file, can we use pandas.dataframe() to save in excel in neat and clean format | <p>Python code is saving the separate text file, can we use pandas.dataframe() to save in excel in a neat and clean format. i tried pandas but my excel file is is incorrect format they are messy !</p>
<pre><code>import datetime
import time
from kiteconnect import KiteConnect
tdelta0=datetime.timedelta(days=30)
tdelta... | <p>IIUC,</p>
<pre><code> data = """
'open':31427, 'high':31469, 'open':31427, 'high':31469, ,'open':3145427, 'high':31469, 'open':31427, 'high':31469, 'open':31427, 'high':314569"""
</code></pre>
<p>we just need to set the correct line break and delimitor in read csv</p>
<pre><code>from io import StringIO
import ... | python|python-3.x|pandas | 0 |
16,992 | 45,250,425 | Creating new column names from a list of strings in a loop | <p>Let us say I have the following column names in pandas:
["A", "B"]</p>
<p>My problem is that I want to use a for loop that grabs the column names from the list and creates a new column name that includes part of those elements from the list.</p>
<p>In each iteration I would like to create the following:</p>
<pre>... | <p>You can use <a href="http://pandas.pydata.org/pandas-docs/stable/generated/pandas.Series.apply.html" rel="nofollow noreferrer"><code>Series.apply</code></a> in loop:</p>
<pre><code>a = ["A", "B"]
for i in a:
df[i + "_c"] = df[i].apply(SOME FUNCTION)
</code></pre>
<p>Or <a href="http://pandas.pydata.org/panda... | python|pandas | 2 |
16,993 | 45,031,335 | Replacing a specific string in dataframe text within columns Pandas | <p>I am currently having difficulty replacing a string in my pandas dataframe. So the string that I want to change is <code>"private"</code> -> <code>"pte"</code> and <code>"limited"</code> -> <code>"ltd"</code>.</p>
<p>The table looks like: </p>
<pre><code>Column: Company_Name
1. XXXX private limited
2. XX (privat... | <p>Look:</p>
<pre><code>import pandas as pd
index = [1,2,3]
columns = ['company_name']
data = ['XXXX private limited','XX (private) limited','yyy pte. limited']
df = pd.DataFrame(data, index=index, columns=columns)
df['company_name'] = df['company_name'].str.replace('private','pte')
df['company_name'] = df['company_... | python|pandas | 2 |
16,994 | 44,839,108 | How do I specify dtype str correctly? | <p>File is <strong>utility.dat</strong></p>
<pre><code>Name D L J H E M RF AF
line1 150 4.5 2.0 150 2 Copper 0.8 true
line2 140 4.5 2.0 140 2 Aluminium 0.8 true
</code></pre>
<p>My script is <strong>script.py</strong> </p>
<pre><code>import numpy
configName = "utility.dat"
lines = numpy.ge... | <p>Since i am not able to do this via NumPy i have moved over to Pandas and it worked for me.</p>
<p>I am new to Python and so still learning, but i get the idea that if i want to have a table of data with Float,String,Integers i am better off using Pandas and if i have pure table that is mostly Float and Integers i a... | python-3.x|numpy|genfromtxt | 0 |
16,995 | 57,286,492 | How to install torchtext 0.4.0 on conda | <p>The torchtext 0.4.0 library exists (can be downloaded thru pip), but <code>conda install torchtext=0.4.0</code> will not work. How can I download torchtext to a anaconda environment?</p> | <p>You can also use the pytorch channel as described on the official anaconda site:</p>
<pre><code>conda install -c pytorch torchtext
</code></pre>
<p><a href="https://anaconda.org/pytorch/torchtext" rel="nofollow noreferrer">https://anaconda.org/pytorch/torchtext</a></p> | anaconda|pytorch|torchtext | 4 |
16,996 | 57,281,765 | Should convolution with $\pm 1$ valued kernel be faster than with a regular kind? | <p>I apologize for a long question and if it seems a really strange thing to ask.</p>
<p>If I have an N by N input image and I convolve it with a kernel that consists of (+1,-1) values, should this operation be faster then if kernel had random numbers (say, from a standard normal distribution)? To me, it seems that du... | <p>Your current implementation treats the +/-1 kernel as a regular <code>.float()</code> type kernel, pytorch has no way of knowing this kernel is "special" and susceptible to efficient computation.<br>
There are works on discretizing weights in networks for better efficiency, but these discretization must be complemen... | python|machine-learning|conv-neural-network|pytorch|multiplication | 0 |
16,997 | 57,267,642 | numpy create a boolean array of False | <p>I try to initialize a <code>Boolean</code> array with <code>False</code> using <code>np.empty</code>,</p>
<pre><code>init_arr = empty(5)
init_arr.fill(False)
</code></pre>
<p>but I got</p>
<pre><code>array([0., 0., 0., 0., 0.])
</code></pre>
<p>then I create a <code>pd.Series</code>,</p>
<pre><code>dummy_ser = ... | <p>This is because the <code>empty()</code> function creates an array of floats:</p>
<pre><code>In [14]: np.empty(5).dtype
Out[14]: dtype('float64')
</code></pre>
<p>There are many ways to solve this, supplying <code>dtype=bool</code> to <code>empty()</code> being one of them.</p>
<p>But I would create an array of <... | python|python-3.x|pandas|numpy | 3 |
16,998 | 57,112,371 | How to shift the values of a certain group by different amounts | <p>I have a DataFrame that looks like this:</p>
<pre><code> user data
0 Kevin 1
1 Kevin 3
2 Sara 5
3 Kevin 23
...
</code></pre>
<p>And I want to get the historical values (looking let's say 2 entries forward) as rows:</p>
<pre><code> user data data_1 data_2
0 Kevin 1 3 23
... | <p>You can use <a href="https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.core.groupby.GroupBy.cumcount.html" rel="nofollow noreferrer"><code>groupby.cumcount()</code></a> with <code>set_index()</code> and <a href="https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.unstack.html"... | python|pandas | 0 |
16,999 | 56,896,221 | Early Stopping, Model has gone through how many epochs? | <p>I am using Keras. I am training my Neural Network and using Early Stopping. My patience is 10 and the epoch with the lowest validation loss is 15. My network runs til 25 epochs and stops however my model is the one with 25 epochs not 15 if I understand correctly</p>
<p>Is there an easy way to revert to the 15 epoch... | <p>Yes, there is one, the <code>restore_best_weights</code> parameter in the <code>EarlyStopping</code> callback, set this to True and Keras will keep track of the weights producing the best loss:</p>
<pre><code>callback = EarlyStopping(..., restore_best_weights=True)
</code></pre>
<p>See all the parameters for this ... | python-3.x|tensorflow|keras|neural-network | 6 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.