tagged [pandas]
Python Pandas: Convert Rows as Column headers
Python Pandas: Convert Rows as Column headers I have the following dataframe: I want it this way. ``` Yea
Pandas plot doesn't show
Pandas plot doesn't show When using this in a script (not IPython), nothing happens, i.e. the plot window doesn't appear : Even when adding `time.sleep(5)`, there is still nothing. Why? Is there a way...
- Modified
- 18 Dec at 01:23
how to merge two data frames based on particular column in pandas python?
how to merge two data frames based on particular column in pandas python? I have to merge two dataframes: df1 df2 I have to unify both dataframes to one dataframe. I need output like:
- Modified
- 30 Jun at 13:7
How to lowercase a pandas dataframe string column if it has missing values?
How to lowercase a pandas dataframe string column if it has missing values? The following code does not work. How should I tweak it to get xLower = ['one','two',np.nan] ? Efficiency is important since...
- Modified
- 14 May at 23:34
How to implement a Boolean search with multiple columns in pandas
How to implement a Boolean search with multiple columns in pandas I have a pandas df and would like to accomplish something along these lines (in SQL terms): Now this works, for one column/value pair:...
How to calculate percentage with Pandas' DataFrame
How to calculate percentage with Pandas' DataFrame How to add another column to Pandas' DataFrame with percentage? The dict can change on size.
move column in pandas dataframe
move column in pandas dataframe I have the following dataframe: How can I move columns b and x such that they are the last 2 columns in the dataframe? I would like to specify b and x by name, but not ...
Difference between map, applymap and apply methods in Pandas
Difference between map, applymap and apply methods in Pandas Can you tell me when to use these vectorization methods with basic examples? I see that `map` is a `Series` method whereas the rest are `Da...
- Modified
- 20 Jan at 17:7
How to plot multiple dataframes in subplots
How to plot multiple dataframes in subplots I have a few Pandas DataFrames sharing the same value scale, but having different columns and indices. When invoking `df.plot()`, I get separate plot images...
- Modified
- 20 Jul at 21:59
cartesian product in pandas
cartesian product in pandas I have two pandas dataframes: What is the best practice to get their cartesian product (of course without writing it explicitly like me)?
- Modified
- 12 Feb at 02:19
Replacing Pandas or Numpy Nan with a None to use with MysqlDB
Replacing Pandas or Numpy Nan with a None to use with MysqlDB I am trying to write a Pandas dataframe (or can use a numpy array) to a mysql database using MysqlDB . MysqlDB doesn't seem understand 'na...
- Modified
- 4 Jan at 12:20
Pandas DataFrame column to list
Pandas DataFrame column to list I am pulling a subset of data from a column based on conditions in another column being met. I can get the correct values back but it is in pandas.core.frame.DataFrame....
add columns different length pandas
add columns different length pandas I have a problem with adding columns in pandas. I have DataFrame, dimensional is nxk. And in process I wiil need add columns with dimensional mx1, where m = [1,n], ...
Logarithmic returns in pandas dataframe
Logarithmic returns in pandas dataframe Python pandas has a pct_change function which I use to calculate the returns for stock prices in a dataframe: I am using the following code to get logarithmic r...
Python Pandas - Missing required dependencies ['numpy'] 1
Python Pandas - Missing required dependencies ['numpy'] 1 Since yesterday I've had this error when I try to import packages on anaconda : `ImportError: Missing required dependencies ['numpy']` I have ...
How to draw vertical lines on a given plot
How to draw vertical lines on a given plot Given a plot of a signal in time representation, how can I draw lines marking the corresponding time index? Specifically, given a signal plot with a time ind...
- Modified
- 11 Jul at 09:58
'DataFrame' object has no attribute 'sort'
'DataFrame' object has no attribute 'sort' I face some problem here, in my python package I have install `numpy`, but I still have this error: > Anyone can give me some idea.. This is my code : ``` fi...
How to concatenate two dataframes without duplicates?
How to concatenate two dataframes without duplicates? I'd like to concatenate two dataframes `A`, `B` to a new one without duplicate rows (if rows in `B` already exist in `A`, don't add): Dataframe `A...
- Modified
- 9 May at 15:19
TypeError: 'DataFrame' object is not callable
TypeError: 'DataFrame' object is not callable I've programmed these for calculating Variance I'm getting this error ``` Traceback (most recent call last): File "C:/Python34/project.py", line 11, in ...
- Modified
- 5 Sep at 01:12
Make Pandas DataFrame apply() use all cores?
Make Pandas DataFrame apply() use all cores? As of August 2017, Pandas [DataFame.apply()](https://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.apply.html) is unfortunately still lim...
Rename specific column(s) in pandas
Rename specific column(s) in pandas I've got a dataframe called `data`. How would I rename the only one column header? For example `gdp` to `log(gdp)`?
Splitting timestamp column into separate date and time columns
Splitting timestamp column into separate date and time columns I have a pandas dataframe with over 1000 timestamps (below) that I would like to loop through: I'm having a hard time splitting this time...
How to properly apply a lambda function into a pandas data frame column
How to properly apply a lambda function into a pandas data frame column I have a pandas data frame, `sample`, with one of the columns called `PR` to which am applying a lambda function as follows: ```...