code
stringlengths
3
6.57k
Appender(_shared_docs["to_excel"] % dict(klass="object")
isinstance(self, ABCDataFrame)
self.to_frame()
index (``index=False``)
df.to_json(orient='split')
df.to_json(orient='records')
df.to_json(orient='index')
df.to_json(orient='columns')
df.to_json(orient='values')
df.to_json(orient='table')
config.is_nonnegative_int(indent)
Format (HDF)
supported (default if no compressor specified: 'blosc:blosclz')
pd.get_option('io.hdf.default_format')
df.to_hdf('data.h5', key='df', mode='w')
pd.Series([1, 2, 3, 4])
s.to_hdf('data.h5', key='s')
pd.read_hdf('data.h5', 'df')
pd.read_hdf('data.h5', 's')
os.remove('data.h5')
schema (if database flavor supports this)
column(s)
given (default)
clause (one per row)
create_engine('sqlite://', echo=False)
pd.DataFrame({'name' : ['User 1', 'User 2', 'User 3']})
df.to_sql('users', con=engine)
engine.execute("SELECT * FROM users")
fetchall()
pd.DataFrame({'name' : ['User 4', 'User 5']})
df1.to_sql('users', con=engine, if_exists='append')
engine.execute("SELECT * FROM users")
fetchall()
engine.execute("SELECT * FROM users")
fetchall()
dtype (especially useful for integers with missing values)
pd.DataFrame({"A": [1, None, 2]})
Integer()
engine.execute("SELECT * FROM integers")
fetchall()
Pickle (serialize)
HIGHEST_PROTOCOL (see [1]_ paragraph 12.1.2)
object (or any object)
pd.DataFrame({"foo": range(5)
range(5, 10)
original_df.to_pickle("./dummy.pkl")
pd.read_pickle("./dummy.pkl")
os.remove("./dummy.pkl")
to_pickle(self, path, compression=compression, protocol=protocol)
values (csv)
pd.DataFrame([[1, 2, 3], [4, 5, 6]], columns=['A', 'B', 'C'])
df.to_clipboard(sep=',')
df.to_clipboard(sep=',', index=False)
clipboards.to_clipboard(self, excel=excel, sep=sep, **kwargs)
to_xarray(self)
pd.DataFrame([('falcon', 'bird', 389.0, 2)
df.to_xarray()
index (index)
name (index)
class (index)
max_speed (index)
num_legs (index)
to_xarray()
array([389. , 24. , 80.5, nan])
index (index)
df_multiindex.set_index(['date', 'animal'])
df_multiindex.to_xarray()
date (date)
animal (animal)
speed (date, animal)
import_optional_dependency("xarray")
xarray.DataArray.from_series(self)
xarray.Dataset.from_dataframe(self)
Substitution(returns=fmt.return_docstring)
names (index)
labels (instead of top-aligned)
print(df.to_latex(index=False)
self.to_frame()
config.get_option("display.latex.longtable")
config.get_option("display.latex.escape")
config.get_option("display.latex.multicolumn")
config.get_option("display.latex.multicolumn_format")
config.get_option("display.latex.multirow")
values (csv)
names (index)
column(s)
called ('\n' for linux, '\r\n' for Windows, i.e.)
df.to_csv(index=False)
isinstance(self, ABCDataFrame)
self.to_frame()
formatter.save()
formatter.path_or_buf.getvalue()
_set_as_cached(self, item, cacher)
weakref.ref(cacher)
_reset_cacher(self)
hasattr(self, "_cacher")
_maybe_cache_changed(self, item, value)
self._data.set(item, value)
_is_cached(self)
getattr(self, "_cacher", None)