multiply two pandas dataframes

I have two pandas dataframes: df1 id type NY PA MD 0 90 superurban 0.1 0.1 0.08 1 88 urban 0.1 0.08 0.08 2 75 suburban 0.06 0.04 0.04 3 60 rural 0.04 0.02 0.02 df2 name item 0 NY 1000 1...
more »

2017-08-16 16:08 (2) Answers

list inside pandas dataframe cells

I have a data-frame like this: and I want a new data-frame with a new column which contains a list like this: How do I create a list inside a data-frame cell which contains the elements based on similar month? ...
more »

2017-08-16 14:08 (4) Answers

How can I split a column into 2?

I have the following df: 0 0 Fuerte venta (0,00)* 1 Infraponderar (0,00)* 2 Neutral (14,00)* 3 Sobreponderar (2,00)* 4 Fuerte compra (11,00)* How could I split the column into 2 columns in order to obtain the fol...
more »

2017-08-15 21:08 (3) Answers

'DataFrame' object has no attribute 'melt'

I just want to use the melt function in pandas and I just keep on getting the same error. Just typing the example provided by the documentation: cheese = pd.DataFrame({'first' : ['John', 'Mary'], 'last' : ['Doe', 'Bo'], ...
more »

2017-08-15 20:08 (2) Answers

Error Extracting Outlook Email Data with Python

I have a Python script that uses os.walk and win32com.client to extract information from Outlook email files (.msg) from a folder and its subfolders on my C:/ drive. It appears to work, but when I try to do anything on the returned dataframe (such as...
more »

2017-08-15 18:08 (0) Answers

Reading in csv file to pandas fails

i have a csv file that is generated by exporting a Tableau table to csv, but I can not manage to open it in Python. I have tried to use pd.read_csv but that fails. import pandas as pd #path to file path = "tableau_crosstab.csv" data = pd.read_cs...
more »

2017-08-15 12:08 (1) Answers

Create new QuarterEnd column in Python Pandas

I'm trying to create a new column with the calendar year's quarter end date (e.g. if today is 4 August, this quarter's end date would be 30 September). My DataFrame has a set of dates in a column called df['dates']. Sample below: 03/08/2017 26/02/...
more »

2017-08-15 10:08 (2) Answers

Call two pandas columns in a function?

I have a bunch of URLs I am trying to write to files. I store the URLs in a pandas dataframe. The dataframe has two columns: url and id. I am trying to request each URL from url and write it to a file named id. Here is what I got so far: def get...
more »

2017-08-15 09:08 (2) Answers