read_table € symbol

2017-10-26 Thread Davide Dalmasso
Dear all,
I'm trying to read a txt file with read_table but in the file there are some 
string that contain the € symbol and the procedure returns me an error.
I tried with encoding='utf-8' but the problem is still there:
pd.read_table('filename.txt', sep=';', encoding='utf-8')
Anyone can help me?
Many thanks in advance

Davide
-- 
https://mail.python.org/mailman/listinfo/python-list


Finance: Mean-Variance Efficient Frontier - Portfolio Optimization - Markowitz

2013-11-07 Thread Davide Dalmasso
Hi,
is there anyone that have some reliable tool, package or website that can help 
me to solve a financial portfolio optimization problem in Python?
Many thanks in advance

Davide Dalmasso
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: statsmodels.api

2013-09-17 Thread Davide Dalmasso
Il giorno lunedì 16 settembre 2013 17:47:55 UTC+2, Ethan Furman ha scritto:
 On 09/16/2013 08:37 AM, Davide Dalmasso wrote:
 
  Hi,
 
 
 
  I intalled an executable version of statsmodels library for Windows 32-bit.
 
  When I import it in my Python Shell no problem occurs buy when I write:
 
 
 
  import statsmodels.api as sm
 
 
 
  the following error arises:
 
 
 
  Traceback (most recent call last):
 
 File pyshell#1, line 1, in module
 
   import statsmodels.api
 
 File C:\Python33\lib\site-packages\statsmodels\api.py, line 1, in 
  module
 
   from . import iolib, datasets, tools
 
 File C:\Python33\lib\site-packages\statsmodels\iolib\__init__.py, line 
  1, in module
 
   from .foreign import StataReader, genfromdta, savetxt
 
 File C:\Python33\lib\site-packages\statsmodels\iolib\foreign.py, line 
  20, in module
 
   import statsmodels.tools.data as data_util
 
 File C:\Python33\lib\site-packages\statsmodels\tools\__init__.py, line 
  1, in module
 
   from .tools import add_constant, categorical
 
 File C:\Python33\lib\site-packages\statsmodels\tools\tools.py, line 8, 
  in module
 
   from scipy.interpolate import interp1d
 
 File C:\Python33\lib\site-packages\scipy\interpolate\__init__.py, line 
  150, in module
 
   from .interpolate import *
 
 File C:\Python33\lib\site-packages\scipy\interpolate\interpolate.py, 
  line 12, in module
 
   import scipy.special as spec
 
 File C:\Python33\lib\site-packages\scipy\special\__init__.py, line 
  529, in module
 
   from ._ufuncs import *
 
 
 
 We'll need the rest of the traceback, as it will have the actual error.
 
 
 
 --
 
 ~Ethan~

Python 3.3.2 (v3.3.2:d047928ae3f6, May 16 2013, 00:03:43) [MSC v.1600 32 bit 
(Intel)] on win32
Type copyright, credits or license() for more information.
 import statsmodels.api as sm
Traceback (most recent call last):
  File pyshell#0, line 1, in module
import statsmodels.api as sm
  File C:\Python33\lib\site-packages\statsmodels\api.py, line 1, in module
from . import iolib, datasets, tools
  File C:\Python33\lib\site-packages\statsmodels\iolib\__init__.py, line 1, 
in module
from .foreign import StataReader, genfromdta, savetxt
  File C:\Python33\lib\site-packages\statsmodels\iolib\foreign.py, line 20, 
in module
import statsmodels.tools.data as data_util
  File C:\Python33\lib\site-packages\statsmodels\tools\__init__.py, line 1, 
in module
from .tools import add_constant, categorical
  File C:\Python33\lib\site-packages\statsmodels\tools\tools.py, line 8, in 
module
from scipy.interpolate import interp1d
  File C:\Python33\lib\site-packages\scipy\interpolate\__init__.py, line 150, 
in module
from .interpolate import *
  File C:\Python33\lib\site-packages\scipy\interpolate\interpolate.py, line 
12, in module
import scipy.special as spec
  File C:\Python33\lib\site-packages\scipy\special\__init__.py, line 529, in 
module
from ._ufuncs import *
ImportError: DLL load failed: Impossibile trovare il modulo specificato.

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: statsmodels.api

2013-09-17 Thread Davide Dalmasso

You are right... there is a problem with scipy intallation because this error 
arise...

 from scipy.interpolate import interp1d
Traceback (most recent call last):
  File pyshell#3, line 1, in module
from scipy.interpolate import interp1d
  File C:\Python33\lib\site-packages\scipy\interpolate\__init__.py, line 150, 
in module
from .interpolate import *
  File C:\Python33\lib\site-packages\scipy\interpolate\interpolate.py, line 
12, in module
import scipy.special as spec
  File C:\Python33\lib\site-packages\scipy\special\__init__.py, line 529, in 
module
from ._ufuncs import *
ImportError: DLL load failed: Impossibile trovare il modulo specificato.

I tryed to re-install the scipy executable that I downloaded from 
http://www.lfd.uci.edu/~gohlke/pythonlibs/
but the problem persists
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: statsmodels.api

2013-09-17 Thread Davide Dalmasso
On Monday, 16 September 2013 17:37:58 UTC+2, Davide Dalmasso  wrote:
 Hi,
 
 
 
 I intalled an executable version of statsmodels library for Windows 32-bit.
 
 When I import it in my Python Shell no problem occurs buy when I write:
 
 
 
 import statsmodels.api as sm
 
 
 
 the following error arises:
 
 
 
 Traceback (most recent call last):
 
   File pyshell#1, line 1, in module
 
 import statsmodels.api
 
   File C:\Python33\lib\site-packages\statsmodels\api.py, line 1, in module
 
 from . import iolib, datasets, tools
 
   File C:\Python33\lib\site-packages\statsmodels\iolib\__init__.py, line 1, 
 in module
 
 from .foreign import StataReader, genfromdta, savetxt
 
   File C:\Python33\lib\site-packages\statsmodels\iolib\foreign.py, line 20, 
 in module
 
 import statsmodels.tools.data as data_util
 
   File C:\Python33\lib\site-packages\statsmodels\tools\__init__.py, line 1, 
 in module
 
 from .tools import add_constant, categorical
 
   File C:\Python33\lib\site-packages\statsmodels\tools\tools.py, line 8, in 
 module
 
 from scipy.interpolate import interp1d
 
   File C:\Python33\lib\site-packages\scipy\interpolate\__init__.py, line 
 150, in module
 
 from .interpolate import *
 
   File C:\Python33\lib\site-packages\scipy\interpolate\interpolate.py, line 
 12, in module
 
 import scipy.special as spec
 
   File C:\Python33\lib\site-packages\scipy\special\__init__.py, line 529, 
 in module
 
 from ._ufuncs import *
 
 
 
 Why?
 
 
 
 Thanks for any help you will want to give me!
 
 
 
 Davide
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: statsmodels.api

2013-09-17 Thread Davide Dalmasso
Oscar you are right!

The problem was Numpy!
I re-installed it using an executable that I downloaded from:
http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy 
I don't remember if previously I installed it using another source.

However the problem now is disappeared!

Many thanks!

Davide

-- 
https://mail.python.org/mailman/listinfo/python-list


statsmodels.api

2013-09-16 Thread Davide Dalmasso
Hi,

I intalled an executable version of statsmodels library for Windows 32-bit.
When I import it in my Python Shell no problem occurs buy when I write:

import statsmodels.api as sm

the following error arises:

Traceback (most recent call last):
  File pyshell#1, line 1, in module
import statsmodels.api
  File C:\Python33\lib\site-packages\statsmodels\api.py, line 1, in module
from . import iolib, datasets, tools
  File C:\Python33\lib\site-packages\statsmodels\iolib\__init__.py, line 1, 
in module
from .foreign import StataReader, genfromdta, savetxt
  File C:\Python33\lib\site-packages\statsmodels\iolib\foreign.py, line 20, 
in module
import statsmodels.tools.data as data_util
  File C:\Python33\lib\site-packages\statsmodels\tools\__init__.py, line 1, 
in module
from .tools import add_constant, categorical
  File C:\Python33\lib\site-packages\statsmodels\tools\tools.py, line 8, in 
module
from scipy.interpolate import interp1d
  File C:\Python33\lib\site-packages\scipy\interpolate\__init__.py, line 150, 
in module
from .interpolate import *
  File C:\Python33\lib\site-packages\scipy\interpolate\interpolate.py, line 
12, in module
import scipy.special as spec
  File C:\Python33\lib\site-packages\scipy\special\__init__.py, line 529, in 
module
from ._ufuncs import *

Why?

Thanks for any help you will want to give me!

Davide
-- 
https://mail.python.org/mailman/listinfo/python-list


Broadcasting TimeSeries

2013-09-04 Thread Davide Dalmasso
Hello,

I opened my Python Shell and I wrote the following:

 import numpy as np
 import pandas as pd

then I made a function

 def afunc(aframe):
return aframe - aframe.mean(axis=1)

and I defined a DataFrame with time as index

 A = 
 pd.DataFrame(np.random.randn(5,3),columns=['a','b','c'],index=pd.date_range(start='1984-12-20',periods=5))
 A
   a b c
1984-12-20 -0.257916 -0.137923 -0.669796
1984-12-21 -1.632874 -1.850365  1.571715
1984-12-22  1.185828 -0.149839 -1.565930
1984-12-23 -0.757311  0.034627  0.794608
1984-12-24  0.548785 -1.126786 -0.438457

now, if I call the function the following error is generated:

 afunc(A)
Traceback (most recent call last):
  File pyshell#6, line 1, in module
afunc(A)
  File pyshell#3, line 2, in afunc
return aframe - aframe.mean(axis=1)
  File C:\Python33\lib\site-packages\pandas\core\frame.py, line 217, in f
return self._combine_series(other, na_op, fill_value, axis, level)
  File C:\Python33\lib\site-packages\pandas\core\frame.py, line 3601, in 
_combine_series
return self._combine_series_infer(other, func, fill_value)
  File C:\Python33\lib\site-packages\pandas\core\frame.py, line 3619, in 
_combine_series_infer
FutureWarning)
  File C:\Python33\lib\idlelib\PyShell.py, line 60, in idle_showwarning
file.write(warnings.formatwarning(message, category, filename,
AttributeError: 'NoneType' object has no attribute 'write'

then I recall the same function (without any change) and the function works!

 afunc(A)
   a b c
1984-12-20  0.097295  0.217289 -0.314584
1984-12-21 -0.995699 -1.213190  2.208890
1984-12-22  1.362475  0.026808 -1.389283
1984-12-23 -0.781285  0.010652  0.770633
1984-12-24  0.887604 -0.787967 -0.099637

Why does this happen? Why I must call the function two times before it finally 
works?
How can I overcome this problem?

Many thanks in advance

Davide
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: ipython

2013-07-09 Thread davide . dalmasso

I did not see the massage when installation finisched. Sorry!
Many Thanks!!!


 
 The IPython installer actually mentions this when it finishes
 
 installing:
 
 
 
 Distribute (setuptools) is required to create Start Menu items.
 
 Re-run this installer after installing distribute to get Start
 
 Menu items.
 
 
 
 You can grab the setup for distribute from:
 
 
 
  http://python-distribute.org/distribute_setup.py
 
 
 
 If your Python 3.3 installation is part of your PATH, you simply do:
 
 
 
  python3 distribute_setup.py install
 
 
 
 When it's finished, run the IPython installer again and you'll find
 
 it now creates a start menu shortcut for you.
-- 
http://mail.python.org/mailman/listinfo/python-list


ipython

2013-07-08 Thread davide . dalmasso
Hi, I work with Python 3.3.
I downloaded an IPython executable version from 
http://www.lfd.uci.edu/~gohlke/pythonlibs/
I installed it but no shortcut appears in my start menu.
How can I launch it or alternatively is there some other free source of 
executable file for Windows 7?
Many Thanks



-- 
http://mail.python.org/mailman/listinfo/python-list