Category "pandas"

Problem using IMF data API for a large number of countries

I am trying to download national account data from the API of the International Financial Statistics from the International Monetary Fund. I don't have any trou

How do I get a list of all the duplicate items using pandas in python?

I have a list of items that likely has some export issues. I would like to get a list of the duplicate items so I can manually compare them. When I try to use

Pandas: how can I generate "year-month" format column (period)?

In [20]: df.head() Out[20]: year month capital sales income profit debt 0 2000 6 -19250379.0 37924704.0 -4348337.0 25

TypeError: strptime() argument 1 must be str, not float

I'm having parsing errors on my code, below is the code and almost understandable dataset import numpy as np import pandas as pd from datetime import datetime

How to parse this JSON which starts with two square brackets?

I have a JSON File that starts with two square brackets. How do i parse the data from it? The type of the JSON is class 'list'. I have gone though many Stackove

Interpolate (or extrapolate) only small gaps in pandas dataframe

I have a pandas DataFrame with time as index (1 min Freq) and several columns worth of data. Sometimes the data contains NaN. If so, I want to interpolate only

Inplace Forward Fill on a multi-level column dataframe

I have the following dataframe: arrays = [['bar', 'bar', 'baz', 'baz', 'foo', 'foo', 'qux', 'qux'], ['one', 'two', 'one', 'two', 'one', 'two', 'one', 'two']]

Creating an empty Pandas DataFrame, then filling it?

I'm starting from the pandas DataFrame docs here: http://pandas.pydata.org/pandas-docs/stable/dsintro.html I'd like to iteratively fill the DataFrame with valu

How to change the datetime tick label frequency for matplotlib plots

Below shows a plot of simulated data, which contains the xticks that I want to modify. By default, the pd.df.plot chooses dates that are approximately 3 months

Count groups of consecutive 1s in pandas

I have a list of '1's and '0s' and I would like to calculate the number of groups of consecutive '1's. mylist = [0,0,1,1,0,1,1,1,1,0,1,0] Doing it by hand g

Alternative to Qgrid for displaying "pretty" dataframes in notebooks

I wanted to use some library to have better display of pandas dataframe in notebooks (ie allow sorting of columns, filters etc). Qgrid seemed like a good-enough

Reading coef value from OLS regression results

I use pandas and statsmodels to do linear regression. However, i can't find any possible way to read the results. the results are displayed but i need to do som

AttributeError: module 'pandas' has no attribute 'core'

I have installed the tensorflow library on Windows, then my Pandas library stopped working, and after pandas importing appears the same issue as by importing th

How to apply a function to two columns of Pandas dataframe

Suppose I have a df which has columns of 'ID', 'col_1', 'col_2'. And I define a function : f = lambda x, y : my_function_expression. Now I want to apply the f

Check which columns in DataFrame are Categorical

I am new to Pandas... I want to a simple and generic way to find which columns are categorical in my DataFrame, when I don't manually specify each column type,

SQLAlchemy ORM conversion to pandas DataFrame

Is there a solution converting a SQLAlchemy <Query object> to a pandas DataFrame? Pandas has the capability to use pandas.read_sql but this requires use o

SQLAlchemy ORM conversion to pandas DataFrame

Is there a solution converting a SQLAlchemy <Query object> to a pandas DataFrame? Pandas has the capability to use pandas.read_sql but this requires use o

pandas row values to column headers

I have a daraframe like this df = pd.DataFrame({'id1':[1,1,1,1,2,2,2],'id2':[1,1,1,1,2,2,2],'value':['a','b','c','d','a','b','c']}) id1 id2 value 0 1

Python Pandas replace NaN in one column with value from corresponding row of second column

I am working with this Pandas DataFrame in Python. File heat Farheit Temp_Rating 1 YesQ 75 N/A 1 NoR 115 N/A

How to fix Python Numpy/Pandas installation?

I would like to install Python Pandas library (0.8.1) on Mac OS X 10.6.8. This library needs Numpy>=1.6. I tried this $ sudo easy_install pandas Searching