English: NaN is a numeric data type interpretable as a value that is undefined or unrepresentable. Dividing 0 by 0 for instance, is not defined, and produces a NaN value in most floating point systems.
Attaching package: 'arrow'
The following object is masked from 'package:utils':
timestamp
import numpy as nptoy_vector_numeric = np.array([1,2,3,4,5])toy_vector_character = np.array(['a','b','c','d','e'])toy_list = ['a','1',True,['red','green']]toy_dictionary = { 'a':1 , 'b':2, 'c':3}from jax import numpy as jnptoy_vector_numeric_jax = jnp.array([1,2,3,4,5])#toy_vector_character_jax = jnp.array(['a','b','c','d','e']) #only numeric is allowed in jax
WARNING:jax._src.lib.xla_bridge:No GPU/TPU found, falling back to CPU. (Set TF_CPP_MIN_LOG_LEVEL=0 and rerun for more info.)
import pandas as pdtoy_df = pd.DataFrame(data={'id': ['unit1','unit2','unit3'], 'y': [1, 2, 3], 'x': [3, 2, 1]})import torchimport tensorflow as tfimport pyarrow as pa
library(DBI)# Create an ephemeral in-memory RSQLite database#con <- dbConnect(RSQLite::SQLite(), dbname = ":memory:")#dbListTables(con)#dbWriteTable(con, "mtcars", mtcars)#dbListTables(con)#Configuration failed because libpq was not found. Try installing:#* deb: libpq-dev libssl-dev (Debian, Ubuntu, etc)#install.packages('RPostgres')#remotes::install_github("r-dbi/RPostgres")#Took forever because my file permissions were broken#pg_lsclustersrequire(RPostgres)# Connect to the default postgres database#I had to follow these instructions and create both a username and database that matched my ubuntu name#https://www.digitalocean.com/community/tutorials/how-to-install-postgresql-on-ubuntu-20-04-quickstartcon_Postgres <-dbConnect(RPostgres::Postgres())
DROPTABLEIFEXISTS toy_df;
CREATETABLEIFNOTEXISTS toy_df (idvarchar(5), y INTEGER, x INTEGER);
INSERTINTO toy_df (id, y, x)VALUES ('unit1',1,3), ('unit2',2,2), ('unit3',3,1);
“Do not test equality to NaN, or even use identical, since systems typically have many different NaN values. One of these is used for the numeric missing value NA, and is.nan is false for that value. A complex number is regarded as NaN if either the real or imaginary part is NaN but not NA. All elements of logical, integer and raw vectors are considered not to be NaN.”
NaN
[1] NaN
NaN==NaN
[1] NA
identical(NaN,NaN)
[1] TRUE
identical(NaN,0/0)
[1] TRUE
pi /0## = Inf a non-zero number divided by zero creates infinity
As mentioned in the above section, the Python object None is always converted to an Arrow null element on the conversion to pyarrow.Array. For the float NaN value which is either represented by the Python object float(‘nan’) or numpy.nan we normally convert it to a valid float value during the conversion. If an integer input is supplied to pyarrow.array that contains np.nan, ValueError is raised.
To handle better compatibility with Pandas, we support interpreting NaN values as null elements. This is enabled automatically on all from_pandas function and can be enable on the other conversion functions by passing from_pandas=True as a function parameter.”