Tensorflow 小技巧 (一)
how-do-i-select-rows-from-a-dataframe-based-on-column-values
To select rows whose column value equals a scalar, some_value
, use ==
:
To select rows whose column value is in an iterable, some_values
, use isin
:
how-do-i-sort-a-dictionary-by-value
how-can-i-count-the-occurrences-of-a-list-item
pandas.DataFrame.drop_duplicates
tf.data.Dataset-----as_numpy_iterator()
Returns an iterator which converts all elements of the dataset to numpy.
tf.data.Dataset
The tf.data.Dataset
API supports writing descriptive and efficient input pipelines. Dataset
usage follows a common pattern:
Create a source dataset from your input data.
Apply dataset transformations to preprocess the data.
Iterate over the dataset and process the elements.
Iteration happens in a streaming fashion, so the full dataset does not need to fit into memory.
The simplest way to create a dataset is to create it from a python list:
Once you have a dataset, you can apply transformations to prepare the data for your model:
评论