Giter Site home page Giter Site logo

filebase's Introduction

filebase

Filebase was thought to be a simple library to enable the storage of data without the necessity of database, its interaction with Pandas leaves it good for analytics. The storage is done through files with any data-type, but for the Pandas to it is necessary to write objects that extends the Pandas DataFrame class. The data is serialized using the msgPack library, so the read and write can be performed in a shorter time and achieved savings of 35% in storage size.

Examples

dataFrame pandas

from src import Filebase
import os
import pandas as pd

#set file base path
pack = Filebase(os.getcwd() + "/data")

#set files collection path
#use "/" for create sub paths
pack.set_collection("2013/03")

#create data frame pandas
dataframe = pd.DataFrame({
    'a': pd.Series(range(10)),
    'b': pd.Series(range(10)),
    'c': pd.Series(range(10))
})

#create new file
#params: index, file value
pack.create("test7", dataframe)

#read file
file_c = pack.read("test7")

print(file_c)

[out]:

   a  b  c
0  0  0  0
1  1  1  1
2  2  2  2
3  3  3  3
4  4  4  4
5  5  5  5
6  6  6  6
7  7  7  7
8  8  8  8
9  9  9  9

Create

from src import Filebase
import os

value = { "test" : "text test"  }

#set file base path
pack = Filebase(os.getcwd() + "/data")

#set files collection path
#use "/" for create sub paths
pack.set_collection("2017/03")

# params: index, file value
pack.create("test", value)

print(pack.read("test"))

[out]:

{'test': 'text test'}

Update

from src import Filebase
import os

value = { "test" : "text test update"  }

#set file base path
pack = Filebase(os.getcwd() + "/data")

#set files collection path
#use "/" for create sub paths
pack.set_collection("2017/03")

#params: index, file value
pack.update("test", value)

print(pack.read("test"))

[out]:

{'test': 'text test update'}

filebase's People

Contributors

jefynho1213 avatar diegomrodz avatar

Stargazers

 avatar

Watchers

James Cloos avatar  avatar  avatar

Forkers

jefersonpassos

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.