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 |
|---|---|---|---|---|---|---|
370,800 | 64,395,424 | Basic Tensorflow Model shows random outcomes | <p>I am working on building some new models, and wanted to get back to some basics. So I decided to write a classifier that classifies [1, 1] as a 1 and all other combos as a 0.</p>
<p>I have written several different variations on this and keep getting mixed results.</p>
<pre><code>from tensorflow.keras import layers,... | <p>Since you have a binary classification problem (i.e. binary cross-entropy loss and accuracy metric), you should <strong>not</strong> use a <code>linear</code> activation function for your last layer, which is the default one, if you don't specify anything, like here; from the <a href="https://keras.io/api/layers/cor... | python|tensorflow|machine-learning|keras|tensorflow2.0 | 1 |
370,801 | 64,449,145 | How do I convert the output of a JSON Dump to a format where I can access the individual elements, and convert it to a datframe? | <p>I have the output of a JSON dump:</p>
<p><img src="https://i.stack.imgur.com/u2QfB.png" alt="JSON DUMP" /></p>
<p>in str format and I have converted it into list of lists, using the following code:</p>
<pre><code>match=re.findall('\(.*?\)',file) #find the elements between the brackets ( and ) using
regex,then stor... | <p><strong>Solution:</strong>
<br />This code snippet might solve your issue:</p>
<pre><code>final_list_vals = []
NewList = [["(1086732,'edit','sysop',0,NULL,'infinity',1307)"], ["(1086732,'edit','sysop',0,NULL,'infinity',1307)"]] # This is just a sample input.
for lst in NewList:
final_list_val... | python|json|pandas|dataframe | 0 |
370,802 | 64,456,464 | How to get previous row with condition in a DataFrame of Pandas | <p>Each record(name) has date and status(begin/processing/finished). How to get the date of <strong>Begin</strong> status for each row? Thank you.</p>
<pre><code> date name status
0 2020-10-01 name_01 Begin
1 2020-10-02 name_02 Begin
2 2020-10-03 name_01 Processing
3 2020-10-04 nam... | <p>Take advantage of alphabetical order of <code>begin</code>, <code>processing</code>, <code>finished</code>, Use <code>sort_values</code> and groupby <code>transform</code> <code>first</code></p>
<pre><code>df['begin_at'] = df.sort_values('status').groupby('name').date.transform('first')
Out[719]:
date ... | python|pandas|numpy|dataframe | 2 |
370,803 | 64,418,006 | What is the best way to both drop columns and insert column names using Python Pandas? | <p>I have a csv with a few dozen columns that are all unnamed by default and about half of which need to be removed. I've figured out how to name the columns upon import. Example:</p>
<pre><code>df = pandas.read_csv('ColumnNameTest.csv', names=['ID', 'Name', 'Flavor'])
</code></pre>
<p>And I <em>think</em> I figured ou... | <p>If you want to drop alot of columns and keep some, you can use iloc to select a subset of columns:</p>
<pre><code>df.iloc[:,[3,5,9,10]]
#then name all columns that left
df.columns=['col3','col5','col9','col10']
</code></pre>
<p>Or keep a range of columns:</p>
<pre><code>df.iloc[:,3:9]
</code></pre> | python|pandas|multiple-columns | 1 |
370,804 | 64,425,723 | in Python Pandas above 1.1.0 InvalidIndexError when slicing MultIndex frame with DatetimeIndex | <p>My data contains timeline values for multiple areas. I want to slice according to date.</p>
<p>Here is my MultIndex Dataframe, I call Bob:</p>
<pre><code>arrays = [[1,1,2,2],
['2020-01-06', '2020-01-13','2020-01-06', '2020-01-13']]
df = pd.DataFrame(np.transpose(arrays))
df[1] = pd.to_datetime(df[1])
inde... | <p>It seems not longer supported, you can use alternative with <a href="http://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.Index.get_level_values.html" rel="nofollow noreferrer"><code>Index.get_level_values</code></a> and <a href="http://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.Index.isin... | python|pandas|dataframe|datetime|multi-index | 4 |
370,805 | 64,508,040 | How to do a Boolean mask to multiple columns with the same value | <p>I have a DataFrame that has 6 columns, Z, A, B, C, D, E. Also has multiple rows. I am interested in leaving in the DataFrame all the data except where in columns A through E are equal to 0 in the same row.</p>
<pre><code>df = pd.read_excel('Energy.xls')
</code></pre>
<pre><code>df
</code></pre>
<pre><code>Z| A | B |... | <p>I believe your proble is not a big deal. so here is my answer:</p>
<pre><code>#df is your dataFrame
newDf = df[df["A"] != 0 & df["B"] & df["C"] & df["D"] !=0 & df["E"] != 0]
</code></pre> | python|pandas | 0 |
370,806 | 64,284,097 | Pandas OLS Random Effects model - weird prediction values | <p>I am trying to create a RE-model using Pandas. I only have previous experience in Stata.</p>
<p>My aim is to generate predicted temperatures by regressing the temperature data on a set of dummies. The first set of dummies represents the month of the year while the second dummy represents the station.</p>
<p>I suspec... | <p>So, I found out that Python does not add an intercept (<a href="https://stackoverflow.com/questions/25514220/pandas-statsmodel-ols-predicting-future-values">Pandas/Statsmodel OLS predicting future values</a>).</p>
<p>Thus, the solution:</p>
<pre><code>data['intercept'] = 1
var=data.loc[:,'intercept':'m_12']
</code><... | python|pandas|statsmodels|linearmodels | 0 |
370,807 | 64,491,172 | Panel Regression in Pandas issue | <p>I'm using the <a href="https://stackoverflow.com/questions/24074481/fama-macbeth-regression-in-python-pandas-or-statsmodels">answer here</a> to run a panel regression in python, as I do not have access to <code>statsmodels</code></p>
<p>My dataframe looks as follows:</p>
<pre><code> ... | <p>You cannot groupby named indexes in pandas by calling their names. When you run <code>df.groupby(['Date', 'Range_1', 'Range_2', 'info_1', 'info_2'])</code> it is effectively doing nothing. Here an example of what I mean:</p>
<pre><code>### Creating a multi-index dataframe
arrays = [['bar', 'bar', 'baz', 'baz', 'foo'... | python|pandas|regression | 0 |
370,808 | 64,366,760 | How to use np.put when target array is more than 2d? | <p>I want to change BGR image elements. <br />
In detail, if 2nd element equals 3rd one, both of them are changed to 0.</p>
<pre><code>arg1 = np.argwhere(img[:, :, 1] == img[:, :, 2])
np.put(img[:, :, 1], arg1, 0)
np.put(img[:, :, 2], arg1, 0)
</code></pre>
<p>I tried this but doesn't work.</p> | <p>Your code does work but just not the way you might be expecting. <code>np.put</code> expects the indices of multi-dimensional matrices as tuples, while <code>np.argwhere</code> gives you a 2d-array of rows and columns.</p>
<p>To make it mush simpler, you can use boolean masks and get the job done-</p>
<pre class="la... | python|numpy | 2 |
370,809 | 64,435,207 | Timeline Slider for Dataset Python Bokeh | <p>I need ur help. I try to plot a route on a map.
The dataset consists of lon and lat. I want to include only a part of the route with a interactive solution like a RangeSlider. For example only the 2th and 4th index.
Unfortunately I do not know how to set the callback function properly.
How can I link the callback to... | <p>I found a solution for all wondering:</p>
<pre><code>from bokeh.io import output_file, show
from bokeh.models import ColumnDataSource, GMapOptions, CustomJS
from bokeh.plotting import gmap, ColumnDataSource, figure
from bokeh.layouts import column, row
from bokeh.models.widgets import RangeSlider
import numpy as np... | python|bokeh|gmap.net|bokehjs|pandas-bokeh | 1 |
370,810 | 64,492,950 | Python script works but throws error - pandas.errors tokenizing data , Expected 9 fields saw 10 | <p>I am new to python. I am trying to read json response from requests and filtering using pandas to save in csv file. This script works and gives me all the data but its throws this error after execution -</p>
<p>I am not able to figure out why its throwing this error ? How can I pass this error ?</p>
<p>Error -</p>
<... | <p>Your question was answered <a href="https://stackoverflow.com/questions/18039057/python-pandas-error-tokenizing-data">here</a></p>
<p>Here's the takeaway:</p>
<p>You need to substitute:</p>
<pre><code>df = pd.read_csv("Data_script4.csv")
</code></pre>
<p>with this:</p>
<pre><code>df = pd.read_csv('Data_scr... | python|python-3.x|pandas | 1 |
370,811 | 64,575,949 | Compute pairwise element of two 1D array | <p>Here is my problem :</p>
<p>let's say my two array are :</p>
<pre><code>import numpy as np
first = np.array(["hello", "hello", "hellllo"])
second = np.array(["hlo", "halo", "alle"])
</code></pre>
<p>Now I want to get the matrix of distance between each elem... | <p>You can use SciPy's <a href="https://docs.scipy.org/doc/scipy/reference/generated/scipy.spatial.distance.cdist.html" rel="nofollow noreferrer"><code>cdist</code></a> for that:</p>
<pre class="lang-py prettyprint-override"><code>import numpy as np
from scipy.spatial.distance import cdist
def diff_len(string1, string... | arrays|python-3.x|numpy|vectorization|pairwise | 1 |
370,812 | 64,489,548 | Directly update the optimizer learning rate | <p>I have a specific learning rate schedule in mind. It is based on the <code>epoch</code> but differs from the generally available ones I am aware of including <code>StepLR</code>.</p>
<p>Is there something that would perform the equivalent to:</p>
<p><code>optimizer.set_lr(lr)</code></p>
<p>or</p>
<p><code>optimizer.... | <p>You can do this in this way:</p>
<pre><code>for param_group in optimizer.param_groups:
param_group['lr'] = lr
</code></pre> | pytorch|learning-rate | 1 |
370,813 | 64,275,053 | Unable to make predictions from Keras model due to CUDA errors | <p>I am new to Python. I followed <a href="https://towardsdatascience.com/time-series-forecasting-with-recurrent-neural-networks-74674e289816" rel="nofollow noreferrer">this website</a> as a guide to do some future predictions. After I did everything, the graph did not show up and I got these errors:</p>
<pre><code>202... | <p>From the error message, it looks like you didn’t install the CUDA driver for your graphics card.</p> | python|pandas|tensorflow | 0 |
370,814 | 64,278,144 | How should I improve my accuracy in Transfer learning? | <p><strong>I am training a model for Optical Character Recognition of Gujarati Language. The input image is a character image. I have taken 37 classes. Total training images are 22200 (600 per class) and testing images are 5920 (160 per class). My input images are 32x32 in size.</strong></p>
<p><strong>Below is my code... | <p>Rescale the input data. You can do this by setting rescale factor to 1. / 255 in the ImageDataGenerator.</p> | tensorflow|deep-learning|computer-vision|ocr|transfer-learning | 0 |
370,815 | 64,264,509 | esp32_cam read and process image | <p>I am trying to use tensorflow-lite on a esp32_cam to classify images.
I defined the following sub-tasks that i need to solve:</p>
<ol>
<li>Take photo</li>
<li>Reduce size of photo to (e.g.) 28x28 pixels grayscale</li>
<li>run inference with trained model</li>
</ol>
<p>For now I am stuck between point 1 and 2 and can... | <p>I haven't worked with the ESP32 Camera so I can't talk about that but I've done a similar project on STM32 so here is all I can answer:</p>
<h3>1. How do I correctly record an image?</h3>
<p>I also had trouble setting up a camera on my microcontroller so I thought the same as you, getting back the image to the PC th... | c++|arduino|tensorflow-lite|esp32 | 4 |
370,816 | 64,594,493 | Filter out NaN values from a PyTorch N-Dimensional tensor | <p>This question is very similar <a href="https://stackoverflow.com/questions/61503138/filter-out-np-nan-values-from-pytorch-1d-tensor">to filtering <code>np.nan</code> values from pytorch in a -Dimensional tensor</a>. The difference is that I want to apply the same concept to tensors of 2 or higher dimensions.</p>
<p>... | <p>Use PyTorch's <code>isnan()</code> together with <code>any()</code> to slice <code>tensor</code>'s rows using the obtained boolean mask as follows:</p>
<pre><code>filtered_tensor = tensor[~torch.any(tensor.isnan(),dim=1)]
</code></pre>
<p>Note that this will drop any row that has a <code>nan</code> value in it. If y... | python|python-3.x|pytorch|filtering|nan | 6 |
370,817 | 64,374,660 | Apply transformation only on string columns with Pandas, ignoring numeric data | <p>So, I have a pretty large dataframe with 85 columns and almost 90,000 rows and I wanted to use str.lower() in all of them. However, there are several columns containing numerical data. Is there an easy solution for this?</p>
<pre><code>> df
A B C
0 10 John Dog
1 12 Jack Cat
2 54 Mary Mo... | <p>From pandas 1.X you can efficiently select string-only columns using <a href="https://stackoverflow.com/a/62978895/4909087"><code>select_dtypes("string")</code></a>:</p>
<pre><code>string_dtypes = df.convert_dtypes().select_dtypes("string")
df[string_dtypes.columns] = string_dtypes.apply(lambda x... | python|pandas|dataframe | 5 |
370,818 | 64,354,466 | how can I create multiple dataframes in forloop? | <p><strong>I want to create multiple dataframe using forloop</strong></p>
<p>Here is what i've done so far</p>
<pre><code>for x in df['Area'].unique():
cousines=[]
for i in Cousines:
index = df[df['Area']==x].index
df_x = df.loc[index]
Rating_mean = df_x[df_x['Cousines'].str.contains(i)]... | <p>Every time you create a df append it to a list:</p>
<pre><code>dfs = []
for x in df['Area'].unique():
cousines=[]
for i in Cousines:
index = df[df['Area']==x].index
df_x = df.loc[index]
Rating_mean = df_x[df_x['Cousines'].str.contains(i)]['Rating'].mean()
dict1={'Cousines':i,'... | python|pandas|dataframe | 0 |
370,819 | 64,471,799 | how to create an object from a python array | <p>I have the following structure, which I convert from a .txt with pandas</p>
<pre><code> [[000001, 'PEPE ', 'S', 'LAST_NAME ', 'CIP ', 'CELLPHONE'],
[0000002, 'LUIS ', 'S', 'ADRESS ', ' ', 'nan'],
[0000003, 'PEDRO ', 'S', 'STREET ', 'CITY', ' nan']]
</code><... | <p>Key: Use <a href="https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.melt.html" rel="nofollow noreferrer">df.melt()</a> to unpivot the table and subsequently perform <a href="https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.to_dict.html" rel="nofollow noreferrer">d... | python-3.x|pandas|list|dataframe | 2 |
370,820 | 64,579,065 | Optimize Python code for row wise comparison | <p>I have written Python code which uses multiple if condition and a for loop. The main objective of code is to produce traffic light system based on certain condition.</p>
<pre><code>Red = -1
Yellow = 0
Green = 1
</code></pre>
<p>It takes 4 months (m0, m1, m2, m3) and dataframe as an input and run the condition throug... | <p>The <code>for</code> loop you are doing for every row is built in a <code>pd.DataFrame</code> with the <code>apply()</code> method.</p>
<p>This method basically applies a given function to every row in your <code>pd.DataFrame</code>.</p>
<p>Based only in one of your cases, you could do the following:</p>
<pre><code>... | python|pandas|optimization | 0 |
370,821 | 64,185,752 | Pandas Sorting and Regrouping Using Multiple Conditions | <p>This is the sample data -</p>
<pre><code>Product Type Name Time Value
Product a Medicare CVS 2018-10-05 10
Product a Medicare Cigna 2018-10-05 20
Product a Medicare United 2018-10-05 30
Product a Medicare Humana 2018-10-05 40
Product a Medicare Centene 2018-1... | <p>IIUC, sort the dataframe first, then group by and use head:</p>
<pre><code>df.sort_values('Value', ascending=False)\
.groupby(['Product', 'Type', 'Time'])\
.head(2)\
.sort_index()
</code></pre>
<p>Output:</p>
<pre><code> Product Type Name Time Value
3 Product a Medicare Humana 2018-... | python|pandas | 1 |
370,822 | 64,360,391 | Creating a dictionary from DataFrame column and values | <p>I have a DataFrame that looks like this:</p>
<pre><code> A B C D
0 One Two Three Four
1 31 47 44 22
2 53 38 11 27
3 86 84 81 87
4 57 4 23 46
</code></pre>
<p>I want to create a loop that will give me key of one, two, three, with values of ... | <p>You can use DataFrame.to_dict() in order to accomplish it.</p>
<p>You can find more about the topic on:</p>
<p><a href="https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.to_dict.html" rel="nofollow noreferrer">https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.to_di... | python|pandas|dictionary | 2 |
370,823 | 64,273,825 | python/pyspark - Reading special characters from csv and writing it back to the file | <p>I am reading a csv file which has some of the values in a column like this -</p>
<pre><code>MÉXICO
ATLÁNTICO
</code></pre>
<p>I am reading the file with encoding = 'utf8' but after the processing values are getting changed like below</p>
<pre><code>M�XICO
ATL�NTICO
</code></pre>
<p>What can I do to retain the or... | <p>Your input file may not be in utf8 encoding.
You can convert to utf8 before reading from the file. That should fix your issue.</p>
<p>Here is a stack-overflow <a href="https://stackoverflow.com/questions/18693139/how-to-convert-csv-files-encoding-to-utf-8">link</a> to convert CSV from non utf8 to utf8 encoding.</p> | python|pandas|pyspark | 1 |
370,824 | 64,358,136 | Why the predictions are very off (which causes very large losses)? | <p>I have this very simple resnet18 network that I am trying to train from scratch for task of landmark estimation (I have 4 landmarks):</p>
<pre><code>num_classes = 4 * 2 #4 coordinates X and Y flattened --> 4 of 2D keypoints or landmarks
class Network(nn.Module):
def __init__(self,num_classes=8):
supe... | <p>I think there is a problem with the way you are using <code>DataLoader</code>. <code>iter(train_loader)</code> creates an iterator out of the data loader and calling <code>next</code> should give you the next example from dataset. But you are calling <code>next(iter(train_loader))</code> in each iteration which crea... | python|deep-learning|pytorch|prediction|loss-function | 0 |
370,825 | 64,236,286 | Most pythonic way to index each tuple contained within a list | <p>Sort of a Python beginner, sorry if this is a basic question.</p>
<p>I have tuples of the form (i, j) contained inside a list of variable length. This list is output by a function that is selecting clusters of pixels inside an image and averaging their RGB values, so the tuples are indices. The function is recursive... | <p>It's easy enough to avoid the iteration on the RGB dimension. We still have to iterate on pixel indexing tuples:</p>
<pre><code>In [10]: atup = ((150,40,40), [(35,35), (95,42)], 2)
In [11]: newimg = np.zeros((1200,600,3),int)
In [12]: vals = atup[0]
In [13]: idx = atup[1]
In [14]: for x in idx:
...: newimg[... | python|arrays|numpy|tuples | 0 |
370,826 | 64,413,924 | plt.show() does not display anything | <p>I am using Jupyter notebook and I'm trying to plot graphs using subplots based on this <a href="https://www.youtube.com/watch?v=QAkOnV1-lIg&list=PLQVvvaa0QuDcOdF96TBtRtuQksErCEBYZ&index=3&ab_channel=sentdex" rel="nofollow noreferrer">video</a>:</p>
<p>I just tried everything in the same format as shown i... | <p>That's not an error. Use show() in the next line or plt.show()</p> | python|pandas|matplotlib | 0 |
370,827 | 64,572,243 | Pandas: Replace list value to a string of values from another dataframe | <p>I did my best to try to find any answer here or google without success.</p>
<p>I'm trying to replace a list of IDs inside of a cell with a <code>", ".join</code> of values from another Dataframe which contains the "Id" and "name" of the element.</p>
<pre><code>| id | setting | queues... | <p>First if possible some non list values repalce them to empty lists and then convert second DataFrame to dictionary and lookup in dict with filtration by <code>if</code>:</p>
<pre><code>merged["queues"] = merged["queues"].apply(lambda x: x if isinstance(x, list) else [])
d = df2.set_index('id')['... | python|pandas | 1 |
370,828 | 64,373,719 | Python Seaborn Lineplot | <p>I am new to Python and have a question regarding a lineplot.</p>
<p>I have a data set which I would like to display as a Seaborn lineplot.
In this dataset I have 3 categories which should be on the Y axis. I have no data for an X axis, but I want to use the index.</p>
<p>Unfortunately I did not get it right. I woul... | <p>First melt your columns and then use hue parameter to plot each line:</p>
<pre><code>fig, ax = pyplot.subplots(figsize=(10, 10))
ax =seaborn.lineplot(
data= df.melt(id_vars='index').rename(columns=str.title),
x= 'index',
y= 'value',
hue='varaible'
)
</code></pre> | python|pandas|seaborn | 2 |
370,829 | 64,200,629 | Filtering pandas dataframe column of numpy arrays by nan values | <p>I have a pandas DataFrame</p>
<pre><code> ID Unique_Countries
0 123 [Japan]
1 124 [nan]
2 125 [US,Brazil]
.
.
.
</code></pre>
<p>I got the Unique_Countries column by aggregating over unique countries from each ID group. There were many IDs with only 'NaN' values in the original country colum... | <p>If your cell has <code>NaN</code> not in 1st position, try use <code>explode</code> and <code>groupby.all</code></p>
<pre><code>df[df.Unique_Countries.explode().notna().groupby(level=0).all()]
</code></pre>
<p>OR</p>
<pre><code>df[df.Unique_Countries.explode().notna().all(level=0)]
</code></pre>
<hr />
<p>Let's try<... | python|pandas|numpy | 2 |
370,830 | 64,432,851 | Find max number of consecutive days | <p>The code below groups the dataframe by a key.</p>
<pre><code> df = pd.DataFrame(data, columns=['id', 'date', 'cnt'])
df['date']= pd.to_datetime(df['date'])
for c_id, group in df.groupby('id'):
print(c_id)
print(group)
</code></pre>
<p>This produces a result like this:</p>
<pre><code> id d... | <p>Use:</p>
<pre><code>m = (df.assign(date=pd.to_datetime(df['date'])) #if necessary convert else drop
.groupby('id')['date']
.diff()
.gt(pd.Timedelta('1D'))
.cumsum())
df.groupby(['id', m]).size().max(level='id')
</code></pre>
<p><strong>Output</strong></p>
<pre><code>id
1 6
2 7
3 ... | python|pandas|dataframe | 1 |
370,831 | 64,194,776 | How to shorten a float result in python | <p>Below is a (1,3) array that represents the world coordinates of detected car's Centroid:</p>
<pre><code>World_Point=[[3.27996023 0.29204794 1. ]]
</code></pre>
<p>How can I turn the float numbers into the format shown below?</p>
<pre><code>World_Point=[[3.27 0.29 1]]
</code></pre> | <p>What you need is the <code>round(number, ndigits)</code> function.</p> | python|arrays|numpy|opencv | 2 |
370,832 | 64,296,681 | CNN model accuracy maxing out at 99%, then dropping to 50% epochs later | <p>I'm creating a CNN that can classify CT scans as positive for COVID-19 induced pnemonia and negative for healthy CT. I tested my model for 50 epochs; from epoch 1 - 10, it incrementally increases and maxes out at 99% accuracy at epoch 10. However, a couple epochs later, it drops tremendously to 44%, which is awful f... | <p>You can do as suggested about early stopping or training for less epochs if you wish, I notice you are monitoring "accuracy" in your callbacks. It is usually best to monitor the validation loss and save the model with the lowest loss. Validation loss is an indication of how well your model generalizes to u... | tensorflow|machine-learning|keras|neural-network|conv-neural-network | 1 |
370,833 | 64,322,267 | How to start with the minimum value in a list in python? | <p>I want to get the minimum price first in a list... this is my code</p>
<pre><code>for link in productlinks:
try:
r = requests.get(link, headers=headers)
soup = BeautifulSoup(r.content, 'lxml')
name = soup.find(
'h1', class_='product-main__name').text.strip()
price = so... | <p>I assume you are using Pandas, as you have a "pd.Dataframe" in your code.
A Pandas DataFrame can be sorted by</p>
<pre><code>df = df.sort_values(by='price')
</code></pre>
<p>Another more general way (not involving pandas) would to generate a list if the indices your items should to be sorted. With this ind... | python|pandas|minimum | 0 |
370,834 | 64,483,038 | AttributeError: module 'cv2.cv2' has no attribute 'DataFrame' | <p>So after having a lot of trouble with importing cv2 , I now have this error showing up:</p>
<pre><code>Traceback (most recent call last):
File "/home/test/Projet/IDO/ido-security-cam/code.py", line 19, in <module>
dataFrame = cv2.DataFrame(columns = ["start","end"])
Attribut... | <p>I did trust a code that was previously working that's why I didn't see this error.</p>
<p><em>Dataframe</em> is a function part of the pandas module, so of course it won't work using <em>cv2</em>. To make it works, you need to use <em>pandas.DataFrame()</em></p>
<p>Thanks again !</p> | python|pandas|opencv|visual-studio-code|opencv-python | 0 |
370,835 | 47,653,918 | Tensorflow batch_join's allow_smaller_final_batch doesn't work? | <p>I am using the tenosrlfow queue to process my data, and I need to get the final batch whose size is smaller than the batch size, but I can only get 5 batch size, the final batch cann't be got. I don't understand what's the problem about that.</p>
<pre><code>data = np.arange(105)
data_placeholder = tf.placeholder(d... | <p>I haven't checked your entire code but if I am getting it right you want to get all samples even if the last batch is smaller than the rest, right?</p>
<p>Well using this toy example with 8 samples and using batch of 3:</p>
<pre><code>import tensorflow as tf
import numpy as np
num_samples = 8
batch_size = 3
capac... | python|tensorflow | 1 |
370,836 | 47,799,305 | Python, finding error in near symmetric matrix created by df.pivot | <p>I have a 16,000x 16,000 symmetric matrix which I am attempting to perform a multi dimensional scaling analysis on using sklearn. I need to use my own matrix because I have created a unique dissimilarity calculation. The calculations were performed before using df.pivot and all calculations were performed using np.fl... | <p>For debugging purposes you are probably interested in knowing if those errors are small or not. You might use the following demo, which:</p>
<ul>
<li>creates some erroneous sym-matrix</li>
<li>checks symmetry using the same function used in your code (internally)</li>
<li>prints out the max-error in absolute terms<... | python|pandas|matrix|scikit-learn | 1 |
370,837 | 47,555,375 | Fill new column in one dataframe with values from another, based on values in two other columns? (Python/Pandas) | <p>I need to add a column to a dataframe and fill it with values from another dataframe, but I do not have a unique ID or key or index that is shared between them. They do have two identifiers in common that make each row unique between them, and I want to try and match on both those columns.</p>
<p>Here is an example... | <p>Use <a href="http://pandas.pydata.org/pandas-docs/stable/generated/pandas.merge.html" rel="nofollow noreferrer"><code>merge</code></a> with left join and if some values not match get <code>NaN</code>s, which are replaced by <a href="http://pandas.pydata.org/pandas-docs/stable/generated/pandas.Series.fillna.html" rel... | python|pandas|dataframe|multiple-columns | 2 |
370,838 | 47,802,840 | pandas count unique in each row | <p>Df with 2 columns </p>
<p>df:</p>
<pre><code>fruit location
apples store,freezer,kitchen,livingroom,store,freezer,kitchen,livingroom
mango store,freezer,kitchen,livingroom,store,freezer
orange store,freezer,kitchen,freezer
</code></pre>
<p>I need to count the number of each location, incase there are multip... | <p>Using <code>apply</code> + <code>set</code> + <code>len</code> </p>
<pre><code>df.location.str.split(',').apply(lambda x : len(set(x)))
Out[147]:
0 4
1 4
2 4
Name: location, dtype: int64
</code></pre> | python-2.7|pandas | 2 |
370,839 | 47,822,994 | Matrix created from a function, and concatenated column vector of the matrix | <p>We have a function f(x,y). We want to calculate the matrix Bij = f(xi,xj) = f(ih,jh) for 1 <= i,j <= n and h=1/(n+1), such as :</p>
<p><a href="https://i.stack.imgur.com/CVf5I.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/CVf5I.png" alt="enter image description here"></a></p>
<p>If f(x,y... | <p>The <code>ravel</code> function along with a new axis should do the trick:</p>
<pre><code>import numpy as np
x = np.array([[0.5, 0.75, 1],
[0.75, 1, 1.25],
[1, 1.25, 1.5]])
x.T.ravel()[:, np.newaxis]
# array([[ 0.5 ],
# [ 0.75],
# [ 1. ],
# [ 0.75],
# [ 1. ]... | python|numpy|math | 1 |
370,840 | 47,580,287 | How do I use Tensorflow's Estimator API to do distributed training? | <p>The <a href="https://www.tensorflow.org/programmers_guide/estimators" rel="nofollow noreferrer">documentation</a> says:</p>
<blockquote>
<p>You can run Estimators-based models on a local host or on a
distributed multi-server environment without changing your model.
Furthermore, you can run Estimators-based mo... | <p>Tensorflow documentation for tf.estimator.train_and_evaluate <a href="https://www.tensorflow.org/api_docs/python/tf/estimator/train_and_evaluate" rel="nofollow noreferrer">here</a> explains one method for running <code>tf.estimator</code> in a distributed environment, which simply requires setting the <code>TF_CONFI... | python|tensorflow | 3 |
370,841 | 47,701,742 | Summary for the a specific branch | <p>I have a tensorflow graph that has a complicated loss function for the training, but a simpler one for evaluation (they share ancestors). Essentially this</p>
<pre><code>train_op = ... (needs more things in feed_dict etc.)
acc = .... (just needs one value for placeholer)
</code></pre>
<p>to better understand what'... | <p>As far as I understand your question, to summary a specific tensorflow operation, you should run it specifically. </p>
<p>For example: </p>
<pre><code># define accuracy ops
correct_prediction = tf.equal(tf.argmax(Y, axis=1), tf.argmax(Y_labels, axis=1))
accuracy = tf.reduce_mean(tf.cast(correct_prediction, dty... | tensorflow|tensorboard | 1 |
370,842 | 47,903,414 | Adding Specific Team Score in pandas | <pre><code>import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import style
style.use("fivethirtyeight")
df_2010=pd.read_csv("c:/users/ashub/downloads/documents/MLB 2010.csv",index_col=0)
df_new=df_2010[["Home Score","Away Score","Home Team","Away Team","Home Hits","Away Hits","Home ... | <p>This would be one approach I think ? </p>
<pre><code>import pandas as pd
games = pd.DataFrame(data = {"home" : ["A", "B", "A", "A", "B"],
"away" : ["B", "C", "C", "B", "A"],
"homescore" : [0, 1, 4, 3, 0],
"awayscore" : [1, 2, 2,... | python|python-3.x|pandas | 2 |
370,843 | 47,777,990 | Column names when raise a typeerror in pandas dataframe | <p>I'm comparing 2 dataframes by their row names and I want to get the name of the rows that don't match example:</p>
<pre><code>check = sum(df1.index!=df2.index)
if check:
raise TypeError("Not Match")
else:
print("All OK")
</code></pre>
<p>When the index don't match I want to print the first instance of th... | <p>The statement - </p>
<pre><code>df1.index != df2.index
</code></pre>
<p>Returns a numpy array of <code>bools</code>. Let's retain this for now. It may need a slight change to work - </p>
<pre><code>m = df1.index.values != df2.index.values
</code></pre>
<p>To get the counts of <code>True</code> (non-matches) in <... | python|pandas|jupyter-notebook | 2 |
370,844 | 47,714,891 | Error when installing pandas with pip macos | <p>I'm getting an error when I try to install pandas on mac terminal from pip</p>
<pre><code>pip install pandas
</code></pre>
<p>I've tried many solutions but it didn't work, I've also tried to re-install python and pip.</p>
<pre><code>-->Installing collected packages: numpy, pandas
Found existing installatio... | <p>Here's an answer that I'm sure some people will disagree with... try adding a sudo so you have root privs.</p>
<pre><code>sudo pip install pandas
</code></pre> | python|macos|pandas|terminal|pip | -2 |
370,845 | 47,671,720 | Pandas rolling mean and selective indexing by time | <p>I've a dataset where I've reindexed it with respect to dates (datetime.datetime). A small sample of the dataframe looks like this, df2: </p>
<pre><code> lat lon Press NetLW
rounded_dt 1997-11-30 17:00:00 76.15387 -147.62606 998.8 -51.0
1997-11-30 18... | <p>Boolean indexing in a dataframe will generally require you to use the <code>.loc</code> indexer. But what is happening here is that there is only a single index as you are looping. Freely translated: <code>df3_clear = df3[True or False]</code>. I am afraid you do not have a row in your index called <code>True</code>... | python|pandas | 1 |
370,846 | 47,677,042 | Applying multiple functions (Mean., STD etc ) across columns in Python | <p>I have this data of 4 columns and 8 rows...</p>
<pre><code>df = pd.DataFrame([[1, 2, 3,7], [2, 8, 6,8],[3, 2, 3,7], [4, 4, 6,8],[5, 2, 3,7], [6, 1, 6,8],[7, 8, 3,7], [8, 9, 6,8]], columns=['time','A', 'B', 'C'])
time A B C
0 1 2 3 7
1 2 8 6 8
2 3 2 3 7
3 4 4 6 ... | <p>Another way:</p>
<pre><code>In [346]: df[['A','C']].T.agg(['mean','std']).T
Out[346]:
mean std
0 4.5 3.535534
1 8.0 0.000000
2 4.5 3.535534
3 6.0 2.828427
4 4.5 3.535534
5 4.5 4.949747
6 7.5 0.707107
7 8.5 0.707107
</code></pre>
<p>or as a new columns in the original DF:</p>
<pre>... | python|pandas | 4 |
370,847 | 47,551,753 | How can i increase the distance between specific xticks in pandas python | <p>I have a timeline with years, and eventually have a forecasted amount which includes year 2050 and 2100. Currently when i plot it, it will come out as such:<a href="https://i.stack.imgur.com/IfBM0.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/IfBM0.png" alt="enter image description here"></a></p... | <p>So, from the matplotlib function xticks, matplotlib.pyplot.xticks(..)
You have:</p>
<blockquote>
<p># set the locations and labels of the xticks xticks( arange(5),
('Tom', 'Dick', 'Harry', 'Sally', 'Sue') )</p>
</blockquote>
<p>So if you want it on exact scale, you can just setup X twice, else, if you want ... | python|pandas|plot | 0 |
370,848 | 47,757,437 | Time series data: bin data to each day, then plot by day of week | <p>I have a very simple pandas DataFrame with the following format:</p>
<pre><code>date P1 P2 day
2015-01-01 190 1132 Thursday
2015-01-01 225 1765 Thursday
2015-01-01 3427 29421 Thursday
2015-01-01 945 7679 Thursday
2015-01-01 1228 9537 Thursday
2015-01-01 870 ... | <p>Seems like you're looking for:</p>
<pre><code>df[['day', 'P1']].groupby('day').mean().plot(kind='bar', legend=None)
</code></pre>
<p>and</p>
<pre><code>df[['day', 'P2']].groupby('day').mean().plot(kind='bar', legend=None)
</code></pre>
<p>Full example:</p>
<pre><code>import numpy as np
import pandas as pd
days... | python|pandas|matplotlib | 6 |
370,849 | 47,770,096 | Batch tf.matmul of tensors with different ranks | <p>Given a Tensor of shape <code>(A, B, C, D, E)</code> and a tensor of shape <code>(A, B, E)</code>, I would like to do a batch multiplication with automatic broadcasting of the second tensor, such that:</p>
<pre><code> In [1]: X = tf.placeholder(dtype=tf.float32, shape=[A, B, C, D, E])
In [2]: Y = tf.placehol... | <p>Broadcasting is mostly supported for those operations which makes use of element-wise computation. <code>tf.matmul</code> is not element-wise operation but <code>tf.multiply</code> is element-wise based.</p>
<p>Also, Tensorflow may or may not do automatic broadcasting for higher order tensors even in those operatio... | python|tensorflow|linear-algebra | -1 |
370,850 | 47,909,152 | Cannot convert object type to string; and then filter on that string; python pandas dataframe | <p>I am trying to pull all stock tickers from NYSE, and then filter out for only those with MarketCap above 5B. </p>
<p>I am running into a problem because based on how my data load comes in all columns are data type "Object" and I cannot find anyway to convert them to anything else. See my code and comments below:</p... | <p>Convert the <code>MarketCap</code> column into floats by first removing the dollar signs and then substituting <code>B</code> with <code>e9</code> and <code>M</code> with <code>e6</code>. This should make it easy to use <code>.astype(float)</code> on the column to do the conversion.</p>
<pre><code>import pandas as ... | python|pandas | 2 |
370,851 | 47,752,258 | What is the relationship among batch-size, sequence-length and hidden_size? | <p>When reading the API document of dynamic_rnn, I have the following question:</p>
<p>Are there constraints on the relationship among batch-size, sequence-length and (cell)hidden_size?</p>
<p>I am thinking that:</p>
<p>sequence-length <= (cell)hidden_size, or,</p>
<p>batch-size * sequence-length <= (cell)hid... | <p>There is no relationship as far as the API is concerned. Fix any two of these parameters and the remaining can still be any non-negative integer (or, in the case of <code>sequence_length</code>, any <code>batch_size</code>-length vector of non-negative integers).</p>
<p>The resulting model may overfit very easily i... | dynamic|tensorflow|rnn | 0 |
370,852 | 47,864,691 | Pandas group by weekday (M/T/W/T/F/S/S) | <p>I have a pandas dataframe containing a time series (as index) of the form YYYY-MM-DD ('arrival_date') and I'd like to group by each of the weekdays (Monday to Sunday) in order to calculate for the other columns the mean, median, std etc. I should have in the end only seven rows and so far I've only found out how to ... | <p>I believe you need first parameter <code>parse_dates</code> in <a href="http://pandas.pydata.org/pandas-docs/stable/generated/pandas.read_csv.html" rel="noreferrer"><code>read_csv</code></a> for parse column to datetime and then <a href="http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.groupby.... | python|pandas|pandas-groupby | 27 |
370,853 | 47,591,432 | Pandas, replace rows by mean over given columns | <p>I'm pretty new to Pandas and unfortunately at the moment I don't have much time to dig into it as I would like.</p>
<p>I have a dataframe like this:</p>
<pre><code> x y z class id other-numeric-field
0 8 8 5 1 1014f 0.388640
1 2 3 4 0 3ba1d 0.431008
2 5 1 6 ... | <p>Is that what you want?</p>
<pre><code>In [18]: df[['x','y','z']] = df.groupby('class')[['x','y','z']].transform('mean')
In [19]: df
Out[19]:
x y z class id other-numeric-field
0 6.666667 6 5.666667 1 1014f 0.388640
1 4.000000 6 2.500000 0 3ba1d 0.4... | python|pandas|numpy | 5 |
370,854 | 47,813,715 | pytorch loss value not change | <p>I wrote a module based on this article: <a href="http://www.wildml.com/2015/12/implementing-a-cnn-for-text-classification-in-tensorflow/" rel="nofollow noreferrer">http://www.wildml.com/2015/12/implementing-a-cnn-for-text-classification-in-tensorflow/</a></p>
<p>The idea is pass the input into multiple streams then... | <p>I have seen that in your original code, <code>weight_decay</code> term is set to be <code>0.1</code>. <code>weight_decay</code> is used to regularize the network's parameters. This term maybe too strong so that the regularization is too much. Try to reduce the value of <code>weight_decay</code>.</p>
<p>For convolut... | python|deep-learning|pytorch | 2 |
370,855 | 47,610,845 | Converting grouped stacked columns into multiple columns by grouping in Pandas | <p>I've organized my dataframe to look something like this using the groupby function:</p>
<pre><code>Compound Sample Concentration x y
Benzene A 15 Ax Ay
B 20 Bx By
C 17 Cx Cy
Toluene A 23 Ax Ay
... | <p>Based on your posting, it's not really clear which of your columns are in the index. If none of them are (which you can force with df.reset_index()), then you can do the following:</p>
<pre><code>df.set_index(['Compound', 'Sample', 'x', 'y'], inplace = True)
df = df['Concentration']
df = df.unstack(level = 0)
df.re... | pandas|grouping | 0 |
370,856 | 47,555,067 | Computing set difference in tensorflow between two bidimensional arrays | <p>How do I compute the set difference of elements of two arrays in tensorflow?</p>
<p>Example: I want to subtract all elements of <code>b</code> from <code>a</code>:</p>
<pre><code>import numpy as np
a = np.array([[1, 0, 1], [2, 0, 1], [3, 0, 1], [0, 0, 0]])
b = np.array([[1, 0, 1], [2, 0, 1]])
</code></pre>
<p>Ex... | <p>What about this solution:</p>
<pre><code>import tensorflow as tf
def diff(tens_x, tens_y):
with tf.get_default_graph().as_default():
i=tf.constant(0)
score_list = tf.constant(dtype=tf.int32, value=[])
def cond(score_list, i):
return tf.less(i, tf.shape(tens_y)[0])
def body(sco... | python|tensorflow | 0 |
370,857 | 47,598,343 | Merge two columns in the same pandas dataframe | <p>I have a dataframe with multiple pairs of columns that have to be merged. The columns contain mutually exclusive data. That is, if there is a value in Column A, the value for that row in Column B will be empty. </p>
<pre><code>df = pd.DataFrame({'key': ['K0', 'K1', 'K2', 'K3'],
'A': ['A0', '', 'A2', ... | <p>Here is a solution using zip to match every two columns</p>
<pre><code>li = zip(df.columns[0::2],df.columns[1::2])
#[('A', 'B'), ('C', 'D')]
# I assume columns are pairs and end up with lenght as odd number with additional column.
# If you want to ignore last column manually you can use
# li = zip(df.columns[0:-1... | python|pandas|dataframe|merge | 5 |
370,858 | 47,766,440 | Link error trying to compile XLA AOT for Tensorflow | <p>I'm trying to follow <a href="https://www.tensorflow.org/performance/xla/tfcompile" rel="nofollow noreferrer">this tutorial</a> to build an XLA AOT example (with things taken from <a href="https://github.com/tensorflow/tensorflow/issues/13482#issuecomment-335702425" rel="nofollow noreferrer">this</a>). I've been abl... | <p>To fix the link errors I had to use <code>tf_cc_binary</code> instead of <code>cc_binary</code> in <code>BUILD</code> (according to <a href="https://github.com/tensorflow/tensorflow/issues/13267#issuecomment-331681973" rel="nofollow noreferrer">this</a>). I also had to add the line</p>
<pre><code>load("//tensorflow... | python|bazel|tensorflow|tensorflow-xla | 2 |
370,859 | 47,586,614 | How to read a specific line number in a csv with pandas | <p>I have a huge dataset and I am trying to read it line by line.
For now, I am reading the dataset using pandas:</p>
<pre><code>df = pd.read_csv("mydata.csv", sep =',', nrows = 1)
</code></pre>
<p>This function allows me to read only the first line, but how can I read the second, the third one and so on?
(I would li... | <p>One way could be to read part by part of your file and store each part, for example:</p>
<pre><code>df1 = pd.read_csv("mydata.csv", nrows=10000)
</code></pre>
<p>Here you will skip the first 10000 rows that you already read and stored in df1, and store the next 10000 rows in df2.</p>
<pre><code>df2 = pd.read_csv(... | python|pandas|csv|dataframe | 17 |
370,860 | 47,553,103 | Pytorch: Can’t load images using ImageFolder | <p>I’m trying to load images using “ImageFolder”.</p>
<pre><code>data_dir = './train_dog' # directory structure is
train_dog/image
dset = datasets.ImageFolder(data_dir, transform)
train_loader = torch.utils.data.DataLoader(dset, batch_size=128, shuffle=True)
</code></pre>
<p>However, it seems not working... | <p>You should try this: </p>
<pre><code>print len(dset)
</code></pre>
<p>which represents the size of the dataset, aka the number of image files.</p>
<p><code>dset[0]</code> means the (shuffled) first index of the dataset, where <code>dset[0][0]</code> contains the input image tensor and <code>dset[0][1]</code> cont... | python|machine-learning|deep-learning|pytorch | 2 |
370,861 | 47,823,611 | Azure "Percentage CPU" metric on a VM | <p>What exactly is it measuring?</p>
<p>I have an Debian VM in Azure with <strong>16 vCPUs</strong>. I am using it to run tensorflow. The metric "<strong>Percentage CPU</strong>" on Azure Portal shows 33.5% average. My concern is that I might not fully utilize all the 16 vCPUs.</p>
<p>What really puzzles me is that t... | <p>Per Azure support team, Azure basic metric "Percentage CPU" shows how much of the physical node the Guest OS (running your program) is actually using. So 33% means it is actually using around 5 vCPUs fully. Note that the extended metric "CPU Percentage Guest OS" shows what the Guest OS thinks is being used when th... | multithreading|azure|tensorflow|cpu-usage|azure-virtual-machine | 2 |
370,862 | 47,855,556 | for loop in pandas to search dataframe and update list stuck | <p>I want to count areas of interest in my dataframe column 'which_AOI' (ranging from 0 -9). I would like to have a new column with the results added to a dataframe depending on a variable 'marker' (ranging from 0 - x) which tells me when one 'picture' is done and the next begins (one marker can go on for a variable le... | <p>Not 100% clear based on your question but it sounds like you want to count the number of rows for each which_AOI value in each marker.</p>
<p>You can accomplish this using <code>groupby</code></p>
<pre><code>df_aoi = df.groupby(['marker','which_AOI']).size().unstack('which_AOI',fill_value=0)
</code></pre>
<p>In:<... | list|pandas|for-loop|marker | 0 |
370,863 | 47,848,534 | numpy array element doesn't change its value when assigned a value to it | <p>I'm pulling my hair about this. I'm trying to change the elements of a numpy array to no avail:</p>
<pre><code>import numpy as np
c = np.empty((1), dtype='i4, S, S, S, S, S, S, S, S, S')
print(c)
c[0][1]="hello"
c[0][2]='hello'
c[0][3]=b'hello'
print(c)
</code></pre>
<p>Output:</p>
<pre><code>[(0, b'', b'', b'', ... | <p>Strings are fixed length in numpy. What doesn't fit is simply discarded:</p>
<pre><code>np.array('hello', dtype='S4')
# array(b'hell', dtype='|S4')
</code></pre>
<p><code>dtype('S')</code> appears to be equivalent to <code>dtype('S0')</code>:</p>
<pre><code>np.dtype('S').itemsize
# 0
</code></pre>
<p>so assignin... | python|arrays|numpy | 2 |
370,864 | 47,696,009 | pandas CategoricalDtype: __new__() takes 1 positional argument but 2 were given | <p>I'm reading the pandas documentation, and by following the first example on <a href="https://pandas.pydata.org/pandas-docs/stable/advanced.html#categoricalindex" rel="nofollow noreferrer">CategoricalIndex - MultiIndex / Advanced Indexing</a> I've got an error that seems to come from the <code>CategoricalDtype</code>... | <p>This will work properly in Pandas 0.21+.</p>
<p>For older versions we can do either:</p>
<pre><code>In [201]: df['B'].astype('category')
Out[201]:
0 a
1 a
2 b
3 b
4 c
5 a
Name: B, dtype: category
Categories (3, object): [a, b, c]
</code></pre>
<p>or:</p>
<pre><code>In [202]: pd.Categorical(df['... | python|pandas | 1 |
370,865 | 47,738,165 | Need to group sequence of letters while keeping the order in pandas or/and python | <p>I have a dataframe :</p>
<pre><code>row1 col1 col2
1 U 1
2 U 1
3 U 1
4 D 1
5 D 1
6 U 1
7 U 1
When I did groupby sum I got :
col1 col2
1 U 5
2 D 2
But what I want is :
col1 col2
1 U 3
2 D 2
3 U 2
</code></pre>
... | <p>Groupby by checking if first row is not equal to second rows. i.e </p>
<pre><code>df = pd.DataFrame({'col1':['U','U','D','U','U'],'col2':[3,1,2,1,1]})
mask = df['col1'].ne(df['col1'].shift()).cumsum()
ndf = df.groupby(mask).agg({'col1':'first','col2':'sum'})
col1 col2
col1
1 U 4
2 ... | python|pandas|pandas-groupby|pandasql | 0 |
370,866 | 47,644,396 | Pandas Pivot Table- aggfunc to get subtotals on a multi-Index? | <p>I have a simple dataframe with an index I need to group on- continent:</p>
<pre><code> country continent value1 value2 value3
uk eu 1 9 2
us na 8 39 0
spain eu 3 9 0
mexico na 2 ... | <p>There is no quick one-liner for what you are trying to do. You can create a new data frame by grouping on the continents, append the original data frame, and sort the values to get the order you want.</p>
<pre><code>import pandas as pd
df = pd.DataFrame(
{'continent': ['eu', 'na', 'eu', 'na', 'asia', 'asia'],... | python|pandas|pivot | 1 |
370,867 | 47,986,121 | Week number of the month | <p>Does pandas (python) offer a way to easily get the current week of the month (1:4) from a date series? </p>
<pre><code>data = {'date': ['2014-05-01', '2014-05-01', '2014-05-02', '2014-05-02', '2014-05-02', '2014-05-02', '2014-05-03', '2014-05-03', '2014-05-04', '2014-05-04']}
df = pd.DataFrame(data, columns = ['dat... | <p>Problem solved:</p>
<pre><code>data = {'date_x': ['2014-05-01', '2014-05-01', '2014-05-02', '2014-05-02', '2014-05-02', '2014-05-02', '2014-05-03', '2014-05-03', '2014-05-04', '2014-05-04']}
df = pd.DataFrame(data, columns = ['date_x'])
df['date']=pd.to_datetime(df['date_x'])
df['first_day_aux']=pd.to_datetime(df[... | python|pandas|series | 1 |
370,868 | 47,838,440 | pandas data frame not recognizing index | <p>I'm pretty new to python, and am trying to read in a single row of data to a data frame, and then index it by value to get occurrence counts for each value in the row. This is my code so far:</p>
<pre><code>import pandas as pd
csv=pd.read_csv('filepath/data.csv', 'r', converters={'csv':str})
df=DataFrame(csv, colum... | <p>Pandas <code>read_csv</code> is designed for tabular data with multiple rows and columns: if your data file has only a single row of values, it is probably cleaner to read it directly using Python's <code>open()</code>. Once you have those results in a list, pandas <code>value_counts</code> method will give you the ... | python|pandas|dataframe | 1 |
370,869 | 47,972,588 | How to pass training data to a neural network | <p>I have the following Python script:</p>
<pre><code>import numpy as np
from PIL import Image
names = []
X = []
labels = []
with open('data.txt', 'r') as f:
for line in f.readlines():
tokens = line.split(' ')
names.append(tokens[0])
labels.append(int(tokens[1]))
for img in range(len(nam... | <p>Demo:</p>
<pre><code>from glob import glob
import cv2
In [284]: names = glob(r'D:\temp\photo\*.jpg')
In [285]: names
Out[285]:
['D:\\temp\\photo\\20081116-IMG_0900.jpg',
'D:\\temp\\photo\\20081116-IMG_0902.jpg']
In [286]: X = np.array([cv2.imread(f) for f in names])
In [287]: X.shape
Out[287]: (2, 2112, 2816, ... | python|numpy | 0 |
370,870 | 47,814,829 | A real time Spectrum analyser with pyaudio in python on Raspi | <p>I am trying to get an fft plot on realtime audio using a USB microphone plugged into my raspi. I want to be able to activate an LED when a certain frequency is detected through the fft plot. I have so far tried to get just a live sound wave to be plotted but I am having trouble. I have followed this video: <a href="... | <p>To display add:<br>
<code>plt.show(block=False)</code><br>
after<br>
<code>ax.set_xlim(0, CHUNK)</code></p>
<p>But with rpi you have to configure your usb sound card as default card</p> | numpy|matplotlib|raspberry-pi|pyaudio | 0 |
370,871 | 49,223,057 | AttributeError: module 'networkx' has no attribute 'from_pandas_dataframe' | <p>I have <code>networkx v. 2.1</code>. to make it work w/ pandas dataframe, i tried following:</p>
<ul>
<li>installed via <code>pip3</code>, this did not work generated <code>Atrribute Error</code> as in title, hence uninstalled. </li>
<li>re-installed with '<code>python3 setup.py install</code>" </li>
</ul>
<p>Erro... | <p>In networkx 2.0 <code>from_pandas_dataframe</code> <a href="https://networkx.github.io/documentation/stable/release/release_2.0.html" rel="noreferrer">has been removed</a>.</p>
<p>Instead you can use <a href="https://networkx.github.io/documentation/stable/reference/generated/networkx.convert_matrix.from_pandas_edg... | pandas|networkx | 78 |
370,872 | 49,160,328 | Create a counter based on another field | <p>I want to create the following table.</p>
<p>Desired Table</p>
<pre><code>ID Coverage Count
1 A 1
1 A 2
1 A 3
1 B 1
2 C 1
2 A 1
2 A 2
2 C 2
</code></pre>
<p>I currently have just <code>ID</code> a... | <p>You need <code>cumcount</code> here </p>
<pre><code>df['Newcount']=df.groupby(['ID','Coverage']).cumcount()+1
df
Out[588]:
ID Coverage Count Newcount
0 1 A 1 1
1 1 A 2 2
2 1 A 3 3
3 1 B 1 1
4 2 C 1 1
... | python|pandas|numpy | 2 |
370,873 | 48,917,414 | Different behavior between the normal python list and the numpy array object | <p>Straight to the point. The next statements have the effect of swapping the contents of the two list elements of the python 2D-list:</p>
<pre><code>a = [[1,2,3],
[4,5,6]]
b = [[7,8,9],
[10,11,12]]
tmp = a[1]
a[1] = b[1]
b[1] = tmp
</code></pre>
<p>output:</p>
<pre><code>a = [[1,2,3],
[10,11,12]]
b... | <p>The list of lists are nested objects. The NumPy array is not nested but 2D. There is no notion of 2D with lists. So you have a list in a list. Whereas in NumPy it is just one object. </p>
<p>NumPy always returns a view when indexing and the result of indexing is another array. You need to make explicit copies:</p>
... | python|python-3.x|numpy | 3 |
370,874 | 48,933,119 | how to get top 2 dates from series | <p>I am new to pandas and I am trying to find out what the top 2 dates are in a specific column. I have an excel sheet called "test" that I am connecting to using pandas. Here is the data for that column:</p>
<pre><code>date_col
1/1/2018
2/1/2018
2/1/2018
2/1/2018
1/1/2018
1/1/2018
1/1/2018
2/1/2018
2/1/2018
2/1/2... | <p>One way via built-in <code>sorted</code>:</p>
<pre><code>sorted(df['date_col'].drop_duplicates())[-2:]
# [Timestamp('2018-02-01 00:00:00'), Timestamp('2018-03-01 00:00:00')]
</code></pre> | python|pandas|date | 0 |
370,875 | 49,216,569 | Assigning beautifulsoup indexed values (html links and text) to a panda html DataFrame | <p>The following code retrieves images and html links from a webpage and stores the values in a beautiful soup index. I am now using pandas in order to create an output html table for those images and links. I have managed to populate cells manually by calling on a specific index value but I can't seem to find a way ad... | <p>This is the correct way to do it.
If you need any help with storing it and making an HTML out of it I'll be happy to provide a solution for that as well. Take care!</p>
<p><strong>Update</strong>: Everything included, comments, scraping, writing to a file, creating tags with beautifulsoup.</p>
<pre><code>from bs4 ... | html|python-3.x|pandas|dataframe|beautifulsoup | 2 |
370,876 | 49,140,675 | Python Pandas Countif | <p>I like to build the counting tool. </p>
<p>I used to use the <code>COUNTIF</code> function in excel <code>=COUNTIF($L$2:$L$3850,"AAA")</code>. but, I am not sure there is similar function in python pandas.</p>
<p>This is my dataframe</p>
<pre><code># 2015 2016 2017
# 0 AAA AA AA
# 1 AA ... | <p>Using <code>cross_tab</code></p>
<pre><code>df.stack().pipe(lambda s: pd.crosstab(s, s.index.get_level_values(1)))
col_0 2015 2016 2017
row_0
A 0 1 2
AA 2 2 1
AAA 1 0 0
</code></pre>
<hr>
<p>With <code>get_dummies</code></p>
<pre><code>pd.get_dum... | python|pandas|dataframe|count | 3 |
370,877 | 49,035,200 | Keras early stopping callback error, val_loss metric not available | <p>I am training a Keras (Tensorflow backend, Python, on MacBook) and am getting an error in the early stopping callback in fit_generator function. The error is as follows:</p>
<pre><code>RuntimeWarning: Early stopping conditioned on metric `val_loss` which is not available. Available metrics are:
(self.monitor, ',... | <p>If the error only occurs when you use smaller datasets, you're very likely using datasets small enough to not have a single sample in the validation set. </p>
<p>Thus it cannot calculate a validation loss. </p> | python|tensorflow|keras | 34 |
370,878 | 49,299,761 | Binary mask for output vector in Tensorflow | <p>I want to recommend products by clickstream with LSTM in TensorFlow.</p>
<p>I have historical <strong>user behaviour data</strong> using which I want to use to train model to recommend products (represented as classes on output) but I need to consider whether product was active in that moment on webpage(not to reco... | <p>You could use <code>tf.boolean_mask</code> on the softmax prediction output to remove the probabilities for inactive deals then get the maximum probabilities without them.</p> | python|tensorflow|machine-learning|lstm|bitmask | 0 |
370,879 | 48,895,910 | Install Pytorch on Windows | <p>I am trying to install Pytorch on Windows8.1. I am using Python 3.6.4 and no GPU. I've tried already the Anaconda package provided by <code>peterjc123</code> by running <code>conda install -c peterjc123 pytorch_legacy cuda80</code> using a virtual environment. While the installation goes smooth (without errors), aft... | <p>You are installing the GPU version with the command.
Check the <a href="https://github.com/peterjc123/pytorch-scripts" rel="nofollow noreferrer">link</a> for the github repo.</p>
<p>In short, you should run something like
<code>conda install -c peterjc123 pytorch</code>.
Be sure to install the required dependencies... | python|conda|pytorch | 1 |
370,880 | 49,312,282 | TypeError: unsupported operand type(s) for +: 'dict_values' and 'dict_values' | <p>When I run <a href="https://github.com/hx173149/C3D-tensorflow" rel="nofollow noreferrer">C3D-tensorflow</a>'s
<code>train_c3d_ucf101.py</code> from Github, there is an error in line 165 shows </p>
<pre><code>unsupported operand type(s) for +: 'dict_values' and 'dict_values'
</code></pre>
<p>And the code in line ... | <p>It seems you are trying to run a Python2 librairy with Python3.</p>
<pre><code>varlist1 = list( set(weights.values() + biases.values()) - set(varlist2) )
</code></pre>
<p>The above line is correct in Python2 where <code>dict.values()</code> returns a <code>list</code>, but is not in Python3 where it returns a spec... | python|tensorflow|typeerror | 3 |
370,881 | 48,922,263 | How can i create a model in Keras and train it using Tensorflow? | <p>Is it possible to create a model with Keras and without using compile and fit functions in Keras, use Tensorflow to train the model?</p> | <p>Sure. From <a href="https://keras.io/models/model/" rel="nofollow noreferrer">Keras documentation</a>:</p>
<blockquote>
<p>Useful attributes of Model</p>
<ul>
<li><code>model.layers</code> is a flattened list of the layers comprising the model graph.</li>
<li><code>model.inputs</code> is the list of inpu... | tensorflow|neural-network|deep-learning|keras | 1 |
370,882 | 49,071,515 | matplotlib animation removing lines during update | <p>I've created a map and I am reading in a CSV of latitude and longitude coordinates into a Pandas DataFrame. I've been successful in plotting multiple great arcs using a 'for' loop after reading in the DataFrame. </p>
<p>A new great arc is drawn when a new set of coordinates is ADDED to the CSV.</p>
<p>However, I c... | <h3>Using blitting:</h3>
<p>When using blitting the lines are automatically removed.</p>
<pre><code>from mpl_toolkits.basemap import Basemap
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
import matplotlib.animation
# setup mercator map projection.
fig = plt.figure(figsize=(13, 8))
m = Basem... | python|pandas|animation|matplotlib | -1 |
370,883 | 49,052,588 | How to convert from c3d file to csv | <p>Hi i have a project were the user uploads a .c3d file to be able to display the data on charts, so i am making it for when the user uploads a the file it gets converted into a .csv file so i can get the values but i am having no luck trying to convert from the .c3d file to the .csv extension. </p>
<p>i have used th... | <p>The c3d library I suppose you use(<a href="https://pypi.python.org/pypi/c3d/0.2.1" rel="nofollow noreferrer">https://pypi.python.org/pypi/c3d/0.2.1</a>) includes a script for converting C3D data to CSV format (c3d2csv).</p> | python|csv|numpy | 1 |
370,884 | 49,217,715 | Error when training more than one step in Tensorflow: TypeError: Fetch argument None has invalid type <type 'NoneType'> | <p>I'm trying to train a model that takes as input a narrow-band waveform and wide-band waveform. I've set up the batch pipeline for the nb_audio_batch and wb_audio_batch tensors. I notice that after the first step, TensorFlow starts complaining that nb_input and wb_input are NoneTypes. However, I added some print stat... | <p>You can call <code>sess.run()</code> as many times as you want. My guess (you should provide more details) is that the error is coming from the <code>nb_input, wb_input = sess.run([nb_audio_batch, wb_audio_batch])</code> line. TensorFlow needs you to specify <code>Tensors</code> or something that can be converted to... | numpy|tensorflow|input | 1 |
370,885 | 49,269,856 | Pandas group by number (instead of time) | <p>In pd.Grouper we can group by time, for example using 10s</p>
<pre><code>Time Count
10:05:03 2
10:05:04 3
10:05:05 4
10:05:11 3
10:05:12 4
</code></pre>
<p>Will provide the result of:</p>
<pre><code>Time Count
10:05:10 9
10:05:20 7
</code></pre>
<hr>
<p>I'm looking for the other way around. Ca... | <p>Maybe this is what you have in mind. Start with a pandas Series <code>df</code>:</p>
<pre><code>2018-03-14 06:38:46.308425+00:00 2
2018-03-14 06:38:47.308425+00:00 3
2018-03-14 06:38:48.308425+00:00 4
2018-03-14 06:38:54.308425+00:00 3
2018-03-14 06:38:55.308425+00:00 4
dtype: int64
</code></pre... | python|pandas|pandas-groupby | 0 |
370,886 | 49,247,003 | pandas append rows on index with overwrite | <p>for example, two dataframes are as below</p>
<p>df1</p>
<pre><code>index a b
0 1 1
1 1 1
</code></pre>
<p>df2</p>
<pre><code>index a b
1 2 2
2 2 2
</code></pre>
<p>and I want <code>df1.append(df2)</code> with overwrite</p>
<p>so result maybe as below</p... | <p>Using <code>combine_first</code></p>
<pre><code>df1=df1.set_index('index')
df2=df2.set_index('index')
df2.combine_first(df1)
Out[279]:
a b
index
0 1.0 1.0
1 2.0 2.0
2 2.0 2.0
</code></pre> | python|pandas | 11 |
370,887 | 49,121,862 | How do I keep appending to a Numpy tuple array from flattens its structure | <p>In the code below, I am trying to keep the array elements as tuples.</p>
<pre><code>>>> a = np.int32([(1, 2), (3, 4)])
>>> a
array([[1, 2],
[3, 4]], dtype=int32)
>>> np.mean(a[:, 0], axis=0)
>>> np.mean(a[:, 1], axis=0)
</code></pre>
<p>Where things break is when I am tr... | <p>Try</p>
<pre><code>a = np.append(a, [4, 5], axis=0)
</code></pre>
<p>and take a look at <code>axis</code> param in <a href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.append.html" rel="nofollow noreferrer">docs</a></p> | python|numpy | 0 |
370,888 | 49,045,804 | Iterative array creation in matlab and python | <p>I am trying to convert a snippet of MATLAB code into python, the MATLAB code is as follows:</p>
<pre><code>M = 0;
for k=1:i
M = [M, M, M;
M, ones(3^(k-1)), M;
M, M, M];
end
</code></pre>
<p>which creates a 2d array that mimics a sierpinski carpet<br>
my python implementation is ... | <p>You can use <a href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.block.html" rel="nofollow noreferrer">block()</a> </p>
<pre><code>import numpy as np
M = 0
for k in range(count):
I = np.ones((3**k, 3**k))
M = np.block([[M, M, M],
[M, I, M],
[M, M, M]])
</co... | python|arrays|matlab|numpy|concatenation | 2 |
370,889 | 48,981,870 | Produce separate line plots with multiple legend items | <p>I have generated the following DataFrame (a small subset shown here) and wish to generate a separate line plot for each zone, with each plot having multiple legend items ('green', 'red' and 'brown' from the Cat column). The x-axis will use 'Date' and the y-axis 'Val'. </p>
<p>I am relatively new to Python/Pandas an... | <p>Use <strong>seaborn</strong>.</p>
<pre><code>import seaborn as sns
sns.factorplot(x="Date", y="Val", hue="Cat", col="Zone", data=df)
</code></pre>
<p><a href="https://i.stack.imgur.com/Au9Gw.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Au9Gw.png" alt="output plot"></a></p>
<p>Update 'to sav... | python|pandas|matplotlib | 0 |
370,890 | 49,312,914 | Pandas merge 2 csv with a similar column but different header name | <p>I want to merge 2 csv file with a similar column but different header name.</p>
<p>a.csv:</p>
<pre><code>id name country
1 Cyrus MY
2 May US
</code></pre>
<p>b.csv:</p>
<pre><code>user_id gender
1 female
2 male
</code></pre>
<p>What I need is, c.csv:</p>
<pre><code>id name country gender
1 Cyrus MY female
2 ... | <p>You could rename the <code>user_id</code> column in <code>df2</code> to <code>id</code>. Since the name is the same, it won't be duplicated.</p>
<pre><code>df2 = pd.read_csv('b.csv').rename(columns={'user_id': 'id'})
df3 = pd.merge(df1, df2, on='id', how='outer')
</code></pre>
<p>Otherwise you can drop the <code>u... | python|pandas|csv | 1 |
370,891 | 48,914,161 | How to write dataframe to csv, while updating and dropping duplicates in csv? | <p>I can successfully drop duplicates and update rows in an existing dataframe. When I write this dataframe too a csv that already has data in it, how do I do the same commands in the dataframe to the csv to drop duplicates and update rows. </p>
<pre><code>df:
ID email date
0 a@a.com 2018-01-22
1 ... | <p>Here is one way.</p>
<pre><code># filename containing data
filename = 'file.csv'
# drop duplicates from existing dataframe
permanent = permanent.sort_values('ID')\
.drop_duplicates('ID', keep='last')
# read file into dataframe
df = pd.read_csv(filename)
# concatenate the above dataframes and... | python|pandas|csv|dataframe | 0 |
370,892 | 49,011,681 | I'm trying to create a sorting algorithm to find all combinations that would yield a certain result, but keep getting an error about the index | <p>the data is a numpy array (784,)</p>
<p>here is the sorting function:</p>
<pre><code>while flips < max_flip:
flipped_accuracy = 0
combination = []
while flipped_accuracy <= original_accuracy:
i_vals = []
for i in range(flips):
i_vals.append(i)
index = 1
... | <p>The following code seems to be the likely culprit:</p>
<pre><code>if i_vals[-index] < 784:
# ...
i_vals[-index] += 1
</code></pre>
<p>If <code>i_vals[-index]</code> is <code>783</code> it will be increased to <code>784</code>, so the next time that value is used as the index it will cause the error.</p> | python|sorting|numpy | 0 |
370,893 | 48,979,023 | Using Python Tensor of TensorFlow in Java | <p>I have a Tensorflow program running in Python, and for some convenience reasons I want to run the same program on Java, so I have to save my model and load it in my Java application.</p>
<p>My problem is that a don't know how to save a Tensor object, here is my code : </p>
<pre><code>class Main:
def __init__(self,... | <p>Python <a href="https://www.tensorflow.org/api_docs/python/tf/Tensor" rel="nofollow noreferrer"><code>Tensor</code></a> objects are symbolic references to a specific output of an operation in the graph.</p>
<p>An operation in a graph can be uniquely identified by its string name. A specific output of that operation... | java|python|tensorflow | 2 |
370,894 | 49,049,852 | Numpy string array pad with string | <p>I have created a 2d Numpy string array like so:</p>
<pre><code>a = np.full((2, 3), '#', dtype=np.unicode)
print(a)
</code></pre>
<p>The output is: </p>
<pre><code>array([['#', '#', '#'], ['#', '#', '#']], dtype=`'<U1'`)
</code></pre>
<p>I would like to pad it with '?' on all sides with a width of 1. I'm ex... | <p>You can't pad your array with string literals. Instead as it's mentioned <a href="https://numpy.org/doc/stable/reference/generated/numpy.pad.html" rel="nofollow noreferrer">in documentation</a> you can use a <code>pad_with</code> function as follows:</p>
<pre><code>In [79]: def pad_with(vector, pad_width, iaxis, kwa... | python|string|python-3.x|numpy | 4 |
370,895 | 49,216,357 | How to keep original index of a DataFrame after groupby 2 columns? | <p>Is there any way I can retain the original index of my large dataframe after I perform a groupby? The reason I need to this is because I need to do an inner merge back to my original df (after my groupby) to regain those lost columns. And the index value is the only 'unique' column to perform the merge back into. Do... | <p>You can elevate your index to a column via <code>reset_index</code>. Then aggregate your index to a tuple via <code>agg</code>, together with your <code>count</code> aggregation.</p>
<p>Below is a minimal example.</p>
<pre><code>import pandas as pd, numpy as np
df = pd.DataFrame(np.random.randint(0, 4, (50, 5)),
... | python|pandas|dataframe|indexing|pandas-groupby | 17 |
370,896 | 49,217,132 | AttributeError: 'module' object has no attribute 'LookupTensor' | <p><strong>I am trying to run a training job in Google Cloud using Tensorflow . I tried to run the training using by running the following command.</strong></p>
<pre><code>gcloud ml-engine jobs submit training training_1 \
--job-dir=gs://object-detection-bucket-test/train \
--packages dist/object_detection-0.1.tar.gz,... | <p>This was posted and eventually answered in <a href="https://github.com/tensorflow/models/issues/3565" rel="nofollow noreferrer">this</a> github issue. Upgrading the runtime to 1.5+ should resolve it. </p> | tensorflow|google-cloud-platform|google-cloud-ml | 0 |
370,897 | 48,896,977 | Database vs flat files in python (need speed but can't fit in memory) to be used with generator for NN training | <p>I am dealing with a relatively large dataset (>400 GB) for analytics purposes but have somewhat limited memory (256 GB). I am using python. So far I have been using pandas on a subset of the data but it is becoming obvious that I need a solution that allows me to access data from the entire dataset.</p>
<p>A little... | <p>This is a good use case for writing a custom generator, then using Keras' model.fit_generator. Here's something I wrote the other day in conjunction with Pandas. </p>
<p>Note that I first split my main dataframe into training and validation splits (merged was my original dataframe), but you may have to move things ... | python|database|pandas|data-structures|bigdata | 1 |
370,898 | 49,235,599 | Titan XP vs Quadro P400 GPU in Pytorch | <p>I gave the the two GPUs on my machine a try and I expected the Titan-XP to be faster than the Quadro-P400. However, both gave almost the same execution time. </p>
<p>I need to know if PyTorch will dynamically choose one GPU over another, or, I myself will have to specify which one PyTorch will use, during run-time.... | <p>Despite what you might believe, the lack of performance difference which you see is because the random number generation is being run on your host CPU not the GPU. If I modify your <code>do_something</code> routine like this:</p>
<pre><code>def do_something(gpu_device, ongpu=False, N=100000000):
torch.cuda.set_... | performance|time|cuda|gpu|pytorch | 3 |
370,899 | 49,184,118 | How can I take the sum of consecutive series with True/False Values Pandas Python | <p>I have the following Data</p>
<pre><code>A B Result
3 True 0
1 True 0
5 True 0
6 False 9
2 True 0
6 True 8
</code></pre>
<p>How can I get the sum of all true values before and after the false Values
as 3 + 1 + 5 = 9 and 2 + 6 = 8</p>
<p>How can i do that wi... | <p>One way is to use apply <code>df.groupby.cumsum()</code> on a <code>pd.Series.cumsum()</code>:</p>
<pre><code>df = pd.DataFrame({'A': [3, 1, 5, 6, 2, 6, 1, 4],
'B': [1, 1, 1, 0, 1, 0, 0, 1]})
df['B'] = df['B'].astype(bool)
df['result'] = df.groupby((~df['B']).cumsum())['A'].cumsum().shift()
df.l... | python|pandas | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.