utils

package
v0.0.0-...-e9436ff Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 1, 2021 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Overview

SizeStruct project clone from https://github.com/Re-volution/sizestruct

Index

Constants

View Source
const (
	IndexColName = "__dato_idx__"
)

*

  • 为df重新设置index,如果没有则添加index列,如果有则重新设置index的值

Variables

This section is empty.

Functions

func AddDays

func AddDays(current string, delta int) string

*

  • 基于某个日期甲减几天后的日期

func AddDaysExceptWeekend

func AddDaysExceptWeekend(current string, delta int) string

*

  • 加减几天的日期(自动跳过周末)

func ConvertTo

func ConvertTo(src string, srcCode string, tagCode string) string

*

  • 字符串转换编码
  • param string src: 待转换的字符串
  • param string strCode: 源编码
  • param string tagCode: 目标编码

func DateToStr

func DateToStr(item time.Time) string

*

  • 将指定日期转换为字符串格式
  • yyyymmdd

func Element

func Element(data dataframe.DataFrame, row int, colname string) series.Element

*

  • 从指定记录集中获取某个元素

func FileListInPath

func FileListInPath(filePath string) ([]string, error)

*

获取指定目录中的文件列表
:param file_path: 指定的路径
:return: []string, error
:notice
只遍历文件忽略文件夹

func FindInIntegerSlice

func FindInIntegerSlice(n int, nAry []int) int

从 slice 中查找指定的数字 返回相应的索引值,找不到返回-1

func FindInStringSlice

func FindInStringSlice(str string, s []string) int

从 slice 中查找指定的字符串 返回相应的索引值,找不到返回-1

func GenerateIndex

func GenerateIndex(start, step, max int) []int

*

  • 生成指定的索引数组

func GetExeDir

func GetExeDir() string

*

  • 获取当前应用程序所在目录

func IsDirExist

func IsDirExist(path string) bool

*

  • 判断指定目录是否存在

func IsFileExists

func IsFileExists(path string) (bool, error)

*

  • 判断指定文件是否存在

func NewUUID

func NewUUID() string

生成UUID字符串

func RandomMacAddress

func RandomMacAddress() string

生成MAC地址

func ReIndex

为df增加idx列

func ReadCSV

func ReadCSV(filename string, options ...dataframe.LoadOption) dataframe.DataFrame

*

  • 从CSV中加载df数据

func SizeStruct

func SizeStruct(data interface{}) int

func StrToDate

func StrToDate(date string) time.Time

*

  • 将字符串格式的时间转换为Time类型
  • date: yyyymmdd

func Today

func Today() string

*

  • 获取今天的日期
  • yyyymmdd

func WriteCSV

func WriteCSV(filename string, mode int, df *dataframe.DataFrame, option ...dataframe.WriteOption) error

*

  • 保存股票数据
  • param int mode: os.O_CREATE | os.O_APPEND | os.O_RDONLY | os.O_WRONLY | os.O_RDWR

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL