$ wget https://bootstrap.pypa.io/get-pip.py
$ sudo python3 get-pip.py
$ rm get-pip.py
$ sudo pip install virtualenv virtualenvwrapper
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright 2023 Gordon D. Thompson, gord@gordthompson.com | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# | |
# Licensed to the Apache Software Foundation (ASF) under one or more | |
# contributor license agreements. See the NOTICE file distributed with | |
# this work for additional information regarding copyright ownership. | |
# The ASF licenses this file to You under the Apache License, Version 2.0 | |
# (the "License"); you may not use this file except in compliance with | |
# the License. You may obtain a copy of the License at | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
from sbpy.data import Names | |
# function to create the new packed format column | |
def pack_designation( | |
row: pd.Series, | |
) -> pd.Series: | |
return pd.Series( | |
data=[Names.to_packed(row.pdes)], | |
index=['Principal_desig'], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pyspark.mllib.stat import Statistics | |
import pandas as pd | |
# result can be used w/ seaborn's heatmap | |
def compute_correlation_matrix(df, method='pearson'): | |
# wrapper around | |
# https://forums.databricks.com/questions/3092/how-to-calculate-correlation-matrix-with-all-colum.html | |
df_rdd = df.rdd.map(lambda row: row[0:]) | |
corr_mat = Statistics.corr(df_rdd, method=method) | |
corr_mat_df = pd.DataFrame(corr_mat, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
directory = "/home/james/images" | |
extension = ".jpg" | |
prefix = "prefix_" | |
for filename in os.listdir(directory): | |
if not filename.endswith(extension): | |
continue | |
new_filename = prefix + filename | |
old_file_path = os.path.join(directory, filename) | |
new_file_path = os.path.join(directory, new_filename) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Create and activate a new conda environment:
$ conda create -n myenv python=3 --yes
$ conda activate myenv
Add the conda-forge
channel into the conda configuration:
$ conda config --add channels conda-forge
Add packages into the environment using both conda
and pip
:
NewerOlder