Giter Site home page Giter Site logo

yearfrac's People

Contributors

agroszer avatar emiliobasualdo avatar fatkaratekid avatar ulf1 avatar vinschess avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

yearfrac's Issues

cannot import name 'collections_abc' from 'six.moves'

I have encountered the following error while using another module (xlcalculator): cannot import name 'collections_abc' from 'six.moves'. The six version that I have installed for the root user is 1.15.0. Regarding the normal user, I have six v1.12.0 installed, and unfortunately, it can't be upgraded: "Cannot uninstall 'six'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall"

The easy fix was to replace the line "from six.moves import collections_abc" with "from collections.abc import Iterable". I also replaced "collections_abc.Iterable" with "Iterable"

Deprecation warning

Hi There,
I have been using this yearfrac tool to calc year fraction to simulate Excel's YEARFRAC function. I have recently encountered an issue as follows. Do you know what is causing this error?

d1 = datetime(2020,12,31)
d2 = datetime(2021,1,31)
x = yf.yearfrac(d1, d2, '30e360')


DeprecationWarning Traceback (most recent call last)
in
9 d2 = datetime(2021,1,31)
10 d1, d2
---> 11 x = yf.yearfrac(d1, d2)
12 # x

~\AppData\Local\Continuum\anaconda3\envs\flaskenv\lib\site-packages\yearfrac\yearfrac.py in yearfrac(d1, d2, method)
57 yearfrac_func = __algorithm_mapper[
58 (
---> 59 isinstance(d1, collections.Iterable),
60 isinstance(d2, collections.Iterable)
61 )

~\AppData\Local\Continuum\anaconda3\envs\flaskenv\lib\collections_init_.py in getattr(name)
50 "of from 'collections.abc' is deprecated since Python 3.3,"
51 "and in 3.9 it will stop working",
---> 52 DeprecationWarning, stacklevel=2)
53 globals()[name] = obj
54 return obj

DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3,and in 3.9 it will stop working

I can reproduce this error using Jupyter notebook/lab, but when I type the commands in python prompt, it works:

import yearfrac as yf
from datetime import datetime
d1 = datetime(2020,12,31)
d2 = datetime(2021,1,31)
x = yf.yearfrac(d1, d2)
x
0.0821917808219178
x = yf.yearfrac(d1, d2, '30e360')
x
0.08333333333333333

Thanks.

Can't install package

Hi I have some issue to install yearfrac package as follows. Please guide us how to install successfully.

PS C:\Users\User\Downloads\yearfrac-0.4.7> python setup.py install
Traceback (most recent call last):
File "C:\Users\User\Downloads\yearfrac-0.4.7\setup.py", line 24, in
long_description=read('README.rst'),
File "C:\Users\User\Downloads\yearfrac-0.4.7\setup.py", line 7, in read
s = fp.read()
UnicodeDecodeError: 'cp949' codec can't decode byte 0xe2 in position 488: illegal multibyte sequence

add a vectorized version of the yearfrac function

Current state

  • yearfrac.yearfrac(d1, d2) expect two datetime.dateime objects d1 and d2

Todo

  • rewrite yearfrac.yearfrac(d1, d2) that it accept list, tuple, ndarray, panda cols, etc with date objects as d1 or d2

Behavior

  • Example 1: d1 is a datetime.datetime object, d2 is a datetime.datetime object, the return value is a floating point number
  • Example 2: d1 is a datetime.datetime object, d2 is a list of datetime.datetime objects, the return value is a list of floating point numbers
  • Example 3: d1 is a list of datetime.datetime objects, d2 is a list of datetime.datetime objects, the return value is a list of floating point numbers

Links

Optional

  • unittest for the test/... folder
  • demo notebook for the example/... folder

Rewards

  • the new feature will get an own 0.Y.0 version
  • you are mentioned in the README.md as contributor

add gitpod badge

[![Gitpod - Code Now](https://img.shields.io/badge/Gitpod-code%20now-blue.svg?longCache=true)](https://gitpod.io#https://github.com/kmedian/yearfrac)

install breaks with setuptools 67

error in yearfrac setup command: 'install_requires' must be a string or list of strings containing valid project/version requirement specifiers; Expected end or semicolon (after version specifier)
numpy>=1.14.*

Last day of the year not being counted

diffa = date_to_jd(y1, 12, 31) - date_to_jd(y1, m1, d1)

Hi there, great library!
I believe we found a small bug.
The last day of the year is not being taken into account in the subtraction because 12/31 is the begging of the day(00:00:00hs)

We believe the answer could be just adding 1 day
diffa = date_to_jd(y1, 12, 31) - date_to_jd(y1, m1, d1) + 1

Please tell me what you think, best regards

Not able to install yearfrac (version = 0.4.4)

Hey

I am trying to install yearfrac version 0.4.4. But i am getting below error:

Collecting yearfrac==0.4.4
 Downloading yearfrac
 Preparing metadata (setup.py): started
 Preparing metadata (setup.py): finished with status 'error'
 error: subprocess-exited-with-error
  
 × python setup.py egg_info did not run successfully.
 │ exit code: 1
 ╰─> [3 lines of output]
   error in yearfrac setup command: 'install_requires' must be a string or list of strings containing valid project/version requirement specifiers; Expected end or semicolon (after version specifier)
     numpy>=1.14.*
        ~~~~~~^
   [end of output]
  
 note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> yearfrac

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

I am not specifying numpy version in my requirements file. Not sure whats going wrong here.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.