pandas is a library for PAN-el DA-ta analysis, i.e. multidimensional time series and cross-sectional data sets commonly found in statistics, experimental science results, econometrics, or finance.
1
vote
1answer
9 views
python pandas DataFrame from a list
How do i create a pandas DataFrame from the following list:
ls= \
[['41457', 'PRE', '533', '887', '1/3/1978', '2/1/2008', '[REL]', '217', '197800000003'],\
['41458', 'PRE', '533', '887', '1/3/1978', ...
3
votes
1answer
32 views
Summing across rows of Pandas Dataframe
I have a data frame of records that looks something like this:
stocks = pd.Series(['A', 'A', 'B', 'C', 'C'], name = 'stock')
positions = pd.Series([ 100, 200, 300, 400, 500], name = 'positions')
...
0
votes
1answer
20 views
Pandas dataframe groupby two columns
I have apache access log file in the following format which I have imported to a pandas dataframe using apache log parser.
123.231.12.97 - - [10/Jun/2013:06:04:46 -0600] "GET /styles-gadgets.css ...
2
votes
1answer
25 views
Using Pandas to create DataFrame with Series, resulting in memory error
I'm using Pandas library for remote sensing time series analysis. Eventually I would like to save my DataFrame to csv by using chunk-sizes, but I run into a little issue. My code generates 6 NumPy ...
3
votes
1answer
24 views
Change timezone of date-time column in pandas and add as hierarchical index
I have data with a time-stamp in UTC. I'd like to convert the timezone of this timestamp to 'US/Pacific' and add it as a hierarchical index to a pandas DataFrame. I've been able to convert the ...
2
votes
1answer
30 views
Centering x-tick labels between tick marks in matplotlib
I want to have the x-tick date labels centered between the tick marks, instead of centered about the tick marks as shown in the photo below.
I have read the documentation but to no avail - does ...
3
votes
1answer
21 views
Pandas DataFrame updating Column values with other DataFrame
Consider the following DataFrame X:
Col A Col B
1 2
3 4
5 6
And the DataFrame Y:
Col A Col B
3 7
8 9
Does there exist a built in function in pandas that will Combine the ...
2
votes
1answer
31 views
Pandas DataFrame.unstack() Changes Order of Row and Column Headers
I have run into the following problem of sorting the row and column headers.
Here is how to reproduce this:
X =pd.DataFrame(dict(x=np.random.normal(size=100), y=np.random.normal(size=100)))
...
0
votes
2answers
28 views
unpacking a sql select into a pandas dataframe
Suppose I have a select roughly like this:
select instrument, price, date from my_prices;
How can I unpack the prices returned into a single dataframe with a series for each instrument and indexed ...
2
votes
3answers
33 views
Change date of a DateTimeIndex
I have a csv file named data.csv such as
TS;val
10:00;0.1
10:05;0.2
10:10;0.3
10:15;0.4
I read this csv file using this script
#!/usr/bin/env python
import pandas as pd
if __name__ == ...
3
votes
1answer
24 views
What is the fastest way to build a DataFrame piece by piece?
I am downloading price data from bloomberg and want to build a DataFrame in the fastest and least memory intensive way. Let's say I submit a data request to bloomberg through python for the price ...
5
votes
2answers
37 views
Are there functions to retrieve the histogram counts of a Series in pandas?
There is a method to plot Series histograms, but is there a function to retrieve the histogram counts to do further calculations on top of it?
I keep using numpy's functions to do this and ...
5
votes
1answer
48 views
replace string/value in entire dataframe
I have a very large dataset were I want to replace strings with numbers. I would like to operate on the dataset without typing a mapping function for each key (column) in the dataset. (similar to the ...
4
votes
0answers
75 views
Pandas: Why should appending to a dataframe of floats and ints be slower than if its full of NaN
I am taking data from a file that receives data from Interactive Brokers 5-second OHLCVT bars via Sierra Chart.
Following advice in earlier posts, rather than append each new row to the dataframe I ...
1
vote
1answer
39 views
Merging two .csv files python-pandas
I have two .csv files with the same initial column-header:
NAME RA DEC Mean_I1 Mean_I2 alpha_K24 class alpha_K8 class.1 Av avgAv
Mon-000101 100.27242 9.608597 11.082 ...