Skip to content
Advertisement

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 the matplotlib.lines.Line2D object

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

Merging two dataframes in pandas without column names (new to pandas)

Short explanation: If you have duplicate column names in your data, be sure to rename one column when you read the file. If you have NaN etc in your data, remove those. Then merge using correct answer below. Probably a pretty simple question. I have two datasets that I read in using pandas.read_csv(). My data is in two separate csv.

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 database flavors. You can pass a sqlalchemy engine for a postgresql database (see

Advertisement