Giter Club home page Giter Club logo

calmap's People

Contributors

cduvallet avatar kianmeng avatar ma-schmidt avatar martijnvermaat avatar marvint avatar zztin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

calmap's Issues

TypeError: pivot() takes 1 positional argument but 4 were given

Hello, I have encountered some issues while using the function calmap.calendarplot.
Here is my code:

from doc.Plot.require import *
import calmap

# Import Data
df = pd.read_csv("https://raw.githubusercontent.com/selva86/datasets/master/yahoo.csv", parse_dates=['date'])
# df = pd.read_csv("../data/yahoo.csv", parse_dates=['date'])
df.set_index('date', inplace=True)

# Plot
plt.figure(figsize=(16, 10), dpi=60)
calmap.calendarplot(df[df['year'] == 2014]['VIX.Close'], fig_kws={'figsize': (16, 10)}, how="sum",
yearlabel_kws={'color': 'black', 'fontsize': 14}, subplot_kws={'title': 'Yahoo Stock Prices'})
plt.show()
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[49], line 11
      9 # Plot
     10 plt.figure(figsize=(16, 10), dpi=60)
---> 11 calmap.calendarplot(df[df['year'] == 2014]['VIX.Close'], fig_kws={'figsize': (16, 10)}, how="sum",
     12 yearlabel_kws={'color': 'black', 'fontsize': 14}, subplot_kws={'title': 'Yahoo Stock Prices'})
     13 plt.show()

File ~\AppData\Roaming\Python\Python39\site-packages\calmap\__init__.py:403, in calendarplot(data, how, yearlabels, yearascending, yearlabel_kws, subplot_kws, gridspec_kws, fig_kws, fig_suptitle, vmin, vmax, **kwargs)
    400 max_weeks = 0
    402 for year, ax in zip(years, axes):
--> 403     yearplot(by_day, year=year, how=None, ax=ax, **kwargs)
    404     max_weeks = max(max_weeks, ax.get_xlim()[1])
    406     if yearlabels:

File ~\AppData\Roaming\Python\Python39\site-packages\calmap\__init__.py:202, in yearplot(data, year, how, vmin, vmax, cmap, fillcolor, linewidth, linecolor, daylabels, dayticks, monthlabels, monthticks, monthly_border, ax, **kwargs)
    197 by_day.loc[(by_day.index.month == 12) & (by_day.week < 10), "week"] = (
    198     by_day.week.max() + 1
    199 )
    201 # Pivot data on day and week and mask NaN days. (we can also mask the days with 0 counts)
--> 202 plot_data = by_day.pivot("day", "week", "data").values[::-1]
    203 plot_data = np.ma.masked_where(np.isnan(plot_data), plot_data)
    205 # Do the same for all days of the year, not just those we have data for.

TypeError: pivot() takes 1 positional argument but 4 were given

and the variables df[df['year'] == 2014]['VIX.Close'] output is

df[df['year'] == 2014]['VIX.Close'] output:

date
2014-01-02    14.230000
2014-01-03    13.760000
2014-01-06    13.550000
2014-01-07    12.920000
2014-01-08    12.870000
                ...    
2014-12-24    14.370000
2014-12-26    14.500000
2014-12-29    15.060000
2014-12-30    15.920000
2014-12-31    19.200001

I am uncertain about how to modify this code. Even when I search for examples on Stack Overflow that appear identical, they still result in errors. Could you please guide me on how to modify this code? Thank you.

TODO: migrate CICD to GHA

I never got around to migrating this from travisCI to GHA and I've run out of credits over there after they killed the free OS support.
I had to manually deploy 0.0.11
I would welcome a PR helping with this.

Python 3.12: ModuleNotFoundError: No module named 'distutils'

With Python 3.12:

Python 3.12.1 (v3.12.1:2305ca5144, Dec  7 2023, 17:23:38) [Clang 13.0.0 (clang-1300.0.29.30)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import calmap
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/calmap/__init__.py", line 18, in <module>
    from distutils.version import StrictVersion
ModuleNotFoundError: No module named 'distutils'

This is because distutils is no longer part of Python from 3.12 onwards:

A workaround is to install Setuptools, but the recommended advice to to replace distutils.version with the modern packaging.version API:

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.