Skip to content

Tag: pandas

How to get output of pandas .plot(kind=’kde’)?

When I plot density distribution of my pandas Series I use Is it possible to get output values of this plot? If yes how to do this? I need the plotted values. Answer There are no output value from .plot(kind=’kde’), it returns a axes object. The raw values can be accessed by _x and _y method of th…

Check if a value exists in pandas dataframe index

I am sure there is an obvious way to do this but cant think of anything slick right now. Basically instead of raising exception I would like to get True or False to see if a value exists in pandas df index. What I have working now is the following Answer This should do the trick

How to write DataFrame to postgres table

There is DataFrame.to_sql method, but it works only for mysql, sqlite and oracle databases. I cant pass to this method postgres connection or sqlalchemy engine. Answer Starting from pandas 0.14 (released end of May 2014), postgresql is supported. The sql module now uses sqlalchemy to support different databas…