我找不到如何正确索引我的数据框列
我尝试了一些方法,但是找不到正确的方法
import pandas as pd
df = pd.read_html('sbi.html')
data = df[1]
我希望第二行作为其中存在“ Narration”的列的索引
答案 0 :(得分:1)
将public class UserEntity
{
public int Id { get; set; }
[Encrypted]
public string Username { get; set; }
[Encrypted]
public string Password { get; set; }
public int Age { get; set; }
}
public class DatabaseContext : DbContext
{
// Get key and IV from a Base64String or any other ways.
// You can generate a key and IV using "AesProvider.GenerateKey()"
private readonly byte[] _encryptionKey = ...;
private readonly byte[] _encryptionIV = ...;
private readonly IEncryptionProvider _provider;
public DbSet<UserEntity> Users { get; set; }
public DatabaseContext(DbContextOptions options)
: base(options)
{
this._provider = new AesProvider(this._encryptionKey, this._encryptionIV);
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.UseEncryption(this._provider);
}
}
参数设置为header
:
1
或使用data = pd.read_html('sbi.html', header=1)[0]
参数:
skiprows