kmedian / yearfrac Goto Github PK
View Code? Open in Web Editor NEWDifference between dates as a fraction of 1 year
License: MIT License
Difference between dates as a fraction of 1 year
License: MIT License
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"
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.
Todo
yearfrac/d30365.py
Optional
test/...
folderexample/...
folderyearfrac/yearfrac.py
Rewards
0.Y.0
versionHi 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
Current state
yearfrac.yearfrac(d1, d2)
expect two datetime.dateime
objects d1
and d2
Todo
yearfrac.yearfrac(d1, d2)
that it accept list, tuple, ndarray, panda cols, etc with date objects as d1
or d2
Behavior
d1
is a datetime.datetime
object, d2
is a datetime.datetime
object, the return value is a floating point numberd1
is a datetime.datetime
object, d2
is a list of datetime.datetime
objects, the return value is a list of floating point numbersd1
is a list of datetime.datetime
objects, d2
is a list of datetime.datetime
objects, the return value is a list of floating point numbersLinks
Optional
test/...
folderexample/...
folderRewards
0.Y.0
versionTodo
yearfrac/d30360e.py
Optional because
test/...
folderexample/...
folderyearfrac/yearfrac.py
Rewards
0.Y.0
version[![Gitpod - Code Now](https://img.shields.io/badge/Gitpod-code%20now-blue.svg?longCache=true)](https://gitpod.io#https://github.com/kmedian/yearfrac)
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.*
Line 22 in 0969623
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
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.